Class: Dnsimple::PaginatedResponse
- Inherits:
-
CollectionResponse
- Object
- Response
- CollectionResponse
- Dnsimple::PaginatedResponse
- Defined in:
- lib/dnsimple/response.rb
Overview
The PaginatedResponse is a specific type of Response that also exposes pagination metadata.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#page ⇒ Integer
readonly
The current page.
-
#per_page ⇒ Integer
readonly
The number of records per page.
-
#total_entries ⇒ Integer
readonly
The total number of records.
-
#total_pages ⇒ Integer
readonly
The total number of pages.
Attributes inherited from Response
#data, #http_response, #rate_limit, #rate_limit_remaining, #rate_limit_reset
Instance Method Summary collapse
-
#initialize(http_response, collection) ⇒ PaginatedResponse
constructor
Initializes a new paginated response from the response metadata, and with given collection.
Constructor Details
#initialize(http_response, collection) ⇒ PaginatedResponse
Initializes a new paginated response from the response metadata, and with given collection.
68 69 70 71 72 73 74 75 76 |
# File 'lib/dnsimple/response.rb', line 68 def initialize(http_response, collection) super pagination = http_response["pagination"] @page = pagination["current_page"] @per_page = pagination["per_page"] @total_entries = pagination["total_entries"] @total_pages = pagination["total_pages"] end |
Instance Attribute Details
#page ⇒ Integer (readonly)
Returns The current page.
51 52 53 |
# File 'lib/dnsimple/response.rb', line 51 def page @page end |
#per_page ⇒ Integer (readonly)
Returns The number of records per page.
54 55 56 |
# File 'lib/dnsimple/response.rb', line 54 def per_page @per_page end |
#total_entries ⇒ Integer (readonly)
Returns The total number of records.
57 58 59 |
# File 'lib/dnsimple/response.rb', line 57 def total_entries @total_entries end |
#total_pages ⇒ Integer (readonly)
Returns The total number of pages.
60 61 62 |
# File 'lib/dnsimple/response.rb', line 60 def total_pages @total_pages end |