Class: Pexels::Collection
- Inherits:
-
Object
- Object
- Pexels::Collection
- Defined in:
- lib/pexels/collection.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#media_count ⇒ Object
readonly
Returns the value of attribute media_count.
-
#photos_count ⇒ Object
readonly
Returns the value of attribute photos_count.
-
#private ⇒ Object
readonly
Returns the value of attribute private.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#videos_count ⇒ Object
readonly
Returns the value of attribute videos_count.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Collection
constructor
A new instance of Collection.
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
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/pexels/collection.rb', line 3 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/pexels/collection.rb', line 3 def id @id end |
#media_count ⇒ Object (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_count ⇒ Object (readonly)
Returns the value of attribute photos_count.
3 4 5 |
# File 'lib/pexels/collection.rb', line 3 def photos_count @photos_count end |
#private ⇒ Object (readonly)
Returns the value of attribute private.
3 4 5 |
# File 'lib/pexels/collection.rb', line 3 def private @private end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/pexels/collection.rb', line 3 def title @title end |
#videos_count ⇒ Object (readonly)
Returns the value of attribute videos_count.
3 4 5 |
# File 'lib/pexels/collection.rb', line 3 def videos_count @videos_count end |