Permalink
Browse files

corrected parameter order to allow deployments on heroku

  • Loading branch information...
tonkapark committed Jan 28, 2011
1 parent 1860bbc commit 62a1ed1863e6ce8a995fc6f790122d7e2447b8f5
Showing with 9 additions and 9 deletions.
  1. +8 −8 lib/bigcartel.rb
  2. +1 −1 lib/bigcartel/version.rb
View
@@ -37,12 +37,12 @@ def initialize(id, data={})
@description = data['description']
@website = data['website']
@products_count = data['products_count']
- @pages = data['pages'].map{|p| Page.new(p, data['url'])} unless data['pages'].blank?
+ @pages = data['pages'].map{|p| Page.new(data['url'], p)} unless data['pages'].blank?
@name = data['name']
@url = data['url']
@currency = data['currency']['code']
@country = data['country']['name']
- @categories = data['categories'].map{|cat| Category.new(cat,data['url'])} unless data['categories'].blank?
+ @categories = data['categories'].map{|cat| Category.new(data['url'], cat)} unless data['categories'].blank?
end
def self.find(id)
@@ -62,7 +62,7 @@ def self.fetch(id)
class Artist < Base
attr_reader :name, :url, :id, :permalink
- def initialize(data={}, store_url)
+ def initialize(store_url, data={})
@name = data['name']
@url = "#{store_url}#{data['url']}"
@id = data['id']
@@ -91,7 +91,7 @@ def initialize(data={})
class Page < Base
attr_reader :name, :permalink, :url
- def initialize(data={}, store_url)
+ def initialize(store_url, data={})
@name = data['name']
@permalink = data['permalink']
@url = "#{store_url}/#{data['permalink']}"
@@ -100,13 +100,13 @@ def initialize(data={}, store_url)
class Product < Base
attr_reader :name, :permalink, :url, :description, :artists, :on_sale, :status, :categories, :price, :position, :url, :id, :tax, :images, :shipping
- def initialize(data={}, store_url)
+ def initialize(store_url, data={})
@name = data['name']
@description = data['description']
- @artists = data['artists'].map{|cat| Artist.new(cat,data['url'])} unless data['artists'].blank?
+ @artists = data['artists'].map{|cat| Artist.new(data['url'], cat)} unless data['artists'].blank?
@on_sale= data['on_sale']
@status = data['status']
- @categories = data['categories'].map{|cat| Category.new(cat,data['url'])} unless data['categories'].blank?
+ @categories = data['categories'].map{|cat| Category.new(data['url'], cat)} unless data['categories'].blank?
@price = data['price']
@position = data['position']
@url = "#{store_url}#{data['url']}"
@@ -122,7 +122,7 @@ def img
end
def self.all(id, store_url)
- self.fetch(id).map{|p| Product.new(p, store_url)}
+ self.fetch(id).map{|p| Product.new(store_url, p)}
end
protected
View
@@ -1,3 +1,3 @@
module BigCartel
- VERSION = "0.1.4"
+ VERSION = "0.1.5"
end

0 comments on commit 62a1ed1

Please sign in to comment.