xsys 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de700cd5b7582ce6d88f75f60ece494a717727b6
4
- data.tar.gz: 4aa131ccbdd93d0af29d1d9963f0c2b927c178cb
3
+ metadata.gz: f2dfadf5516889a9ca9fea1c19abf14beb36a249
4
+ data.tar.gz: f305b2b0d51d45db8db6a742223d256ab6909b85
5
5
  SHA512:
6
- metadata.gz: 3dc20d1b6079c87934fa78c2cf50fb31717ab0061e05d08564920e8b1b3a95561c0ac0d659ca8cf330dc7d286549ddc56b6e7fc66c081060671545d83b61ab9b
7
- data.tar.gz: f9d8bf6ac21e4390b2de03b4808355f6a22e0fe67eed7ae44938b96a067a39dd80d022cc6912e74b303e609f8fc3ef2a1ab9861369cb478d1b89a8d2a69cdf28
6
+ metadata.gz: 16bcba0ba875983647e000b64e3cd100e74a67d3e21359bb15ed766361463f13d44639c0c8e721fdb4f9c02fd5861a6e1a2b0cd5b45dc3166c61078f450b8ec9
7
+ data.tar.gz: 1ce7acd751a1d754912f22b84d035c1c15eec176d3502e9b0099521c73f0779a46fef96968f8402d5c246ccd6b5e429a69c0cc8c48cbbe5977493ab6cb8ad13d
data/CHANGELOG.md CHANGED
@@ -197,3 +197,7 @@
197
197
  ## v0.4.1
198
198
 
199
199
  * Bugfix syntax error on products
200
+
201
+ ## v0.5.0
202
+
203
+ * Added sales search
@@ -0,0 +1,34 @@
1
+ module Xsys
2
+ module Model
3
+ class Sale
4
+ def self.attr_list
5
+ [:code, :transaction_number, :shop_code, :transaction_kind_code, :transaction_status_id,
6
+ :customer_code, :receipt_number, :receipt_date, :total_amount, :seller_code, :observations,
7
+ :user_login, :sale_order_code, :receiver_name, :cuit, :items]
8
+ end
9
+
10
+ attr_reader *attr_list
11
+
12
+ def initialize(attributes={})
13
+ time_fields = ['receipt_date']
14
+ decimal_fields = ['total_amount']
15
+
16
+ attributes.each do |k, v|
17
+ if k.to_s == 'items'
18
+ self.items = v.map { |s| SaleItem.new(s) }
19
+ elsif time_fields.include?(k.to_s)
20
+ self.send("#{k}=", Date.parse(v)) unless v.nil?
21
+ elsif decimal_fields.include?(k.to_s)
22
+ self.send("#{k}=", BigDecimal.new(v)) unless v.nil?
23
+ else
24
+ self.send("#{k}=", v) if self.respond_to?(k)
25
+ end
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ attr_writer *attr_list
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ module Xsys
2
+ module Model
3
+ class SaleItem
4
+ def self.attr_list
5
+ [:sale_code, :position, :transaction_number, :shop_code, :product_id, :quantity,
6
+ :taxed_unit_price, :vat_unit_price, :total_unit_price, :taxed_amount, :vat_amount,
7
+ :total_amount, :vat_rate]
8
+
9
+ attr_reader *attr_list
10
+
11
+ def initialize(attributes={})
12
+ decimal_fields = ['taxed_unit_price', 'vat_unit_price', 'total_unit_price',
13
+ 'taxed_amount', 'vat_amount', 'total_amount', 'vat_rate']
14
+
15
+ attributes.each do |k, v|
16
+ if decimal_fields.include?(k.to_s)
17
+ self.send("#{k}=", BigDecimal.new(v)) unless v.nil?
18
+ else
19
+ self.send("#{k}=", v) if self.respond_to?(k)
20
+ end
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ attr_writer *attr_list
27
+ end
28
+ end
29
+ end
data/lib/xsys/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xsys
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.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.4.1
4
+ version: 0.5.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-09-24 00:00:00.000000000 Z
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,6 +71,8 @@ files:
71
71
  - lib/xsys/model/product_category.rb
72
72
  - lib/xsys/model/product_price_list.rb
73
73
  - lib/xsys/model/product_provider.rb
74
+ - lib/xsys/model/sale.rb
75
+ - lib/xsys/model/sale_item.rb
74
76
  - lib/xsys/model/seller.rb
75
77
  - lib/xsys/model/shop.rb
76
78
  - lib/xsys/model/stock.rb