xsys 0.21.0 → 0.22.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: 0666acde5cf35829e63ff63046d56bb5eefbfe08
4
- data.tar.gz: b5b5f3094e398b8795285f7a8d4ddcfd09bb79af
3
+ metadata.gz: '085cc15b96c872ccf5cfc3e4aae763bd484db659'
4
+ data.tar.gz: 4ac87cd90fc1029cc87f8d3050dc247a18ddcf31
5
5
  SHA512:
6
- metadata.gz: b8cadbfb6e44dfb63ff1346ab68b25e67ae4fddfd34787eb26d76d545b932e2380c4b0a3fd0d7c39e37f3935992d8796281132eb731bff7fab6b11bd0c4b531f
7
- data.tar.gz: da4063500c57abc37057df138c2a56868c9d43e789a309b1b5e930dfb2783607ca1b70ec9011d27e605bc6a0081df7a9373aba12190a845decbb73d4203dc3de
6
+ metadata.gz: 310466ea8ec95c627d3b0f61165567f1d3d92a5ecb8421d5ccdcf3310a17f8d705be4d01f769edff8c22924bd32fbb53c7bdcd7a1f06542c41af50967b037583
7
+ data.tar.gz: 56df089db2b279214e9ea2730d0192e52640a4187ec1784ff3817853afc7717e1777d7e56f590f093438f3a3423b650016d8bc68094575d637ee284c46665b85
data/CHANGELOG.md CHANGED
@@ -389,3 +389,7 @@
389
389
  ## v0.21.0
390
390
 
391
391
  * Added method to calculate corporation taxes
392
+
393
+ ## v0.22.0
394
+
395
+ * Added class for corporation taxes calculation
data/lib/xsys.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'xsys/model/background_job'
2
2
  require 'xsys/model/company'
3
3
  require 'xsys/model/company_tax_calculation'
4
+ require 'xsys/model/corporation_tax'
5
+ require 'xsys/model/corporation_taxes_calculation'
4
6
  require 'xsys/model/job_event'
5
7
  require 'xsys/model/price_list'
6
8
  require 'xsys/model/product'
data/lib/xsys/api.rb CHANGED
@@ -227,9 +227,14 @@ module Xsys
227
227
  end
228
228
 
229
229
  def self.calculate_corporation_taxes(cuit, items)
230
- attrs = { cuit: cuit, items: items.to_json }
230
+ attrs =
231
231
 
232
- OpenStruct.new(post_request('/corporations/taxes_calculation', attrs)[:body])
232
+ response = post_request('/corporations/taxes_calculation', {
233
+ cuit: cuit,
234
+ items: items.to_json
235
+ })
236
+
237
+ CorporationTaxesCalculation.new(response[:body])
233
238
  end
234
239
 
235
240
  private
@@ -0,0 +1,22 @@
1
+ module Xsys
2
+ module Model
3
+ class CorporationTax
4
+ def self.attr_list
5
+ [:tax_kind_code, :quotient, :amount, :use_default_value]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ self.tax_kind_code = attributes[:tax_kind_code]
12
+ self.quotient = BigDecimal.new(attributes[:quotient])
13
+ self.amount = BigDecimal.new(attributes[:amount])
14
+ self.use_default_value = attributes[:use_default_value]
15
+ end
16
+
17
+ private
18
+
19
+ attr_writer *attr_list
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ module Xsys
2
+ module Model
3
+ class CorporationTaxesCalculation
4
+ def self.attr_list
5
+ [:cuit, :corporate_name, :taxes]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ self.cuit = attributes[:cuit]
12
+ self.corporate_name = attributes[:corporate_name]
13
+ self.taxes = attributes[:taxes].map { |tax_attrs| CorporationTax.new(tax_attrs) }
14
+ end
15
+
16
+ def get_tax(tax_kind_code)
17
+ taxes.find { |x| x.tax_kind_code.to_s == tax_kind_code.to_s }
18
+ end
19
+
20
+ private
21
+
22
+ attr_writer *attr_list
23
+ end
24
+ end
25
+ end
data/lib/xsys/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xsys
2
- VERSION = "0.21.0"
2
+ VERSION = "0.22.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xsys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
@@ -67,6 +67,8 @@ files:
67
67
  - lib/xsys/model/background_job.rb
68
68
  - lib/xsys/model/company.rb
69
69
  - lib/xsys/model/company_tax_calculation.rb
70
+ - lib/xsys/model/corporation_tax.rb
71
+ - lib/xsys/model/corporation_taxes_calculation.rb
70
72
  - lib/xsys/model/job_event.rb
71
73
  - lib/xsys/model/price_list.rb
72
74
  - lib/xsys/model/product.rb