Class: Pexels::VideoSet

Inherits:
PaginatedResponse show all
Defined in:
lib/pexels/video_set.rb

Instance Attribute Summary

Attributes inherited from PaginatedResponse

#page, #per_page, #total_results

Instance Method Summary collapse

Methods inherited from PaginatedResponse

#each, #next_page, #prev_page, #total_pages

Constructor Details

#initialize(response) ⇒ VideoSet

Returns a new instance of VideoSet.



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

def initialize(response)
  super
  @data = attrs.fetch('videos', []).map { |attrs| Pexels::Video.new(attrs) }

rescue KeyError => exception
  raise Pexels::MalformedAPIResponseError.new(exception)
end