Class: Pexels::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/pexels/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Collection

Returns a new instance of Collection.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pexels/collection.rb', line 12

def initialize(attrs)
  @id = attrs.fetch('id')
  @title = attrs.fetch('title')
  @description = attrs.fetch('description')
  @private = attrs.fetch('private')
  @media_count = attrs.fetch('media_count')
  @photos_count = attrs.fetch('photos_count')
  @videos_count = attrs.fetch('videos_count')

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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/pexels/collection.rb', line 3

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/pexels/collection.rb', line 3

def id
  @id
end

#media_countObject (readonly)

Returns the value of attribute media_count.



3
4
5
# File 'lib/pexels/collection.rb', line 3

def media_count
  @media_count
end

#photos_countObject (readonly)

Returns the value of attribute photos_count.



3
4
5
# File 'lib/pexels/collection.rb', line 3

def photos_count
  @photos_count
end

#privateObject (readonly)

Returns the value of attribute private.



3
4
5
# File 'lib/pexels/collection.rb', line 3

def private
  @private
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/pexels/collection.rb', line 3

def title
  @title
end

#videos_countObject (readonly)

Returns the value of attribute videos_count.



3
4
5
# File 'lib/pexels/collection.rb', line 3

def videos_count
  @videos_count
end