Class: Svpply::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/svpply/store.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#avatarObject (readonly)

Returns the value of attribute avatar.



3
4
5
# File 'lib/svpply/store.rb', line 3

def avatar
  @avatar
end

#collections_countObject (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_createdObject (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_updatedObject (readonly)

Returns the value of attribute date_updated.



3
4
5
# File 'lib/svpply/store.rb', line 3

def date_updated
  @date_updated
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/svpply/store.rb', line 3

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/svpply/store.rb', line 3

def id
  @id
end

#locations_countObject (readonly)

Returns the value of attribute locations_count.



3
4
5
# File 'lib/svpply/store.rb', line 3

def locations_count
  @locations_count
end

#mastheadObject (readonly)

Returns the value of attribute masthead.



3
4
5
# File 'lib/svpply/store.rb', line 3

def masthead
  @masthead
end

#masthead_heightObject (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_widthObject (readonly)

Returns the value of attribute masthead_width.



3
4
5
# File 'lib/svpply/store.rb', line 3

def masthead_width
  @masthead_width
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/svpply/store.rb', line 3

def name
  @name
end

#products_countObject (readonly)

Returns the value of attribute products_count.



3
4
5
# File 'lib/svpply/store.rb', line 3

def products_count
  @products_count
end

#slugObject (readonly)

Returns the value of attribute slug.



3
4
5
# File 'lib/svpply/store.rb', line 3

def slug
  @slug
end

#svpply_urlObject (readonly)

Returns the value of attribute svpply_url.



3
4
5
# File 'lib/svpply/store.rb', line 3

def svpply_url
  @svpply_url
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/svpply/store.rb', line 3

def url
  @url
end

#users_followers_countObject (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