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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/xsys.rb +2 -0
- data/lib/xsys/api.rb +8 -0
- data/lib/xsys/model/company.rb +27 -0
- data/lib/xsys/model/company_tax_calculation.rb +34 -0
- data/lib/xsys/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77f62b43b0592120aeb0f0f7f958b54037bad03d
|
4
|
+
data.tar.gz: 0487541f2c19f6c37027024ccaf3514326aa7aa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5af039bc4df7cfe15a012188e434b8eabfcf99360bb9ba2ddcb4a9a794f22ef8844d1252883d4e220f718b6ba1517bbb1f9dbd1dd678c412bbc40645d9cd58b1
|
7
|
+
data.tar.gz: e146bc89e2e94c0b56d95581bd3ea897feacf67ebbf8480045e2f835eacd138c96aa2f104b1e6de358e98af57bc7e632d143070fd63a0de22b5ca807733afc10
|
data/CHANGELOG.md
CHANGED
data/lib/xsys.rb
CHANGED
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
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.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-
|
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
|