creditsafe 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +17 -17
  3. data/.gitignore +2 -2
  4. data/.rspec +1 -1
  5. data/.rubocop.yml +11 -11
  6. data/.ruby-version +1 -1
  7. data/CHANGELOG.md +49 -45
  8. data/Gemfile +5 -5
  9. data/Gemfile.lock +129 -129
  10. data/LICENSE.txt +22 -22
  11. data/README.md +175 -175
  12. data/creditsafe.gemspec +35 -35
  13. data/data/creditsafe-live.xml +342 -342
  14. data/data/creditsafe-test.xml +342 -342
  15. data/lib/creditsafe.rb +4 -4
  16. data/lib/creditsafe/client.rb +158 -158
  17. data/lib/creditsafe/constants.rb +49 -49
  18. data/lib/creditsafe/errors.rb +16 -16
  19. data/lib/creditsafe/match_type.rb +115 -115
  20. data/lib/creditsafe/messages.rb +97 -97
  21. data/lib/creditsafe/namespace.rb +20 -20
  22. data/lib/creditsafe/request/company_report.rb +42 -42
  23. data/lib/creditsafe/request/find_company.rb +120 -120
  24. data/lib/creditsafe/version.rb +5 -5
  25. data/spec/creditsafe/client_spec.rb +423 -423
  26. data/spec/creditsafe/messages_spec.rb +76 -76
  27. data/spec/fixtures/company-report-not-found.xml +13 -13
  28. data/spec/fixtures/company-report-request.xml +1 -1
  29. data/spec/fixtures/company-report-successful.xml +582 -582
  30. data/spec/fixtures/error-fault.xml +8 -8
  31. data/spec/fixtures/error-invalid-credentials.html +31 -31
  32. data/spec/fixtures/find-companies-error-no-text.xml +11 -11
  33. data/spec/fixtures/find-companies-error.xml +11 -11
  34. data/spec/fixtures/find-companies-none-found.xml +13 -13
  35. data/spec/fixtures/find-companies-request.xml +1 -1
  36. data/spec/fixtures/find-companies-successful-multi.xml +493 -493
  37. data/spec/fixtures/find-companies-successful.xml +29 -29
  38. data/spec/spec_helper.rb +14 -14
  39. metadata +3 -3
@@ -1,22 +1,22 @@
1
- Copyright (c) 2017 GoCardless Ltd
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2017 GoCardless Ltd
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,175 +1,175 @@
1
- # creditsafe-ruby
2
-
3
- *Build status: [![Circle CI](https://circleci.com/gh/gocardless/creditsafe-ruby.svg?style=svg&circle-token=3f6e9b24fcc6a57abac110c59395b36032f156a5)](https://circleci.com/gh/gocardless/creditsafe-ruby)*
4
-
5
- A ruby library for interacting with the
6
- [Creditsafe](http://www.creditsafeuk.com/) API.
7
-
8
- Currently, it only partially implements the API to support finding companies by
9
- registration number (and name in Germany), and retrieving company online reports.
10
-
11
- # Installation
12
-
13
- Install the gem from RubyGems.org by adding the following to your `Gemfile`:
14
-
15
- ```ruby
16
- gem 'creditsafe', '~> 0.4.0'
17
- ```
18
-
19
- Just run `bundle install` to install the gem and its dependencies.
20
-
21
- # Usage
22
-
23
- Initialise the client with your `username` and `password`.
24
-
25
- ```ruby
26
- client = Creditsafe::Client.new(username: "foo", password: "bar")
27
-
28
- # optionally with environment (live is default) and or log level
29
- client = Creditsafe::Client.new(username: "foo", password: "bar", environment: :test, log_level: :debug)
30
- ```
31
-
32
- ### Company Search
33
-
34
- To perform a search for a company, you need to provide a valid search criteria, including
35
- the country code and a company registration number or company name:
36
-
37
- ```ruby
38
- client.find_company({ country_code: "GB", registration_number: "07495895" })
39
- => {
40
- name: "GOCARDLESS LTD",
41
- type: "Ltd",
42
- status: "Active",
43
- registration_number: "07495895",
44
- address: {
45
- simple_value: "338-346, GOSWELL, LONDON",
46
- postal_code: "EC1V7LQ"
47
- },
48
- available_report_types: { available_report_type: "Full" },
49
- available_languages: { available_language: "EN" },
50
- @date_of_latest_accounts: "2014-01-31T00:00:00Z",
51
- @online_reports: "true",
52
- @monitoring: "false",
53
- @country: "GB",
54
- @id: "GB003/0/07495895"
55
- }
56
- ```
57
-
58
- In Germany you can also perform a name search. For this you need to provide a country code
59
- and a company name, and can optionally provide a postal code or city to filter the results
60
- further:
61
-
62
- ```ruby
63
- client.find_company({ country_code: "DE", company_name: "zalando", postal_code: "10243" })
64
- => [
65
- {
66
- "name": "Zalando Logistics Süd SE & Co. KG",
67
- "type": "NonLtd",
68
- "status": "Active",
69
- "address": {
70
- "street": "Tamara-Danz-Str. 1",
71
- "city": "Berlin",
72
- "postal_code": "10243"
73
- },
74
- "available_report_types": {
75
- "available_report_type": [
76
- "Full",
77
- "Basic"
78
- ]
79
- },
80
- "available_languages": {
81
- "available_language": [
82
- "EN",
83
- "DE"
84
- ]
85
- },
86
- "@online_reports": "true",
87
- "@monitoring": "true",
88
- "@country": "DE",
89
- "@id": "DE001/1/DE20316785",
90
- "@safe_number": "DE20316785"
91
- },
92
- {
93
- "name": "Zalando Outlet Store Berlin",
94
- "type": "NonLtd",
95
- "status": "Active",
96
- "address": {
97
- "street": "Köpenicker Str. 20",
98
- "city": "Berlin",
99
- "postal_code": "10997"
100
- },
101
- "available_report_types": {
102
- "available_report_type": [
103
- "Full",
104
- "Basic"
105
- ]
106
- },
107
- "available_languages": {
108
- "available_language": [
109
- "EN",
110
- "DE"
111
- ]
112
- },
113
- "@online_reports": "true",
114
- "@monitoring": "true",
115
- "@country": "DE",
116
- "@id": "DE001/1/DE16031795",
117
- "@safe_number": "DE16031795"
118
- },
119
- ...
120
- ]
121
- ```
122
-
123
- In some countries you can also perform a VAT number search. For this, you need to provide
124
- a country code and a VAT number:
125
-
126
- ```ruby
127
- client.find_company({ country_code: "US", vat_number: "201665019" })
128
- => [
129
- {
130
- "name": "FACEBOOK, INCORPORATED",
131
- "officeType": "HeadOffice",
132
- "status": "Active",
133
- "registration_number": "0883875",
134
- "vat_number": "201665019",
135
- "address": {
136
- "simple_value": "1601 WILLOW ROAD , MENLO PARK, CA, 94025",
137
- "street": "1601 WILLOW ROAD ",
138
- "city": "MENLO PARK",
139
- "postal_code": "94025",
140
- "province": "CA"
141
- },
142
- "phone_number": "6505434800",
143
- "available_report_types": {
144
- "available_report_type": "Full"
145
- },
146
- "available_languages": {
147
- "available_language": "EN"
148
- },
149
- "@online_reports": "true",
150
- "@monitoring": "false",
151
- "@country": "US",
152
- "@id": "US023/X/US22964593",
153
- "@safe_number": "US22964593"
154
- },
155
- ...
156
- ]
157
- ```
158
-
159
- ### Company Report
160
-
161
- To download all the information available in an online company report, you will
162
- need the company's Creditsafe identifier (obtainable using
163
- [find_company](#find_company) above):
164
-
165
- ```ruby
166
- client.company_report("GB003/0/07495895")
167
- => {
168
- ...
169
- }
170
- ```
171
-
172
-
173
- ---
174
-
175
- GoCardless ♥ open source. If you do too, come [join us](https://gocardless.com/jobs#software-engineer).
1
+ # creditsafe-ruby
2
+
3
+ *Build status: [![Circle CI](https://circleci.com/gh/gocardless/creditsafe-ruby.svg?style=svg&circle-token=3f6e9b24fcc6a57abac110c59395b36032f156a5)](https://circleci.com/gh/gocardless/creditsafe-ruby)*
4
+
5
+ A ruby library for interacting with the
6
+ [Creditsafe](http://www.creditsafeuk.com/) API.
7
+
8
+ Currently, it only partially implements the API to support finding companies by
9
+ registration number (and name in Germany), and retrieving company online reports.
10
+
11
+ # Installation
12
+
13
+ Install the gem from RubyGems.org by adding the following to your `Gemfile`:
14
+
15
+ ```ruby
16
+ gem 'creditsafe', '~> 0.4.0'
17
+ ```
18
+
19
+ Just run `bundle install` to install the gem and its dependencies.
20
+
21
+ # Usage
22
+
23
+ Initialise the client with your `username` and `password`.
24
+
25
+ ```ruby
26
+ client = Creditsafe::Client.new(username: "foo", password: "bar")
27
+
28
+ # optionally with environment (live is default) and or log level
29
+ client = Creditsafe::Client.new(username: "foo", password: "bar", environment: :test, log_level: :debug)
30
+ ```
31
+
32
+ ### Company Search
33
+
34
+ To perform a search for a company, you need to provide a valid search criteria, including
35
+ the country code and a company registration number or company name:
36
+
37
+ ```ruby
38
+ client.find_company({ country_code: "GB", registration_number: "07495895" })
39
+ => {
40
+ name: "GOCARDLESS LTD",
41
+ type: "Ltd",
42
+ status: "Active",
43
+ registration_number: "07495895",
44
+ address: {
45
+ simple_value: "338-346, GOSWELL, LONDON",
46
+ postal_code: "EC1V7LQ"
47
+ },
48
+ available_report_types: { available_report_type: "Full" },
49
+ available_languages: { available_language: "EN" },
50
+ @date_of_latest_accounts: "2014-01-31T00:00:00Z",
51
+ @online_reports: "true",
52
+ @monitoring: "false",
53
+ @country: "GB",
54
+ @id: "GB003/0/07495895"
55
+ }
56
+ ```
57
+
58
+ In Germany you can also perform a name search. For this you need to provide a country code
59
+ and a company name, and can optionally provide a postal code or city to filter the results
60
+ further:
61
+
62
+ ```ruby
63
+ client.find_company({ country_code: "DE", company_name: "zalando", postal_code: "10243" })
64
+ => [
65
+ {
66
+ "name": "Zalando Logistics Süd SE & Co. KG",
67
+ "type": "NonLtd",
68
+ "status": "Active",
69
+ "address": {
70
+ "street": "Tamara-Danz-Str. 1",
71
+ "city": "Berlin",
72
+ "postal_code": "10243"
73
+ },
74
+ "available_report_types": {
75
+ "available_report_type": [
76
+ "Full",
77
+ "Basic"
78
+ ]
79
+ },
80
+ "available_languages": {
81
+ "available_language": [
82
+ "EN",
83
+ "DE"
84
+ ]
85
+ },
86
+ "@online_reports": "true",
87
+ "@monitoring": "true",
88
+ "@country": "DE",
89
+ "@id": "DE001/1/DE20316785",
90
+ "@safe_number": "DE20316785"
91
+ },
92
+ {
93
+ "name": "Zalando Outlet Store Berlin",
94
+ "type": "NonLtd",
95
+ "status": "Active",
96
+ "address": {
97
+ "street": "Köpenicker Str. 20",
98
+ "city": "Berlin",
99
+ "postal_code": "10997"
100
+ },
101
+ "available_report_types": {
102
+ "available_report_type": [
103
+ "Full",
104
+ "Basic"
105
+ ]
106
+ },
107
+ "available_languages": {
108
+ "available_language": [
109
+ "EN",
110
+ "DE"
111
+ ]
112
+ },
113
+ "@online_reports": "true",
114
+ "@monitoring": "true",
115
+ "@country": "DE",
116
+ "@id": "DE001/1/DE16031795",
117
+ "@safe_number": "DE16031795"
118
+ },
119
+ ...
120
+ ]
121
+ ```
122
+
123
+ In some countries you can also perform a VAT number search. For this, you need to provide
124
+ a country code and a VAT number:
125
+
126
+ ```ruby
127
+ client.find_company({ country_code: "US", vat_number: "201665019" })
128
+ => [
129
+ {
130
+ "name": "FACEBOOK, INCORPORATED",
131
+ "officeType": "HeadOffice",
132
+ "status": "Active",
133
+ "registration_number": "0883875",
134
+ "vat_number": "201665019",
135
+ "address": {
136
+ "simple_value": "1601 WILLOW ROAD , MENLO PARK, CA, 94025",
137
+ "street": "1601 WILLOW ROAD ",
138
+ "city": "MENLO PARK",
139
+ "postal_code": "94025",
140
+ "province": "CA"
141
+ },
142
+ "phone_number": "6505434800",
143
+ "available_report_types": {
144
+ "available_report_type": "Full"
145
+ },
146
+ "available_languages": {
147
+ "available_language": "EN"
148
+ },
149
+ "@online_reports": "true",
150
+ "@monitoring": "false",
151
+ "@country": "US",
152
+ "@id": "US023/X/US22964593",
153
+ "@safe_number": "US22964593"
154
+ },
155
+ ...
156
+ ]
157
+ ```
158
+
159
+ ### Company Report
160
+
161
+ To download all the information available in an online company report, you will
162
+ need the company's Creditsafe identifier (obtainable using
163
+ [find_company](#find_company) above):
164
+
165
+ ```ruby
166
+ client.company_report("GB003/0/07495895")
167
+ => {
168
+ ...
169
+ }
170
+ ```
171
+
172
+
173
+ ---
174
+
175
+ GoCardless ♥ open source. If you do too, come [join us](https://gocardless.com/jobs#software-engineer).
@@ -1,35 +1,35 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path("lib", __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "creditsafe/version"
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "creditsafe"
9
- spec.version = Creditsafe::VERSION
10
- spec.authors = ["GoCardless Engineering"]
11
- spec.email = ["engineering@gocardless.com"]
12
- spec.summary = "Ruby client for the Creditsafe SOAP API"
13
- spec.description = "Ruby client for the Creditsafe SOAP API"
14
- spec.homepage = "https://github.com/gocardless/creditsafe-ruby"
15
-
16
- spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_runtime_dependency "activesupport", ">= 4.2.0"
22
- spec.add_runtime_dependency "excon", "~> 0.45"
23
- spec.add_runtime_dependency "savon", "~> 2.8"
24
-
25
- spec.add_development_dependency "bundler", "~> 1.3"
26
- spec.add_development_dependency "compare-xml", "~> 0.5"
27
- spec.add_development_dependency "gc_ruboconfig", "~> 2.3"
28
- spec.add_development_dependency "pry", "~> 0.11"
29
- spec.add_development_dependency "rspec", "~> 3.1"
30
- spec.add_development_dependency "rspec-its", "~> 1.2"
31
- spec.add_development_dependency "rspec_junit_formatter", "~> 0.3"
32
- spec.add_development_dependency "rubocop", "~> 0.52"
33
- spec.add_development_dependency "timecop", "~> 0.8"
34
- spec.add_development_dependency "webmock", "~> 3.3"
35
- end
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "creditsafe/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "creditsafe"
9
+ spec.version = Creditsafe::VERSION
10
+ spec.authors = ["GoCardless Engineering"]
11
+ spec.email = ["engineering@gocardless.com"]
12
+ spec.summary = "Ruby client for the Creditsafe SOAP API"
13
+ spec.description = "Ruby client for the Creditsafe SOAP API"
14
+ spec.homepage = "https://github.com/gocardless/creditsafe-ruby"
15
+
16
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "activesupport", ">= 4.2.0"
22
+ spec.add_runtime_dependency "excon", "~> 0.45"
23
+ spec.add_runtime_dependency "savon", "~> 2.8"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "compare-xml", "~> 0.5"
27
+ spec.add_development_dependency "gc_ruboconfig", "~> 2.3"
28
+ spec.add_development_dependency "pry", "~> 0.11"
29
+ spec.add_development_dependency "rspec", "~> 3.1"
30
+ spec.add_development_dependency "rspec-its", "~> 1.2"
31
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0.3"
32
+ spec.add_development_dependency "rubocop", "~> 0.52"
33
+ spec.add_development_dependency "timecop", "~> 0.8"
34
+ spec.add_development_dependency "webmock", "~> 3.3"
35
+ end