class ACTV::Author
Public Class Methods
build_from_article(article_hash)
click to toggle source
# File lib/actv/author.rb, line 6 def self.build_from_article article_hash new article_hash end
valid?(response)
click to toggle source
# File lib/actv/author.rb, line 10 def self.valid? response ACTV::AuthorValidator.new(response).valid? end
Public Instance Methods
bio()
click to toggle source
# File lib/actv/author.rb, line 22 def bio @bio ||= begin bio_node = from_footer 'div.author-text' bio_node.inner_html unless bio_node.nil? end end
image_url()
click to toggle source
# File lib/actv/author.rb, line 39 def image_url if photo.url && photo.url.start_with?("/") "https://www.active.com#{photo.url}" else photo.url end end
name()
click to toggle source
# File lib/actv/author.rb, line 14 def name name_from_footer.presence || self.author_name.presence end
photo()
click to toggle source
# File lib/actv/author.rb, line 29 def photo @photo ||= begin image_node = from_footer 'div.signature-block-photo img' if image_node url = image_node.attribute('src').to_s ACTV::AssetImage.new imageUrlAdr: url end end end