Class: BreweryDB::Response
- Inherits:
-
Object
- Object
- BreweryDB::Response
- Defined in:
- lib/brewery_db/response.rb
Instance Method Summary collapse
- #collection ⇒ Object
- #count ⇒ Object
- #data ⇒ Object
-
#initialize(body, request) ⇒ Response
constructor
A new instance of Response.
- #next_page ⇒ Object
- #page_count ⇒ Object
- #page_number ⇒ Object
- #paginated_collection ⇒ Object
Constructor Details
#initialize(body, request) ⇒ Response
Returns a new instance of Response.
3 4 5 6 |
# File 'lib/brewery_db/response.rb', line 3 def initialize(body, request) @body = body @request = request end |
Instance Method Details
#collection ⇒ Object
12 13 14 |
# File 'lib/brewery_db/response.rb', line 12 def collection Collection.new(self) end |
#count ⇒ Object
32 33 34 |
# File 'lib/brewery_db/response.rb', line 32 def count @body.total_results end |
#data ⇒ Object
8 9 10 |
# File 'lib/brewery_db/response.rb', line 8 def data @body.data end |
#next_page ⇒ Object
20 21 22 |
# File 'lib/brewery_db/response.rb', line 20 def next_page @request.next_page.response end |
#page_count ⇒ Object
28 29 30 |
# File 'lib/brewery_db/response.rb', line 28 def page_count @body.number_of_pages end |
#page_number ⇒ Object
24 25 26 |
# File 'lib/brewery_db/response.rb', line 24 def page_number @body.current_page end |
#paginated_collection ⇒ Object
16 17 18 |
# File 'lib/brewery_db/response.rb', line 16 def paginated_collection PaginatedCollection.new(self) end |