caboose-store 0.0.28 → 0.0.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2UyMWY2YjFlZjE2MDhlNTI5MjhkYTI3MTZhMjM2ZmQ1MjI3NmVmYw==
4
+ MTExODk3Njk5MjRkYWYxYWRmODgxZWM3OTUyNDM0OWY5NGI1YzI0Zg==
5
5
  data.tar.gz: !binary |-
6
- MzdkNzZlNDA2MzMxMjFkMWIzMTRmZDIzNDM0ODc3NjIyZjA2ZWIzMA==
6
+ MDhkMTUzN2QyZDk4MzQwOWVkYWIxZTk5NTU1MmZhN2M3NmVhYzY2MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDM4MzY5OTMzNWU0YmNmY2I1MjgzYjM4ZTZjZTUxMzRlZmIzOWFiYmZmNjgz
10
- MGIxYjE5Y2RkYmFhMzFlOWE5YzFmMjUyY2Y4YmRlNDFhZjYzYjQyYmQ3Nzgw
11
- ODI2OGU0ODdlNzgxMjY5OGNhYTc3NzU5MWFhOWY4ZGQxMjI0ZDA=
9
+ NWMzYzM3NzRlNDYxYjM5YzQ3YTg5YTgxMmQzZTM5NzdkNDU4NjFlYTMwMjlh
10
+ NzE2NDIzYzBiZDY0N2I1MGMxOTc4YTc1OTU3ZmI5OWZiZmQ4ZjdkOWEyODli
11
+ NmQwNTY0MzgyMTgyOTRjZTE4NzI3YTY2ZTI0NmRlYmRhMWZmZjg=
12
12
  data.tar.gz: !binary |-
13
- MjZhYWY5YmVjMzcyNWY2YThlMTY2NzFjZTNkODI3NTcxN2E4NDZhNzIyYzcz
14
- NTk1NjFjOTY0Yjc0MDM4ZDYxYjg3ODljY2I3YjQ1MjhiNWJjOTBiYzI5ZTQ1
15
- NDg1Y2M4ZDU1OWFkN2FlYzI0NzgwMDUzM2RjZjJjNjhiM2I0MGQ=
13
+ N2EyZTM3N2E4ODEyYzNlMTdhOWJkNDllN2I3YzdmZmJiYTA1Y2VlOTVjMjc0
14
+ ZGUwMjBjNmRmNTk4ZTlkY2U2NzU3MzQ4NDU4YjVhZTVhZDczMDFkN2M2ZGMy
15
+ ODA4OGQzYWVkMmJhNGQyMTU1NGIxNmM3MjIxNDQzYTljZmE5ZmM=
@@ -233,7 +233,7 @@ Caboose.Store.Modules.Product = (function() {
233
233
 
234
234
  self.getInitialVariant = function () {
235
235
  var variant = _.find(self.product.variants, function(variant) {
236
- return variant.quantity > 0;
236
+ return variant.quantity_in_stock > 0;
237
237
  });
238
238
 
239
239
  if (!variant) {
@@ -252,7 +252,7 @@ Caboose.Store.Modules.Product = (function() {
252
252
  }));
253
253
 
254
254
  var variants = _.sortBy(_.where(self.product.variants, attributes), function(variant) { return variant.price });
255
- return _.find(variants, function(variant) { return variant.quantity > 0 });
255
+ return _.find(variants, function(variant) { return variant.quantity_in_stock > 0 });
256
256
  };
257
257
 
258
258
  self.setOptionsFromVariant = function(variant) {
@@ -96,8 +96,8 @@ module CabooseStore
96
96
  v.barcode = value
97
97
  when 'price'
98
98
  v.price = value
99
- when 'quantity'
100
- v.quantity = value
99
+ when 'quantity_in_stock'
100
+ v.quantity_in_stock = value
101
101
  when 'ignore_quantity'
102
102
  v.ignore_quantity = value
103
103
  when 'allow_backorder'
@@ -39,7 +39,7 @@ module CabooseStore
39
39
 
40
40
  validate :quantity_in_stock
41
41
  def quantity_in_stock
42
- errors.add(:base, "There #{self.variant.quantity > 1 ? 'are' : 'is'} only #{self.variant.quantity} left in stock.") if self.variant.quantity - self.quantity < 0
42
+ errors.add(:base, "There #{self.variant.quantity_in_stock > 1 ? 'are' : 'is'} only #{self.variant.quantity_in_stock} left in stock.") if self.variant.quantity_in_stock - self.quantity < 0
43
43
  end
44
44
 
45
45
  #
@@ -103,7 +103,7 @@ module CabooseStore
103
103
  return false if self.decremented
104
104
 
105
105
  self.line_items.each do |line_item|
106
- line_item.variant.update_attribute(:quantit, line_item.variant.quantity - line_item.quantity)
106
+ line_item.variant.update_attribute(:quantity, line_item.variant.quantity_in_stock - line_item.quantity)
107
107
  end
108
108
 
109
109
  self.update_attribute(:decremented, true)
@@ -113,7 +113,7 @@ module CabooseStore
113
113
  return false if !self.decremented
114
114
 
115
115
  self.line_items.each do |line_item|
116
- line_item.variant.update_attribute(:quantity, line_item.variant.quantity - line_item.quantity)
116
+ line_item.variant.update_attribute(:quantity, line_item.variant.quantity_in_stock - line_item.quantity)
117
117
  end
118
118
 
119
119
  self.update_attribute(:decremented, false)
@@ -1,3 +1,3 @@
1
1
  module CabooseStore
2
- VERSION = '0.0.28'
2
+ VERSION = '0.0.29'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry