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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c652a6f1d76042153c58efd8fd07b524b3d63ce
4
- data.tar.gz: b3d852e9892d7a023ccff58fd6576ca94c2b47e9
3
+ metadata.gz: 3ce0e956b6cdf5e7d2841c55574150c8f945b1e2
4
+ data.tar.gz: 578a78b42049953832147b77d50832e07543bafb
5
5
  SHA512:
6
- metadata.gz: 45f24e60c265c7ef1ee019083ca4fb603a172ead298c80fa9e1740c5ea74f22e8c5420165f20d75a635dee774c09b65a5dd041d267a65d21f2247568ef1643cc
7
- data.tar.gz: f38241bb8a23617c3c1b10c23751b9e9111875d3dcf7a36af8d7c790db7e481e582587f1cf08ecc25978a464974b3072765d944ada390f6fee8097796743a46f
6
+ metadata.gz: b142a315a67d03efd2232f5be98789450d080f0144156163a189afd1ba418380e9e9ccf2831228b0e2ed9834a1a934f8bc57fba7b20d6aa0d94d2093e4861cd8
7
+ data.tar.gz: 069e594a8e80dec12212db3e40a155bd0758a294fa9e8bcc8d8b8d241a8d3ccb22e3dfe4a3d6ad82d3f1f18bf155f2cd9972c29465cb84ac826905a61b72ea89
data/CHANGELOG.md CHANGED
@@ -281,3 +281,7 @@
281
281
  ## v0.9.2
282
282
 
283
283
  * Added credit card price to products
284
+
285
+ ## v0.10.0
286
+
287
+ * Refactor on update fields for cost, last cost and price
@@ -2,10 +2,10 @@ module Xsys
2
2
  module Model
3
3
  class Product
4
4
  def self.attr_list
5
- [:id, :name, :cost_updated_at, :sellable, :product_category_id,
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, :last_cost_updated_at, :price_updated_at, :online_stock,
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 = ['cost_updated_at', 'last_cost_updated_at', 'price_updated_at']
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(:price_updated_at)
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
- :total_price, :markup, :price_updated_at]
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 = ['price_updated_at']
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
@@ -1,3 +1,3 @@
1
1
  module Xsys
2
- VERSION = "0.9.2"
2
+ VERSION = "0.10.0"
3
3
  end
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.9.2
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-28 00:00:00.000000000 Z
11
+ date: 2016-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler