bigcartel 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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(p, data['url'])} unless data['pages'].blank?
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(cat,data['url'])} unless data['categories'].blank?
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={}, store_url)
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={}, store_url)
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={}, store_url)
103
+ def initialize(store_url, data={})
104
104
  @name = data['name']
105
105
  @description = data['description']
106
- @artists = data['artists'].map{|cat| Artist.new(cat,data['url'])} unless data['artists'].blank?
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(cat,data['url'])} unless data['categories'].blank?
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(p, store_url)}
125
+ self.fetch(id).map{|p| Product.new(store_url, p)}
126
126
  end
127
127
 
128
128
  protected
@@ -1,3 +1,3 @@
1
1
  module BigCartel
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Anderson