Class: ButterCMS::Parsers::Posts

Inherits:
Object
  • Object
show all
Defined in:
lib/butter_cms/parsers/posts.rb

Direct Known Subclasses

Post

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Posts

Returns a new instance of Posts.



7
8
9
# File 'lib/butter_cms/parsers/posts.rb', line 7

def initialize(response)
  @response = response
end

Instance Method Details

#countString

Returns the count of existing posts

Returns:

  • (String)


28
29
30
# File 'lib/butter_cms/parsers/posts.rb', line 28

def count
  parsed_json['meta']['count']
end

#next_pageString

Returns the number of the next page or nil if not available

Returns:

  • (String)


14
15
16
# File 'lib/butter_cms/parsers/posts.rb', line 14

def next_page
  parsed_json['meta']['next_page']
end

#postsArray

Returns array of posts attributes available in the response

Returns:

  • (Array)


35
36
37
# File 'lib/butter_cms/parsers/posts.rb', line 35

def posts
  parsed_json['data']
end

#previous_pageString

Returns the number of the previous page or nil if not available

Returns:

  • (String)


21
22
23
# File 'lib/butter_cms/parsers/posts.rb', line 21

def previous_page
  parsed_json['meta']['previous_page']
end