Class: Svpply::Store
- Inherits:
-
Object
- Object
- Svpply::Store
- Defined in:
- lib/svpply/store.rb
Instance Attribute Summary collapse
-
#avatar ⇒ Object
readonly
Returns the value of attribute avatar.
-
#collections_count ⇒ Object
readonly
Returns the value of attribute collections_count.
-
#date_created ⇒ Object
readonly
Returns the value of attribute date_created.
-
#date_updated ⇒ Object
readonly
Returns the value of attribute date_updated.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#locations_count ⇒ Object
readonly
Returns the value of attribute locations_count.
-
#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.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#products_count ⇒ Object
readonly
Returns the value of attribute products_count.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#svpply_url ⇒ Object
readonly
Returns the value of attribute svpply_url.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#users_followers_count ⇒ Object
readonly
Returns the value of attribute users_followers_count.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Store
constructor
A new instance of Store.
Constructor Details
#initialize(hash) ⇒ Store
Returns a new instance of Store.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/svpply/store.rb', line 16 def initialize(hash) @id = hash["id"] @name = hash["name"] @slug = hash["slug"] @avatar = hash["avatar"] @description = hash["description"] @products_count = hash["products_count"] @collections_count = hash["collections_count"] @users_followers_count = hash["users_followers_count"] @locations_count = hash["locations_count"] @masthead = hash["masthead"] @masthead_height = hash["masthead_height"] @masthead_width = hash["masthead_width"] @date_created = hash["date_created"] @date_updated = hash["date_updated"] @svpply_url = "https://svpply.com/#{@slug}" end |
Instance Attribute Details
#avatar ⇒ Object (readonly)
Returns the value of attribute avatar.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def avatar @avatar end |
#collections_count ⇒ Object (readonly)
Returns the value of attribute collections_count.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def collections_count @collections_count end |
#date_created ⇒ Object (readonly)
Returns the value of attribute date_created.
3 4 5 |
# File 'lib/svpply/store.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/store.rb', line 3 def date_updated @date_updated end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def id @id end |
#locations_count ⇒ Object (readonly)
Returns the value of attribute locations_count.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def locations_count @locations_count end |
#masthead ⇒ Object (readonly)
Returns the value of attribute masthead.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def masthead @masthead end |
#masthead_height ⇒ Object (readonly)
Returns the value of attribute masthead_height.
3 4 5 |
# File 'lib/svpply/store.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/store.rb', line 3 def masthead_width @masthead_width end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def name @name end |
#products_count ⇒ Object (readonly)
Returns the value of attribute products_count.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def products_count @products_count end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def slug @slug end |
#svpply_url ⇒ Object (readonly)
Returns the value of attribute svpply_url.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def svpply_url @svpply_url end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def url @url end |
#users_followers_count ⇒ Object (readonly)
Returns the value of attribute users_followers_count.
3 4 5 |
# File 'lib/svpply/store.rb', line 3 def users_followers_count @users_followers_count end |
Class Method Details
.find(id) ⇒ Object
8 9 10 |
# File 'lib/svpply/store.rb', line 8 def self.find(id) new(Client.get_response("/stores/#{id}.json")["store"]) end |
.products(id, attrs = nil) ⇒ Object
12 13 14 |
# File 'lib/svpply/store.rb', line 12 def self.products(id, attrs=nil) ProductCollection.new(Client.get_response("/stores/#{id}/products.json", attrs)).products end |