vat_payer_cz 0.0.4 → 0.1.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
- SHA1:
3
- metadata.gz: 5d57e420c66d207f6f0e161655d2b31f6aff236e
4
- data.tar.gz: d2216b9183c903bab7deb0b5a68f95ccf032ea9b
2
+ SHA256:
3
+ metadata.gz: 2e66f74d806a8689d68e4c4e80e30a532c177ac5e17bfa2d2f846b3846bcc2f1
4
+ data.tar.gz: f7477384dfad8946ed14179c73d71f842887679b00d77d464116d4df3bc05536
5
5
  SHA512:
6
- metadata.gz: 8d135b33db2365972b85e730f8477e15ed8f125ec8e8b1562668714ef776dd4c9fb82d24fa4b8e8b3d8a7d65d09560a9662ea6c7c43ccbdb40c147bf2bc3a8ec
7
- data.tar.gz: a261dbf1213afb8ced159c571afe36962d26908e50fdd1696229728eab50d8a47ba82faf7e4670ccf3fa31f7f6032cb8a2fa5c02c9b6dc64127bf98b2981a91d
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 (not implemented)
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
- # :get_seznam_nespolehlivy_platce
47
- raise NotImplementedError
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: params.fetch(:@status_code),
15
- status_text: params.fetch(:@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: data[:@predcisli],
33
- cislo: data[:@cislo],
34
- kod_banky: data[:@kod_banky],
35
- iban: nil
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: nil,
42
- cislo: nil,
43
- kod_banky: nil,
44
- iban: data[:@cislo]
41
+ predcisli: nil,
42
+ cislo: nil,
43
+ kod_banky: nil,
44
+ iban: data[:@cislo]
45
45
  }
46
46
  end
47
47
  end
@@ -1,6 +1,7 @@
1
1
  require 'nokogiri'
2
2
  require 'vat_info/request/unreliable_payer'
3
3
  require 'vat_info/request/unreliable_payer_extended'
4
+ require 'vat_info/request/unreliable_payer_list'
4
5
 
5
6
  module VatInfo
6
7
  class Request
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module VatInfo
2
- VERSION = '0.0.4'
2
+ VERSION = '0.1.0'
3
3
  end
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
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: 2018-03-29 00:00:00.000000000 Z
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.6.8
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.