xsys 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/xsys/model/product.rb +8 -2
- data/lib/xsys/model/product_price_list.rb +7 -2
- data/lib/xsys/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 018ce2777fcf2bb69ed9892c1302e3a46413b125
|
4
|
+
data.tar.gz: e70a51e7c55e951164957c0217052510a6fe8428
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9930cb166e252bd41eddb36f567b5e3894ef89abfc5aa4ec54b54bd80066eadbdf9a9c0d1cc4bcf722d4d478d00d1090a4b0e4f70f68bebe180b9b900b18161d
|
7
|
+
data.tar.gz: 4e70c12334374bec3cf79683f499529f6c79a3e79051ff9e5930fdf71f0644f6824ac52dd97926cbbd959bf8776e832b6947112568dc5796de79739035dc0200
|
data/CHANGELOG.md
CHANGED
data/lib/xsys/model/product.rb
CHANGED
@@ -11,6 +11,10 @@ module Xsys
|
|
11
11
|
attr_reader *attr_list
|
12
12
|
|
13
13
|
def initialize(attributes={})
|
14
|
+
time_fields = ['cost_updated_at', 'last_cost_updated_at', 'price_updated_at']
|
15
|
+
decimal_fields = ['vat_rate', 'taxed_cost', 'vat_cost', 'total_cost'
|
16
|
+
'last_total_cost']
|
17
|
+
|
14
18
|
attributes.each do |k, v|
|
15
19
|
if k.to_s == 'category'
|
16
20
|
@category = ProductCategory.new(v) unless v.nil?
|
@@ -20,8 +24,10 @@ module Xsys
|
|
20
24
|
@stocks = v.map { |s| Stock.new(s) } unless v.nil?
|
21
25
|
elsif k.to_s == 'prices'
|
22
26
|
@prices = v.map { |s| ProductPriceList.new(s) }
|
23
|
-
elsif
|
24
|
-
self.send("#{k}=", Time.parse(v))
|
27
|
+
elsif time_fields.include?(k.to_s)
|
28
|
+
self.send("#{k}=", Time.parse(v)) unless v.nil?
|
29
|
+
elsif decimal_fields.include?(k.to_s)
|
30
|
+
self.send("#{k}=", BigDecimal.new(v)) unless v.nil?
|
25
31
|
else
|
26
32
|
self.send("#{k}=", v) if self.respond_to?(k)
|
27
33
|
end
|
@@ -9,9 +9,14 @@ module Xsys
|
|
9
9
|
attr_reader *attr_list
|
10
10
|
|
11
11
|
def initialize(attributes={})
|
12
|
+
time_fields = ['price_updated_at']
|
13
|
+
decimal_fields = ['total_price']
|
14
|
+
|
12
15
|
attributes.each do |k, v|
|
13
|
-
if k.to_s
|
14
|
-
|
16
|
+
if time_fields.include?(k.to_s)
|
17
|
+
self.send("#{k}=", Time.parse(v)) unless v.nil?
|
18
|
+
elsif decimal_fields.include?(k.to_s)
|
19
|
+
self.send("#{k}=", BigDecimal.new(v)) unless v.nil?
|
15
20
|
else
|
16
21
|
self.send("#{k}=", v) if self.respond_to?(k)
|
17
22
|
end
|
data/lib/xsys/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xsys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matias Hick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|