bigcartel 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/bigcartel.rb +8 -8
- data/lib/bigcartel/version.rb +1 -1
- metadata +2 -2
data/lib/bigcartel.rb
CHANGED
@@ -37,12 +37,12 @@ module BigCartel
|
|
37
37
|
@description = data['description']
|
38
38
|
@website = data['website']
|
39
39
|
@products_count = data['products_count']
|
40
|
-
@pages = data['pages'].map{|p| Page.new(
|
40
|
+
@pages = data['pages'].map{|p| Page.new(data['url'], p)} unless data['pages'].blank?
|
41
41
|
@name = data['name']
|
42
42
|
@url = data['url']
|
43
43
|
@currency = data['currency']['code']
|
44
44
|
@country = data['country']['name']
|
45
|
-
@categories = data['categories'].map{|cat| Category.new(
|
45
|
+
@categories = data['categories'].map{|cat| Category.new(data['url'], cat)} unless data['categories'].blank?
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.find(id)
|
@@ -62,7 +62,7 @@ module BigCartel
|
|
62
62
|
|
63
63
|
class Artist < Base
|
64
64
|
attr_reader :name, :url, :id, :permalink
|
65
|
-
def initialize(data={}
|
65
|
+
def initialize(store_url, data={})
|
66
66
|
@name = data['name']
|
67
67
|
@url = "#{store_url}#{data['url']}"
|
68
68
|
@id = data['id']
|
@@ -91,7 +91,7 @@ module BigCartel
|
|
91
91
|
|
92
92
|
class Page < Base
|
93
93
|
attr_reader :name, :permalink, :url
|
94
|
-
def initialize(data={}
|
94
|
+
def initialize(store_url, data={})
|
95
95
|
@name = data['name']
|
96
96
|
@permalink = data['permalink']
|
97
97
|
@url = "#{store_url}/#{data['permalink']}"
|
@@ -100,13 +100,13 @@ module BigCartel
|
|
100
100
|
|
101
101
|
class Product < Base
|
102
102
|
attr_reader :name, :permalink, :url, :description, :artists, :on_sale, :status, :categories, :price, :position, :url, :id, :tax, :images, :shipping
|
103
|
-
def initialize(data={}
|
103
|
+
def initialize(store_url, data={})
|
104
104
|
@name = data['name']
|
105
105
|
@description = data['description']
|
106
|
-
@artists = data['artists'].map{|cat| Artist.new(
|
106
|
+
@artists = data['artists'].map{|cat| Artist.new(data['url'], cat)} unless data['artists'].blank?
|
107
107
|
@on_sale= data['on_sale']
|
108
108
|
@status = data['status']
|
109
|
-
@categories = data['categories'].map{|cat| Category.new(
|
109
|
+
@categories = data['categories'].map{|cat| Category.new(data['url'], cat)} unless data['categories'].blank?
|
110
110
|
@price = data['price']
|
111
111
|
@position = data['position']
|
112
112
|
@url = "#{store_url}#{data['url']}"
|
@@ -122,7 +122,7 @@ module BigCartel
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def self.all(id, store_url)
|
125
|
-
self.fetch(id).map{|p| Product.new(
|
125
|
+
self.fetch(id).map{|p| Product.new(store_url, p)}
|
126
126
|
end
|
127
127
|
|
128
128
|
protected
|
data/lib/bigcartel/version.rb
CHANGED