Class: ButterCMS::Parsers::Posts
- Inherits:
-
Object
- Object
- ButterCMS::Parsers::Posts
- Defined in:
- lib/butter_cms/parsers/posts.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#count ⇒ String
Returns the count of existing posts.
-
#initialize(response) ⇒ Posts
constructor
A new instance of Posts.
-
#next_page ⇒ String
Returns the number of the next page or nil if not available.
-
#posts ⇒ Array
Returns array of posts attributes available in the response.
-
#previous_page ⇒ String
Returns the number of the previous page or nil if not available.
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
#count ⇒ String
Returns the count of existing posts
28 29 30 |
# File 'lib/butter_cms/parsers/posts.rb', line 28 def count parsed_json['meta']['count'] end |
#next_page ⇒ String
Returns the number of the next page or nil if not available
14 15 16 |
# File 'lib/butter_cms/parsers/posts.rb', line 14 def next_page parsed_json['meta']['next_page'] end |
#posts ⇒ Array
Returns array of posts attributes available in the response
35 36 37 |
# File 'lib/butter_cms/parsers/posts.rb', line 35 def posts parsed_json['data'] end |
#previous_page ⇒ String
Returns the number of the previous page or nil if not available
21 22 23 |
# File 'lib/butter_cms/parsers/posts.rb', line 21 def previous_page parsed_json['meta']['previous_page'] end |