xsys 0.16.1 → 0.17.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: 030def67848041ef03d9609e1e7a18b4f25b7e94
4
- data.tar.gz: 7a4bb8ac63b4bafb048b815d8e8da05cbb96a3e0
3
+ metadata.gz: 77f62b43b0592120aeb0f0f7f958b54037bad03d
4
+ data.tar.gz: 0487541f2c19f6c37027024ccaf3514326aa7aa6
5
5
  SHA512:
6
- metadata.gz: 9d82ebb9b542c53ffd391def3e0cb0353455c09e1836d401a8a36ba426737c2b0158044b9c6e8e20968d15823fe678eab481603cd2948650691f577790840aa4
7
- data.tar.gz: 5f0debb76bdead18a912c488730cb4010b8f4e0a757cceb7994eff35dfb7c56fec5a9e58cf617d886f9b3abf8472336efa39d9492a80b2de9323fb396098357f
6
+ metadata.gz: 5af039bc4df7cfe15a012188e434b8eabfcf99360bb9ba2ddcb4a9a794f22ef8844d1252883d4e220f718b6ba1517bbb1f9dbd1dd678c412bbc40645d9cd58b1
7
+ data.tar.gz: e146bc89e2e94c0b56d95581bd3ea897feacf67ebbf8480045e2f835eacd138c96aa2f104b1e6de358e98af57bc7e632d143070fd63a0de22b5ca807733afc10
data/CHANGELOG.md CHANGED
@@ -353,3 +353,7 @@
353
353
  ## v0.16.1
354
354
 
355
355
  * Added method to get stock reserve
356
+
357
+ ## v0.17.0
358
+
359
+ * Added method for company and tax calculation
data/lib/xsys.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'xsys/model/background_job'
2
+ require 'xsys/model/company'
3
+ require 'xsys/model/company_tax_calculation'
2
4
  require 'xsys/model/job_event'
3
5
  require 'xsys/model/price_list'
4
6
  require 'xsys/model/product'
data/lib/xsys/api.rb CHANGED
@@ -203,6 +203,14 @@ module Xsys
203
203
  end
204
204
  end
205
205
 
206
+ def self.get_company(code)
207
+ Model::Company.new(get_request("/companies/#{code}"))
208
+ end
209
+
210
+ def self.calculate_company_taxes(attrs={})
211
+ Model::CompanyTaxCalculation.new(get_request('/companies/calculate_taxes', attrs))
212
+ end
213
+
206
214
  private
207
215
 
208
216
  def self.get_request(action, params={}, headers={})
@@ -0,0 +1,27 @@
1
+ module Xsys
2
+ module Model
3
+ class Company
4
+ def self.attr_list
5
+ [:code, :name, :tax_retention_rate, :tax_perception_rate]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ attributes.each do |k, v|
12
+ decimal_fields = ['tax_retention_rate', 'tax_perception_rate']
13
+
14
+ if decimal_fields.include?(k.to_s)
15
+ self.send("#{k}=", BigDecimal.new(v)) unless v.nil?
16
+ else
17
+ self.send("#{k}=", v) if self.respond_to?(k)
18
+ end
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ attr_writer *attr_list
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,34 @@
1
+ module Xsys
2
+ module Model
3
+ class CompanyTaxCalculation
4
+ def self.attr_list
5
+ [
6
+ :company_code,
7
+ :company_name,
8
+ :tax_retention_rate,
9
+ :tax_retention_amount,
10
+ :tax_perception_rate,
11
+ :tax_perception_amount
12
+ ]
13
+ end
14
+
15
+ attr_reader *attr_list
16
+
17
+ def initialize(attributes={})
18
+ attributes.each do |k, v|
19
+ decimal_fields = ['tax_retention_rate', 'tax_retention_amount', 'tax_perception_rate', 'tax_perception_amount']
20
+
21
+ if 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
data/lib/xsys/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xsys
2
- VERSION = "0.16.1"
2
+ VERSION = "0.17.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.16.1
4
+ version: 0.17.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: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,6 +65,8 @@ files:
65
65
  - lib/xsys.rb
66
66
  - lib/xsys/api.rb
67
67
  - lib/xsys/model/background_job.rb
68
+ - lib/xsys/model/company.rb
69
+ - lib/xsys/model/company_tax_calculation.rb
68
70
  - lib/xsys/model/job_event.rb
69
71
  - lib/xsys/model/price_list.rb
70
72
  - lib/xsys/model/product.rb