Method: Bitly::API::PaginatedList#initialize

Defined in:
lib/bitly/api/paginated_list.rb

#initialize(response:, client:) ⇒ PaginatedList

Returns a new instance of PaginatedList.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bitly/api/paginated_list.rb', line 10

def initialize(response: , client:)
  @client = client
  super(items: items_from_response(response: response), response: response)
  if response.body["pagination"]
    pagination = response.body["pagination"]
    @next_url = pagination["next"]
    @prev_url = pagination["prev"]
    @size = pagination["size"]
    @page = pagination["page"]
    @total = pagination["total"]
  end
end