class Lita::Handlers::WhatsBradEating
Constants
- BLOG_URL
START:blog_url
Public Instance Methods
brad_eats(response)
click to toggle source
START:brad_eats
# File lib/lita/handlers/whats_brad_eating.rb, line 36 def brad_eats(response) # caption text had some stray newlines we don't need caption_text = caption.text.strip img_url = image.get_attribute('src') msg = "#{caption_text} >> #{img_url}" response.reply msg end
caption()
click to toggle source
# File lib/lita/handlers/whats_brad_eating.rb, line 31 def caption image.attributes.fetch('alt') end
first_post()
click to toggle source
# File lib/lita/handlers/whats_brad_eating.rb, line 23 def first_post parsed_response.css('section.post').first end
image()
click to toggle source
# File lib/lita/handlers/whats_brad_eating.rb, line 27 def image first_post.css('.photo-wrapper img').first end
parsed_response()
click to toggle source
END:blog_url
# File lib/lita/handlers/whats_brad_eating.rb, line 19 def parsed_response Nokogiri.parse(response.body) end
response()
click to toggle source
# File lib/lita/handlers/whats_brad_eating.rb, line 14 def response @_response ||= http.get(BLOG_URL) end