Class: Trio::Blog::API::PostReader

Inherits:
DocumentReader show all
Defined in:
lib/trio/blog/api/post_reader.rb

Instance Attribute Summary

Attributes inherited from DocumentReader

#config, #document

Instance Method Summary collapse

Methods inherited from DocumentReader

#initialize

Constructor Details

This class inherits a constructor from Trio::Blog::API::DocumentReader

Instance Method Details

#attributesObject



9
10
11
# File 'lib/trio/blog/api/post_reader.rb', line 9

def attributes
  @attributes ||= PostAttributes.new(selectors, document, config)
end

#selectorsObject



5
6
7
# File 'lib/trio/blog/api/post_reader.rb', line 5

def selectors
  @selectors ||= PostSelectors.new(document, config)
end

#to_hObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/trio/blog/api/post_reader.rb', line 13

def to_h
  {
      title: attributes.title,
      thumbnail_image_url: attributes.thumbnail_image_url,
      post_url: attributes.post_url,
      author: {
          name: attributes.author_name,
          avatar_image_url: attributes.author_avatar_image_url
      }
  }
end