xsys 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/xsys/model/product.rb +7 -4
- data/lib/xsys/model/product_price_list.rb +6 -3
- 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: 3ce0e956b6cdf5e7d2841c55574150c8f945b1e2
|
4
|
+
data.tar.gz: 578a78b42049953832147b77d50832e07543bafb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b142a315a67d03efd2232f5be98789450d080f0144156163a189afd1ba418380e9e9ccf2831228b0e2ed9834a1a934f8bc57fba7b20d6aa0d94d2093e4861cd8
|
7
|
+
data.tar.gz: 069e594a8e80dec12212db3e40a155bd0758a294fa9e8bcc8d8b8d241a8d3ccb22e3dfe4a3d6ad82d3f1f18bf155f2cd9972c29465cb84ac826905a61b72ea89
|
data/CHANGELOG.md
CHANGED
data/lib/xsys/model/product.rb
CHANGED
@@ -2,10 +2,10 @@ module Xsys
|
|
2
2
|
module Model
|
3
3
|
class Product
|
4
4
|
def self.attr_list
|
5
|
-
[:id, :name, :
|
5
|
+
[:id, :name, :sellable, :product_category_id,
|
6
6
|
:product_provider_id, :vat_rate, :taxed_cost, :vat_cost, :total_cost,
|
7
7
|
:pending_ordered_quantity, :stocks, :prices, :category, :provider,
|
8
|
-
:last_total_cost, :
|
8
|
+
:last_total_cost, :last_cost_update_date, :last_cost_update_time, :online_stock,
|
9
9
|
:product_size_code, :weight, :length, :width, :height, :packages_quantity,
|
10
10
|
:ean, :packages, :regular_price, :reduced_price, :credit_card_price, :brand, :model
|
11
11
|
]
|
@@ -14,7 +14,8 @@ module Xsys
|
|
14
14
|
attr_reader *attr_list
|
15
15
|
|
16
16
|
def initialize(attributes={})
|
17
|
-
time_fields = ['
|
17
|
+
time_fields = ['cost_update_time', 'last_cost_update_time', 'price_update_time']
|
18
|
+
date_fields = ['cost_update_date', 'last_cost_update_date', 'price_update_date']
|
18
19
|
decimal_fields = ['vat_rate', 'taxed_cost', 'vat_cost', 'total_cost', 'last_total_cost',
|
19
20
|
'regular_price', 'reduced_price', 'credit_card_price']
|
20
21
|
|
@@ -29,6 +30,8 @@ module Xsys
|
|
29
30
|
@prices = v.map { |s| ProductPriceList.new(s) }
|
30
31
|
elsif time_fields.include?(k.to_s)
|
31
32
|
self.send("#{k}=", Time.parse(v)) unless v.nil?
|
33
|
+
elsif date_fields.include?(k.to_s)
|
34
|
+
self.send("#{k}=", Date.parse(v)) unless v.nil?
|
32
35
|
elsif decimal_fields.include?(k.to_s)
|
33
36
|
self.send("#{k}=", BigDecimal.new(v)) unless v.nil?
|
34
37
|
else
|
@@ -102,7 +105,7 @@ module Xsys
|
|
102
105
|
def price_date_for_list(price_list_id)
|
103
106
|
prices.find { |p|
|
104
107
|
p.price_list_id.to_i == price_list_id.to_i
|
105
|
-
}.try(:
|
108
|
+
}.try(:price_update_date)
|
106
109
|
end
|
107
110
|
|
108
111
|
def markup_with_list(price_list_id)
|
@@ -2,19 +2,22 @@ module Xsys
|
|
2
2
|
module Model
|
3
3
|
class ProductPriceList
|
4
4
|
def self.attr_list
|
5
|
-
[:product_id, :product_name, :price_list_id,
|
6
|
-
:
|
5
|
+
[:product_id, :product_name, :price_list_id, :total_price,
|
6
|
+
:markup, :price_update_date, :price_update_time]
|
7
7
|
end
|
8
8
|
|
9
9
|
attr_reader *attr_list
|
10
10
|
|
11
11
|
def initialize(attributes={})
|
12
|
-
time_fields = ['
|
12
|
+
time_fields = ['price_update_time']
|
13
|
+
date_fields = ['price_update_date']
|
13
14
|
decimal_fields = ['total_price']
|
14
15
|
|
15
16
|
attributes.each do |k, v|
|
16
17
|
if time_fields.include?(k.to_s)
|
17
18
|
self.send("#{k}=", Time.parse(v)) unless v.nil?
|
19
|
+
elsif date_fields.include?(k.to_s)
|
20
|
+
self.send("#{k}=", Date.parse(v)) unless v.nil?
|
18
21
|
elsif decimal_fields.include?(k.to_s)
|
19
22
|
self.send("#{k}=", BigDecimal.new(v)) unless v.nil?
|
20
23
|
else
|
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.10.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: 2016-09-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|