class Trio::Blog::API::PostAttributes

Attributes

selectors[R]

Public Class Methods

new(selectors, document, config) click to toggle source
Calls superclass method Trio::Blog::API::DocumentReader::new
# File lib/trio/blog/api/post_attributes.rb, line 9
def initialize(selectors, document, config)
  super(document, config)
  @selectors = selectors
end

Public Instance Methods

author_avatar_image_url() click to toggle source
# File lib/trio/blog/api/post_attributes.rb, line 35
def author_avatar_image_url
  selectors.author_avatar_image_element.attr("data-src") || raise(EmptyAttributeError.new(__method__))
end
author_name() click to toggle source
# File lib/trio/blog/api/post_attributes.rb, line 31
def author_name
  selectors.author_name_element.text || raise(EmptyAttributeError.new(__method__))
end
post_url() click to toggle source
# File lib/trio/blog/api/post_attributes.rb, line 22
def post_url
  post_url = selectors.post_link_element.attr("href") || raise(EmptyAttributeError.new(__method__))
  parsed_post_url = URI.parse(post_url)
  base_url = URI.parse(config.base_url)
  parsed_post_url.host = base_url.host
  parsed_post_url.scheme = base_url.scheme
  parsed_post_url.to_s
end
thumbnail_image_url() click to toggle source
# File lib/trio/blog/api/post_attributes.rb, line 18
def thumbnail_image_url
  selectors.thumbnail_image_element.attr("data-src") || raise(EmptyAttributeError.new(__method__))
end
title() click to toggle source
# File lib/trio/blog/api/post_attributes.rb, line 14
def title
  selectors.title_element.text || raise(EmptyAttributeError.new(__method__))
end