Class: Pexels::PhotoSet
- Inherits:
-
PaginatedResponse
- Object
- PaginatedResponse
- Pexels::PhotoSet
- Defined in:
- lib/pexels/photo_set.rb
Instance Attribute Summary
Attributes inherited from PaginatedResponse
#page, #per_page, #total_results
Instance Method Summary collapse
-
#initialize(response) ⇒ PhotoSet
constructor
A new instance of PhotoSet.
Methods inherited from PaginatedResponse
#each, #next_page, #prev_page, #total_pages
Constructor Details
#initialize(response) ⇒ PhotoSet
Returns a new instance of PhotoSet.
6 7 8 9 10 11 12 |
# File 'lib/pexels/photo_set.rb', line 6 def initialize(response) super @data = attrs.fetch('photos', []).map { |attrs| Pexels::Photo.new(attrs) } rescue KeyError => exception raise Pexels::MalformedAPIResponseError.new(exception) end |