vat_payer_cz 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop_todo.yml +0 -6
- data/.travis.yml +37 -0
- data/README.md +10 -3
- data/lib/vat_info.rb +13 -2
- data/lib/vat_info/models/status.rb +2 -2
- data/lib/vat_info/models/vat_payer.rb +8 -8
- data/lib/vat_info/request.rb +1 -0
- data/lib/vat_info/request/unreliable_payer_list.rb +11 -0
- data/lib/vat_info/utils.rb +2 -0
- data/lib/vat_info/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2e66f74d806a8689d68e4c4e80e30a532c177ac5e17bfa2d2f846b3846bcc2f1
|
4
|
+
data.tar.gz: f7477384dfad8946ed14179c73d71f842887679b00d77d464116d4df3bc05536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fdd59b2928f1c320364743a6f383b0bb7d996b88234b7e73d73616915ce3e2329f3642a9c49e92490369a0223d6b796d6b98db7cc29b49cd54fe37869883ac4
|
7
|
+
data.tar.gz: 408a484e9dbd3a5401bafca942b92c7335d948e3e3e3d25247ee9f4fc0eb7d81d3ee0c0f370666b1f033ced1fb327dabf607213b1929d5ec88884ac8be225590
|
data/.rubocop_todo.yml
CHANGED
@@ -152,12 +152,6 @@ Lint/UnifiedInteger:
|
|
152
152
|
Exclude:
|
153
153
|
- 'spec/support/rspec_matchers/have_row.rb'
|
154
154
|
|
155
|
-
# Offense count: 1
|
156
|
-
# Cop supports --auto-correct.
|
157
|
-
Lint/UnneededDisable:
|
158
|
-
Exclude:
|
159
|
-
- 'app/queries/query/budget_by_days.rb'
|
160
|
-
|
161
155
|
# Offense count: 1
|
162
156
|
# Cop supports --auto-correct.
|
163
157
|
Lint/UnneededSplatExpansion:
|
data/.travis.yml
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.3.1
|
4
|
+
- 2.4.5
|
5
|
+
- 2.5.3
|
6
|
+
- 2.6.0
|
7
|
+
|
8
|
+
stages:
|
9
|
+
- code-quality
|
10
|
+
- test
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
include:
|
14
|
+
- rvm: 2.3.1
|
15
|
+
stage: code-quality
|
16
|
+
script: bundle exec rubocop
|
17
|
+
- rvm: 2.3.1
|
18
|
+
stage: test
|
19
|
+
script: bundle exec rspec
|
20
|
+
- rvm: 2.4.5
|
21
|
+
stage: code-quality
|
22
|
+
script: bundle exec rubocop
|
23
|
+
- rvm: 2.4.5
|
24
|
+
stage: test
|
25
|
+
script: bundle exec rspec
|
26
|
+
- rvm: 2.5.3
|
27
|
+
stage: code-quality
|
28
|
+
script: bundle exec rubocop
|
29
|
+
- rvm: 2.5.3
|
30
|
+
stage: test
|
31
|
+
script: bundle exec rspec
|
32
|
+
- rvm: 2.6.0
|
33
|
+
stage: code-quality
|
34
|
+
script: bundle exec rubocop
|
35
|
+
- rvm: 2.6.0
|
36
|
+
stage: test
|
37
|
+
script: bundle exec rspec
|
data/README.md
CHANGED
@@ -8,9 +8,7 @@ This is Ruby wrapper for [web service for "searching information about reliabili
|
|
8
8
|
The web service has the following three end-points:
|
9
9
|
- [standard VAT payer info](#standard)
|
10
10
|
- [extended VAT payer info](#extended)
|
11
|
-
- list of unreliable VAT payers
|
12
|
-
|
13
|
-
This gem currently implements **standard VAT payer info** and **extended VAT payer info**.
|
11
|
+
- [list of unreliable VAT payers](#list)
|
14
12
|
|
15
13
|
## <a name="standard">Standard VAT payer info</a>
|
16
14
|
```ruby
|
@@ -28,6 +26,15 @@ require 'vat_info'
|
|
28
26
|
vat_ids = %w(CZ27169278 CZ26168685)
|
29
27
|
VatInfo.unreliable_payer_extended(*vat_ids)
|
30
28
|
```
|
29
|
+
## <a name="list">List VAT payers</a>
|
30
|
+
Lists all unreliable VAT payers, but only their status as payer (reliable/unreliable),
|
31
|
+
their VAT number, financial office they belong to and date on which they became
|
32
|
+
unreliable
|
33
|
+
```ruby
|
34
|
+
require 'vat_info'
|
35
|
+
|
36
|
+
VatInfo.unreliable_payer_list
|
37
|
+
```
|
31
38
|
|
32
39
|
## Response
|
33
40
|
Object `VatInfo::Response`
|
data/lib/vat_info.rb
CHANGED
@@ -43,7 +43,18 @@ module VatInfo
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.unreliable_payer_list
|
46
|
-
|
47
|
-
|
46
|
+
request = VatInfo::Request::UnreliablePayerList.new.to_xml
|
47
|
+
response = VatInfo::Query.call(request, :get_seznam_nespolehlivy_platce)
|
48
|
+
|
49
|
+
if response.ok?
|
50
|
+
status_raw = response.raw[:seznam_nespolehlivy_platce_response][:status]
|
51
|
+
status = VatInfo::Models::Status.new(status_raw).data
|
52
|
+
|
53
|
+
payers_raw = VatInfo::Utils.wrap_in_array(response.raw[:seznam_nespolehlivy_platce_response][:status_platce_dph])
|
54
|
+
payers = VatInfo::Models::VatPayers.new(VatInfo::Models::VatPayerExtended, payers_raw).data
|
55
|
+
|
56
|
+
response.body = status.merge(payers)
|
57
|
+
end
|
58
|
+
response
|
48
59
|
end
|
49
60
|
end
|
@@ -11,8 +11,8 @@ module VatInfo
|
|
11
11
|
|
12
12
|
def create_status
|
13
13
|
{
|
14
|
-
status_code:
|
15
|
-
status_text:
|
14
|
+
status_code: params.fetch(:@status_code),
|
15
|
+
status_text: params.fetch(:@status_text),
|
16
16
|
odpoved_generovana: params.fetch(:@odpoved_generovana)
|
17
17
|
}
|
18
18
|
rescue KeyError => e
|
@@ -29,19 +29,19 @@ module VatInfo
|
|
29
29
|
|
30
30
|
def standard_account(data)
|
31
31
|
{
|
32
|
-
predcisli:
|
33
|
-
cislo:
|
34
|
-
kod_banky:
|
35
|
-
iban:
|
32
|
+
predcisli: data[:@predcisli],
|
33
|
+
cislo: data[:@cislo],
|
34
|
+
kod_banky: data[:@kod_banky],
|
35
|
+
iban: nil
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
39
39
|
def non_standard_account(data)
|
40
40
|
{
|
41
|
-
predcisli:
|
42
|
-
cislo:
|
43
|
-
kod_banky:
|
44
|
-
iban:
|
41
|
+
predcisli: nil,
|
42
|
+
cislo: nil,
|
43
|
+
kod_banky: nil,
|
44
|
+
iban: data[:@cislo]
|
45
45
|
}
|
46
46
|
end
|
47
47
|
end
|
data/lib/vat_info/request.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
module VatInfo
|
2
|
+
class Request
|
3
|
+
class UnreliablePayerList < VatInfo::Request
|
4
|
+
def body
|
5
|
+
Nokogiri::XML::Builder.new('encoding' => 'UTF-8') do |xml|
|
6
|
+
xml.SeznamNespolehlivyPlatceRequest(xmlns: 'http://adis.mfcr.cz/rozhraniCRPDPH/')
|
7
|
+
end.doc
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/vat_info/utils.rb
CHANGED
@@ -12,6 +12,7 @@ module VatInfo
|
|
12
12
|
|
13
13
|
def self.normalize(string)
|
14
14
|
return unless string
|
15
|
+
|
15
16
|
replace_exceptions(string).strip.split(' ').map do |word|
|
16
17
|
format_this word
|
17
18
|
end.join(' ')
|
@@ -32,6 +33,7 @@ module VatInfo
|
|
32
33
|
def self.format_this(string)
|
33
34
|
return string.downcase if string.size == 1
|
34
35
|
return string.downcase if COMPANY_TYPES.include? string.downcase
|
36
|
+
|
35
37
|
replace_special_chars(string.capitalize)
|
36
38
|
end
|
37
39
|
end
|
data/lib/vat_info/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vat_payer_cz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Landovsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- ".rspec"
|
136
136
|
- ".rubocop.yml"
|
137
137
|
- ".rubocop_todo.yml"
|
138
|
+
- ".travis.yml"
|
138
139
|
- Dockerfile
|
139
140
|
- Gemfile
|
140
141
|
- LICENSE
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- lib/vat_info/request.rb
|
156
157
|
- lib/vat_info/request/unreliable_payer.rb
|
157
158
|
- lib/vat_info/request/unreliable_payer_extended.rb
|
159
|
+
- lib/vat_info/request/unreliable_payer_list.rb
|
158
160
|
- lib/vat_info/response.rb
|
159
161
|
- lib/vat_info/utils.rb
|
160
162
|
- lib/vat_info/version.rb
|
@@ -179,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
181
|
version: '0'
|
180
182
|
requirements: []
|
181
183
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.7.8
|
183
185
|
signing_key:
|
184
186
|
specification_version: 4
|
185
187
|
summary: Ruby wrapper for web service providing info about Czech VAT payers.
|