Method: Dnsimple::PaginatedResponse#initialize

Defined in:
lib/dnsimple/response.rb

#initialize(http_response, collection) ⇒ PaginatedResponse

Initializes a new paginated response from the response metadata, and with given collection.

Parameters:

  • http_response (Hash)

    the HTTP response

  • collection (Array)

    the enumerable collection of records returned in the response data



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