Class: PixivApi::ArrayResponse

Inherits:
Array
  • Object
show all
Defined in:
lib/pixiv_api/array_response.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ArrayResponse

Returns a new instance of ArrayResponse.



14
15
16
17
# File 'lib/pixiv_api/array_response.rb', line 14

def initialize(response)
  super()
  @response = response
end

Class Method Details

.from_response(response, klass, array) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/pixiv_api/array_response.rb', line 6

def self.from_response(response, klass, array)
  new(response).tap do |array_response|
    array.each do |attributes|
      array_response << klass.from_response(response, attributes)
    end
  end
end

Instance Method Details

#paginationObject



19
20
21
# File 'lib/pixiv_api/array_response.rb', line 19

def pagination
  @pagination ||= Response::Pagination.new(@response, @response.parsed['pagination'])
end