shoppe 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -0
  3. data/app/assets/stylesheets/shoppe/application.scss +15 -4
  4. data/app/controllers/shoppe/application_controller.rb +2 -2
  5. data/app/controllers/shoppe/customers_controller.rb +10 -12
  6. data/app/models/shoppe/address.rb +14 -14
  7. data/app/models/shoppe/attachment.rb +9 -9
  8. data/app/models/shoppe/country.rb +14 -14
  9. data/app/models/shoppe/customer.rb +11 -8
  10. data/app/models/shoppe/delivery_service.rb +10 -10
  11. data/app/models/shoppe/delivery_service_price.rb +15 -15
  12. data/app/models/shoppe/order.rb +12 -9
  13. data/app/models/shoppe/order/actions.rb +15 -15
  14. data/app/models/shoppe/order/billing.rb +10 -10
  15. data/app/models/shoppe/order/delivery.rb +13 -13
  16. data/app/models/shoppe/order/states.rb +20 -20
  17. data/app/models/shoppe/order_item.rb +10 -10
  18. data/app/models/shoppe/payment.rb +7 -7
  19. data/app/models/shoppe/product.rb +24 -24
  20. data/app/models/shoppe/product/product_attributes.rb +5 -5
  21. data/app/models/shoppe/product/variants.rb +3 -3
  22. data/app/models/shoppe/product_attribute.rb +20 -20
  23. data/app/models/shoppe/product_category.rb +6 -6
  24. data/app/models/shoppe/setting.rb +13 -13
  25. data/app/models/shoppe/stock_level_adjustment.rb +5 -5
  26. data/app/models/shoppe/tax_rate.rb +16 -16
  27. data/app/models/shoppe/user.rb +13 -13
  28. data/app/uploaders/shoppe/attachment_uploader.rb +0 -1
  29. data/app/views/shoppe/customers/_addresses.html.haml +5 -5
  30. data/app/views/shoppe/customers/_form.html.haml +17 -10
  31. data/app/views/shoppe/customers/_search_form.html.haml +5 -5
  32. data/app/views/shoppe/customers/edit.html.haml +4 -4
  33. data/app/views/shoppe/customers/index.html.haml +11 -11
  34. data/app/views/shoppe/customers/new.html.haml +3 -3
  35. data/app/views/shoppe/customers/show.html.haml +11 -12
  36. data/app/views/shoppe/product_categories/index.html.haml +3 -2
  37. data/app/views/shoppe/variants/form.html.haml +0 -1
  38. data/config/locales/de.yml +58 -7
  39. data/config/locales/en.yml +38 -4
  40. data/config/locales/es-US.yml +656 -0
  41. data/config/locales/es.yml +372 -281
  42. data/config/locales/ru.yml +781 -0
  43. data/db/seeds.rb +113 -98
  44. data/lib/shoppe.rb +10 -10
  45. data/lib/shoppe/version.rb +1 -1
  46. metadata +22 -6
@@ -4,20 +4,20 @@ module Shoppe
4
4
  # The country which this order should be billed to
5
5
  #
6
6
  # @return [Shoppe::Country]
7
- belongs_to :billing_country, :class_name => 'Shoppe::Country', :foreign_key => 'billing_country_id'
7
+ belongs_to :billing_country, class_name: 'Shoppe::Country', foreign_key: 'billing_country_id'
8
8
 
9
9
  # Payments which have been stored for the order
10
- has_many :payments, :dependent => :destroy, :class_name => 'Shoppe::Payment'
10
+ has_many :payments, dependent: :destroy, class_name: 'Shoppe::Payment'
11
11
 
12
12
  # Validations
13
- with_options :if => Proc.new { |o| !o.building? } do |order|
14
- order.validates :first_name, :presence => true
15
- order.validates :last_name, :presence => true
16
- order.validates :billing_address1, :presence => true
17
- order.validates :billing_address3, :presence => true
18
- order.validates :billing_address4, :presence => true
19
- order.validates :billing_postcode, :presence => true
20
- order.validates :billing_country, :presence => true
13
+ with_options if: Proc.new { |o| !o.building? } do |order|
14
+ order.validates :first_name, presence: true
15
+ order.validates :last_name, presence: true
16
+ order.validates :billing_address1, presence: true
17
+ order.validates :billing_address3, presence: true
18
+ order.validates :billing_address4, presence: true
19
+ order.validates :billing_postcode, presence: true
20
+ order.validates :billing_country, presence: true
21
21
  end
22
22
 
23
23
  # The name for billing purposes
@@ -4,29 +4,29 @@ module Shoppe
4
4
  # The associated delivery service
5
5
  #
6
6
  # @return [Shoppe::DeliveryService]
7
- belongs_to :delivery_service, :class_name => 'Shoppe::DeliveryService'
7
+ belongs_to :delivery_service, class_name: 'Shoppe::DeliveryService'
8
8
 
9
9
  # The country where this order is being delivered to (if one has been provided)
10
10
  #
11
11
  # @return [Shoppe::Country]
12
- belongs_to :delivery_country, :class_name => 'Shoppe::Country', :foreign_key => 'delivery_country_id'
12
+ belongs_to :delivery_country, class_name: 'Shoppe::Country', foreign_key: 'delivery_country_id'
13
13
 
14
14
  # The user who marked the order has shipped
15
15
  #
16
16
  # @return [Shoppe::User]
17
- belongs_to :shipper, :class_name => 'Shoppe::User', :foreign_key => 'shipped_by'
17
+ belongs_to :shipper, class_name: 'Shoppe::User', foreign_key: 'shipped_by'
18
18
 
19
19
  # Set up a callback for use when an order is shipped
20
20
  define_model_callbacks :ship
21
21
 
22
22
  # Validations
23
- with_options :if => :separate_delivery_address? do |order|
24
- order.validates :delivery_name, :presence => true
25
- order.validates :delivery_address1, :presence => true
26
- order.validates :delivery_address3, :presence => true
27
- order.validates :delivery_address4, :presence => true
28
- order.validates :delivery_postcode, :presence => true
29
- order.validates :delivery_country, :presence => true
23
+ with_options if: :separate_delivery_address? do |order|
24
+ order.validates :delivery_name, presence: true
25
+ order.validates :delivery_address1, presence: true
26
+ order.validates :delivery_address3, presence: true
27
+ order.validates :delivery_address4, presence: true
28
+ order.validates :delivery_postcode, presence: true
29
+ order.validates :delivery_country, presence: true
30
30
  end
31
31
 
32
32
  validate do
@@ -43,7 +43,7 @@ module Shoppe
43
43
  # Ensure that before we confirm the order that the delivery service which has been selected
44
44
  # is appropritae for the contents of the order.
45
45
  if self.delivery_required? && !self.valid_delivery_service?
46
- raise Shoppe::Errors::InappropriateDeliveryService, :order => self
46
+ raise Shoppe::Errors::InappropriateDeliveryService, order: self
47
47
  end
48
48
  cache_delivery_pricing
49
49
  end
@@ -137,7 +137,7 @@ module Shoppe
137
137
  # @return [Array] an array of Shoppe:DeliveryServicePrice objects
138
138
  def delivery_service_prices
139
139
  if delivery_required?
140
- prices = Shoppe::DeliveryServicePrice.joins(:delivery_service).where(:shoppe_delivery_services => {:active => true}).order(:price).for_weight(total_weight)
140
+ prices = Shoppe::DeliveryServicePrice.joins(:delivery_service).where(shoppe_delivery_services: {active: true}).order(:price).for_weight(total_weight)
141
141
  prices = prices.select { |p| p.countries.empty? || p.country?(self.delivery_country) }
142
142
  prices.sort{ |x,y| (y.delivery_service.default? ? 1 : 0) <=> (x.delivery_service.default? ? 1 : 0) } # Order by truthiness
143
143
  else
@@ -221,7 +221,7 @@ module Shoppe
221
221
  self.status = 'shipped'
222
222
  self.consignment_number = consignment_number
223
223
  self.save!
224
- Shoppe::OrderMailer.shipped(self).deliver_now
224
+ Shoppe::OrderMailer.shipped(self).deliver
225
225
  end
226
226
  end
227
227
 
@@ -1,69 +1,69 @@
1
1
  module Shoppe
2
2
  class Order < ActiveRecord::Base
3
-
3
+
4
4
  # An array of all the available statuses for an order
5
5
  STATUSES = ['building', 'confirming', 'received', 'accepted', 'rejected', 'shipped']
6
-
6
+
7
7
  # The Shoppe::User who accepted the order
8
8
  #
9
9
  # @return [Shoppe::User]
10
- belongs_to :accepter, :class_name => 'Shoppe::User', :foreign_key => 'accepted_by'
11
-
10
+ belongs_to :accepter, class_name: 'Shoppe::User', foreign_key: 'accepted_by'
11
+
12
12
  # The Shoppe::User who rejected the order
13
13
  #
14
14
  # @return [Shoppe::User]
15
- belongs_to :rejecter, :class_name => 'Shoppe::User', :foreign_key => 'rejected_by'
16
-
15
+ belongs_to :rejecter, class_name: 'Shoppe::User', foreign_key: 'rejected_by'
16
+
17
17
  # Validations
18
- validates :status, :inclusion => {:in => STATUSES}
19
-
18
+ validates :status, inclusion: {in: STATUSES}
19
+
20
20
  # Set the status to building if we don't have a status
21
21
  after_initialize { self.status = STATUSES.first if self.status.blank? }
22
-
22
+
23
23
  # All orders which have been received
24
24
  scope :received, -> {where("received_at is not null")}
25
-
25
+
26
26
  # All orders which are currently pending acceptance/rejection
27
- scope :pending, -> { where(:status => 'received') }
28
-
27
+ scope :pending, -> { where(status: 'received') }
28
+
29
29
  # All ordered ordered by their ID desending
30
- scope :ordered, -> { order(:id => :desc)}
31
-
30
+ scope :ordered, -> { order(id: :desc)}
31
+
32
32
  # Is this order still being built by the user?
33
33
  #
34
34
  # @return [Boolean]
35
35
  def building?
36
36
  self.status == 'building'
37
37
  end
38
-
38
+
39
39
  # Is this order in the user confirmation step?
40
40
  #
41
41
  # @return [Boolean]
42
42
  def confirming?
43
43
  self.status == 'confirming'
44
44
  end
45
-
45
+
46
46
  # Has this order been rejected?
47
47
  #
48
48
  # @return [Boolean]
49
49
  def rejected?
50
50
  !!self.rejected_at
51
51
  end
52
-
52
+
53
53
  # Has this order been accepted?
54
54
  #
55
55
  # @return [Boolean]
56
56
  def accepted?
57
57
  !!self.accepted_at
58
58
  end
59
-
59
+
60
60
  # Has the order been received?
61
61
  #
62
62
  # @return [Boolean]
63
63
  def received?
64
64
  !!self.received_at?
65
65
  end
66
-
67
-
66
+
67
+
68
68
  end
69
69
  end
@@ -6,17 +6,17 @@ module Shoppe
6
6
  # The associated order
7
7
  #
8
8
  # @return [Shoppe::Order]
9
- belongs_to :order, :class_name => 'Shoppe::Order', :touch => true, :inverse_of => :order_items
9
+ belongs_to :order, class_name: 'Shoppe::Order', touch: true, inverse_of: :order_items
10
10
 
11
11
  # The item which has been ordered
12
- belongs_to :ordered_item, :polymorphic => true
12
+ belongs_to :ordered_item, polymorphic: true
13
13
 
14
14
  # Any stock level adjustments which have been made for this order item
15
- has_many :stock_level_adjustments, :as => :parent, :dependent => :nullify, :class_name => 'Shoppe::StockLevelAdjustment'
15
+ has_many :stock_level_adjustments, as: :parent, dependent: :nullify, class_name: 'Shoppe::StockLevelAdjustment'
16
16
 
17
17
  # Validations
18
- validates :quantity, :numericality => true
19
- validates :ordered_item, :presence => true
18
+ validates :quantity, numericality: true
19
+ validates :ordered_item, presence: true
20
20
 
21
21
  validate do
22
22
  unless in_stock?
@@ -46,13 +46,13 @@ module Shoppe
46
46
  # @param quantity [Fixnum] the number of items to order
47
47
  # @return [Shoppe::OrderItem]
48
48
  def self.add_item(ordered_item, quantity = 1)
49
- raise Errors::UnorderableItem, :ordered_item => ordered_item unless ordered_item.orderable?
49
+ raise Errors::UnorderableItem, ordered_item: ordered_item unless ordered_item.orderable?
50
50
  transaction do
51
- if existing = self.where(:ordered_item_id => ordered_item.id, :ordered_item_type => ordered_item.class.to_s).first
51
+ if existing = self.where(ordered_item_id: ordered_item.id, ordered_item_type: ordered_item.class.to_s).first
52
52
  existing.increase!(quantity)
53
53
  existing
54
54
  else
55
- new_item = self.create(:ordered_item => ordered_item, :quantity => 0)
55
+ new_item = self.create(ordered_item: ordered_item, quantity: 0)
56
56
  new_item.increase!(quantity)
57
57
  new_item
58
58
  end
@@ -79,7 +79,7 @@ module Shoppe
79
79
  transaction do
80
80
  self.quantity += amount
81
81
  unless self.in_stock?
82
- raise Shoppe::Errors::NotEnoughStock, :ordered_item => self.ordered_item, :requested_stock => self.quantity
82
+ raise Shoppe::Errors::NotEnoughStock, ordered_item: self.ordered_item, requested_stock: self.quantity
83
83
  end
84
84
  self.save!
85
85
  self.order.remove_delivery_service_if_invalid
@@ -231,7 +231,7 @@ module Shoppe
231
231
  # Allocate any unallocated stock for this order item. There is no return value.
232
232
  def allocate_unallocated_stock!
233
233
  if self.ordered_item.stock_control? && self.unallocated_stock != 0
234
- self.ordered_item.stock_level_adjustments.create!(:parent => self, :adjustment => 0 - self.unallocated_stock, :description => "Order ##{self.order.number}")
234
+ self.ordered_item.stock_level_adjustments.create!(parent: self, adjustment: 0 - self.unallocated_stock, description: "Order ##{self.order.number}")
235
235
  end
236
236
  end
237
237
 
@@ -8,17 +8,17 @@ module Shoppe
8
8
  # The associated order
9
9
  #
10
10
  # @return [Shoppe::Order]
11
- belongs_to :order, :class_name => 'Shoppe::Order'
11
+ belongs_to :order, class_name: 'Shoppe::Order'
12
12
 
13
13
  # An associated payment (only applies to refunds)
14
14
  #
15
15
  # @return [Shoppe::Payment]
16
- belongs_to :parent, :class_name => "Shoppe::Payment", :foreign_key => "parent_payment_id"
16
+ belongs_to :parent, class_name: "Shoppe::Payment", foreign_key: "parent_payment_id"
17
17
 
18
18
  # Validations
19
- validates :amount, :numericality => true
20
- validates :reference, :presence => true
21
- validates :method, :presence => true
19
+ validates :amount, numericality: true
20
+ validates :reference, presence: true
21
+ validates :method, presence: true
22
22
 
23
23
  # Payments can have associated properties
24
24
  key_value_store :properties
@@ -58,12 +58,12 @@ module Shoppe
58
58
  amount = BigDecimal(amount)
59
59
  if refundable_amount >= amount
60
60
  transaction do
61
- self.class.create(:parent => self, :order_id => self.order_id, :amount => 0-amount, :method => self.method, :reference => reference)
61
+ self.class.create(parent: self, order_id: self.order_id, amount: 0-amount, method: self.method, reference: reference)
62
62
  self.update_attribute(:amount_refunded, self.amount_refunded + amount)
63
63
  true
64
64
  end
65
65
  else
66
- raise Shoppe::Errors::RefundFailed, :message => I18n.t('.refund_failed', refundable_amount: refundable_amount)
66
+ raise Shoppe::Errors::RefundFailed, message: I18n.t('.refund_failed', refundable_amount: refundable_amount)
67
67
  end
68
68
  end
69
69
  end
@@ -11,7 +11,7 @@ module Shoppe
11
11
  require_dependency 'shoppe/product/variants'
12
12
 
13
13
  # Attachments for this product
14
- has_many :attachments, :as => :parent, :dependent => :destroy, :autosave => true, :class_name => "Shoppe::Attachment"
14
+ has_many :attachments, as: :parent, dependent: :destroy, autosave: true, class_name: "Shoppe::Attachment"
15
15
 
16
16
  # The product's categorizations
17
17
  #
@@ -25,38 +25,38 @@ module Shoppe
25
25
  # The product's tax rate
26
26
  #
27
27
  # @return [Shoppe::TaxRate]
28
- belongs_to :tax_rate, :class_name => "Shoppe::TaxRate"
28
+ belongs_to :tax_rate, class_name: "Shoppe::TaxRate"
29
29
 
30
30
  # Ordered items which are associated with this product
31
- has_many :order_items, :dependent => :restrict_with_exception, :class_name => 'Shoppe::OrderItem', :as => :ordered_item
31
+ has_many :order_items, dependent: :restrict_with_exception, class_name: 'Shoppe::OrderItem', as: :ordered_item
32
32
 
33
33
  # Orders which have ordered this product
34
- has_many :orders, :through => :order_items, :class_name => 'Shoppe::Order'
34
+ has_many :orders, through: :order_items, class_name: 'Shoppe::Order'
35
35
 
36
36
  # Stock level adjustments for this product
37
- has_many :stock_level_adjustments, :dependent => :destroy, :class_name => 'Shoppe::StockLevelAdjustment', :as => :item
37
+ has_many :stock_level_adjustments, dependent: :destroy, class_name: 'Shoppe::StockLevelAdjustment', as: :item
38
38
 
39
39
  # Validations
40
- with_options :if => Proc.new { |p| p.parent.nil? } do |product|
40
+ with_options if: Proc.new { |p| p.parent.nil? } do |product|
41
41
  product.validate :has_at_least_one_product_category
42
- product.validates :description, :presence => true
43
- product.validates :short_description, :presence => true
42
+ product.validates :description, presence: true
43
+ product.validates :short_description, presence: true
44
44
  end
45
- validates :name, :presence => true
46
- validates :permalink, :presence => true, :uniqueness => true, :permalink => true
47
- validates :sku, :presence => true
48
- validates :weight, :numericality => true
49
- validates :price, :numericality => true
50
- validates :cost_price, :numericality => true, :allow_blank => true
45
+ validates :name, presence: true
46
+ validates :permalink, presence: true, uniqueness: true, permalink: true
47
+ validates :sku, presence: true
48
+ validates :weight, numericality: true
49
+ validates :price, numericality: true
50
+ validates :cost_price, numericality: true, allow_blank: true
51
51
 
52
52
  # Before validation, set the permalink if we don't already have one
53
53
  before_validation { self.permalink = self.name.parameterize if self.permalink.blank? && self.name.is_a?(String) }
54
54
 
55
55
  # All active products
56
- scope :active, -> { where(:active => true) }
56
+ scope :active, -> { where(active: true) }
57
57
 
58
58
  # All featured products
59
- scope :featured, -> {where(:featured => true)}
59
+ scope :featured, -> {where(featured: true)}
60
60
 
61
61
  # Localisations
62
62
  translates :name, :permalink, :description, :short_description
@@ -123,7 +123,7 @@ module Shoppe
123
123
 
124
124
  # Set attachment for the default_image role
125
125
  def default_image_file=(file)
126
- self.attachments.build(:file => file, :role => 'default_image')
126
+ self.attachments.build(file: file, role: 'default_image')
127
127
  end
128
128
 
129
129
  # Return attachment for the data_sheet role
@@ -141,8 +141,8 @@ module Shoppe
141
141
  #
142
142
  # @return [Enumerable]
143
143
  def self.with_attributes(key, values)
144
- product_ids = Shoppe::ProductAttribute.searchable.where(:key => key, :value => values).pluck(:product_id).uniq
145
- where(:id => product_ids)
144
+ product_ids = Shoppe::ProductAttribute.searchable.where(key: key, value: values).pluck(:product_id).uniq
145
+ where(id: product_ids)
146
146
  end
147
147
 
148
148
  # Imports products from a spreadsheet file
@@ -158,10 +158,10 @@ module Shoppe
158
158
 
159
159
  # Don't import products where the name is blank
160
160
  unless row["name"].nil?
161
- if product = find_by(name: row["name"])
162
- # Dont import products with the same name but update quantities if they're not the same
161
+ if product = where(name: row["name"]).take
162
+ # Dont import products with the same name but update quantities
163
163
  qty = row["qty"].to_i
164
- if qty > 0 && qty != product.stock
164
+ if qty > 0
165
165
  product.stock_level_adjustments.create!(description: I18n.t('shoppe.import'), adjustment: qty)
166
166
  end
167
167
  else
@@ -175,8 +175,8 @@ module Shoppe
175
175
  product.permalink = row["permalink"]
176
176
 
177
177
  product.product_categories << begin
178
- if Shoppe::ProductCategory.find_by(name: row["category_name"]).present?
179
- Shoppe::ProductCategory.find_by(name: row["category_name"])
178
+ if Shoppe::ProductCategory.where(name: row["category_name"]).present?
179
+ Shoppe::ProductCategory.where(name: row["category_name"]).take
180
180
  else
181
181
  Shoppe::ProductCategory.create(name: row["category_name"])
182
182
  end
@@ -1,13 +1,13 @@
1
1
  module Shoppe
2
2
  class Product < ActiveRecord::Base
3
-
3
+
4
4
  # Product attributes for this product
5
- has_many :product_attributes, -> { order(:position) }, :class_name => 'Shoppe::ProductAttribute'
6
-
5
+ has_many :product_attributes, -> { order(:position) }, class_name: 'Shoppe::ProductAttribute'
6
+
7
7
  # Used for setting an array of product attributes which will be updated. Usually
8
8
  # received from a web browser.
9
9
  attr_accessor :product_attributes_array
10
-
10
+
11
11
  # After saving automatically try to update the product attributes based on the
12
12
  # the contents of the product_attributes_array array.
13
13
  after_save do
@@ -15,6 +15,6 @@ module Shoppe
15
15
  self.product_attributes.update_from_array(product_attributes_array)
16
16
  end
17
17
  end
18
-
18
+
19
19
  end
20
20
  end
@@ -5,13 +5,13 @@ module Shoppe
5
5
  validate { errors.add :base, :can_belong_to_root if self.parent && self.parent.parent }
6
6
 
7
7
  # Variants of the product
8
- has_many :variants, :class_name => 'Shoppe::Product', :foreign_key => 'parent_id', :dependent => :destroy
8
+ has_many :variants, class_name: 'Shoppe::Product', foreign_key: 'parent_id', dependent: :destroy
9
9
 
10
10
  # The parent product (only applies to variants)
11
- belongs_to :parent, :class_name => 'Shoppe::Product', :foreign_key => 'parent_id'
11
+ belongs_to :parent, class_name: 'Shoppe::Product', foreign_key: 'parent_id'
12
12
 
13
13
  # All products which are not variants
14
- scope :root, -> { where(:parent_id => nil) }
14
+ scope :root, -> { where(parent_id: nil) }
15
15
 
16
16
  # If a variant is created, the base product should be updated so that it doesn't have stock control enabled
17
17
  after_save do
@@ -1,23 +1,23 @@
1
1
  module Shoppe
2
2
  class ProductAttribute < ActiveRecord::Base
3
-
4
- self.table_name = 'shoppe_product_attributes'
5
-
3
+
4
+ self.table_name = 'shoppe_product_attributes'
5
+
6
6
  # Validations
7
- validates :key, :presence => true
8
-
7
+ validates :key, presence: true
8
+
9
9
  # The associated product
10
10
  #
11
11
  # @return [Shoppe::Product]
12
- belongs_to :product, :class_name => 'Shoppe::Product'
13
-
12
+ belongs_to :product, class_name: 'Shoppe::Product'
13
+
14
14
  # All attributes which are searchable
15
- scope :searchable, -> { where(:searchable => true) }
16
-
15
+ scope :searchable, -> { where(searchable: true) }
16
+
17
17
  # All attributes which are public
18
- scope :publicly_accessible, -> { where(:public => true) }
19
-
20
- # Return the the available options as a hash
18
+ scope :publicly_accessible, -> { where(public: true) }
19
+
20
+ # Return the available options as a hash
21
21
  #
22
22
  # @return [Hash]
23
23
  def self.grouped_hash
@@ -26,7 +26,7 @@ module Shoppe
26
26
  h
27
27
  end
28
28
  end
29
-
29
+
30
30
  # Create/update attributes for a product based on the provided hash of
31
31
  # keys & values.
32
32
  #
@@ -38,11 +38,11 @@ module Shoppe
38
38
  next if hash['key'].blank?
39
39
  index += 1
40
40
  params = hash.merge({
41
- :searchable => hash['searchable'].to_s == '1',
42
- :public => hash['public'].to_s == '1',
43
- :position => index
41
+ searchable: hash['searchable'].to_s == '1',
42
+ public: hash['public'].to_s == '1',
43
+ position: index
44
44
  })
45
- if existing_attr = self.where(:key => hash['key']).first
45
+ if existing_attr = self.where(key: hash['key']).first
46
46
  if hash['value'].blank?
47
47
  existing_attr.destroy
48
48
  index -= 1
@@ -53,14 +53,14 @@ module Shoppe
53
53
  attribute = self.create(params)
54
54
  end
55
55
  end
56
- self.where(:key => existing_keys - array.map { |h| h['key']}).delete_all
56
+ self.where(key: existing_keys - array.map { |h| h['key']}).delete_all
57
57
  true
58
58
  end
59
-
59
+
60
60
  def self.public
61
61
  ActiveSupport::Deprecation.warn("The use of Shoppe::ProductAttribute.public is deprecated. use Shoppe::ProductAttribute.publicly_accessible.")
62
62
  self.publicly_accessible
63
63
  end
64
-
64
+
65
65
  end
66
66
  end