Class: Svpply::Collection
- Inherits:
-
Object
- Object
- Svpply::Collection
- Defined in:
- lib/svpply/collection.rb
Instance Attribute Summary collapse
-
#creator ⇒ Object
readonly
Returns the value of attribute creator.
-
#date_created ⇒ Object
readonly
Returns the value of attribute date_created.
-
#date_updated ⇒ Object
readonly
Returns the value of attribute date_updated.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_private ⇒ Object
readonly
Returns the value of attribute is_private.
-
#is_wishlist ⇒ Object
readonly
Returns the value of attribute is_wishlist.
-
#masthead ⇒ Object
readonly
Returns the value of attribute masthead.
-
#masthead_height ⇒ Object
readonly
Returns the value of attribute masthead_height.
-
#masthead_width ⇒ Object
readonly
Returns the value of attribute masthead_width.
-
#preview_image ⇒ Object
readonly
Returns the value of attribute preview_image.
-
#preview_type ⇒ Object
readonly
Returns the value of attribute preview_type.
-
#products_count ⇒ Object
readonly
Returns the value of attribute products_count.
-
#representative_item_height ⇒ Object
readonly
Returns the value of attribute representative_item_height.
-
#representative_item_id ⇒ Object
readonly
Returns the value of attribute representative_item_id.
-
#representative_item_width ⇒ Object
readonly
Returns the value of attribute representative_item_width.
-
#svpply_url ⇒ Object
readonly
Returns the value of attribute svpply_url.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(hash) ⇒ Collection
Returns a new instance of Collection.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/svpply/collection.rb', line 15 def initialize(hash) @id = hash["id"] @title = hash["title"] @masthead = hash["masthead"] @masthead_height = hash["masthead_height"] @masthead_width = hash["masthead_width"] @preview_type = hash["preview_type"] @preview_image = hash["preview_image"] @representative_item_id = hash["representative_item_id"] @representative_item_height = hash["representative_item_height"] @representative_item_width = hash["representative_item_width"] @products_count = hash["products_count"] @is_private = hash["is_private"] @is_wishlist = hash["is_wishlist"] @date_created = hash["date_created"] @date_updated = hash["date_updated"] @creator = hash["creator"] @creator["portrait"] = @creator["avatar"].gsub("avatars", "portraits") @svpply_url = "https://svpply.com/collections/#{@id}" end |
Instance Attribute Details
#creator ⇒ Object (readonly)
Returns the value of attribute creator.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def creator @creator end |
#date_created ⇒ Object (readonly)
Returns the value of attribute date_created.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def date_created @date_created end |
#date_updated ⇒ Object (readonly)
Returns the value of attribute date_updated.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def date_updated @date_updated end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def id @id end |
#is_private ⇒ Object (readonly)
Returns the value of attribute is_private.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def is_private @is_private end |
#is_wishlist ⇒ Object (readonly)
Returns the value of attribute is_wishlist.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def is_wishlist @is_wishlist end |
#masthead ⇒ Object (readonly)
Returns the value of attribute masthead.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def masthead @masthead end |
#masthead_height ⇒ Object (readonly)
Returns the value of attribute masthead_height.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def masthead_height @masthead_height end |
#masthead_width ⇒ Object (readonly)
Returns the value of attribute masthead_width.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def masthead_width @masthead_width end |
#preview_image ⇒ Object (readonly)
Returns the value of attribute preview_image.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def preview_image @preview_image end |
#preview_type ⇒ Object (readonly)
Returns the value of attribute preview_type.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def preview_type @preview_type end |
#products_count ⇒ Object (readonly)
Returns the value of attribute products_count.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def products_count @products_count end |
#representative_item_height ⇒ Object (readonly)
Returns the value of attribute representative_item_height.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def representative_item_height @representative_item_height end |
#representative_item_id ⇒ Object (readonly)
Returns the value of attribute representative_item_id.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def representative_item_id @representative_item_id end |
#representative_item_width ⇒ Object (readonly)
Returns the value of attribute representative_item_width.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def representative_item_width @representative_item_width end |
#svpply_url ⇒ Object (readonly)
Returns the value of attribute svpply_url.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def svpply_url @svpply_url end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/svpply/collection.rb', line 3 def title @title end |
Class Method Details
.find(id) ⇒ Object
7 8 9 |
# File 'lib/svpply/collection.rb', line 7 def self.find(id) new(Client.get_response("/collections/#{id}.json")["collection"]) end |
.products(id, attrs = nil) ⇒ Object
11 12 13 |
# File 'lib/svpply/collection.rb', line 11 def self.products(id, attrs=nil) ProductCollection.new(Client.get_response("/collections/#{id}/products.json", attrs)).products end |