credit_device 0.1.1 → 1.1.1

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: 9d7a8a5beadd6a9a76950c31f3c1ae832428762b
4
- data.tar.gz: f53e3966cf5557313d554990c9ca15973ea3b6d9
2
+ SHA256:
3
+ metadata.gz: 661c1c25ae012f67a2db696bd060d7ef48f892791b5c563209ae44435ac02c31
4
+ data.tar.gz: e9c376f82a746c78b48b1e17569e6a2dbf9233badf3a05be0545e00728cbe204
5
5
  SHA512:
6
- metadata.gz: f56cc73cde146f58f037f464f31db4f0bb5ebe0e51ad972c50b7a2982dccd7ed2d281df80bb9ce7bbc0cc91a1494d84922549e160c5054c3559e7bb9d3cae0d1
7
- data.tar.gz: 15d83a61bfa4c6adf200af488ac132c2df01ef7c30a2f8ca4176002ebd6aa0f1db5813eeb41ff16339063c210a1faa3fe280e888e1f815252b45bb3aac334ec8
6
+ metadata.gz: 83af23de1e9e97d37fbbf88704a8ef75b04e3516c9e5281d2e190e1a9b22905dc3c78d7608a60d8e301f003b96afbaf1e6a2a9c125e79a2d71af1ae74119fea1
7
+ data.tar.gz: 911493f1fb6908839e8e51dc30500732dd229d8bfdf305b426dfcdf1a12774e33e709d7721ef7664deadfb31bb8f1118dcaabc6c46b4a1e99de4ed30bc1f38eb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- credit_device (0.1.1)
4
+ credit_device (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # CreditDevice
2
2
 
3
+ * That gem is not ready yet, is missing reports and few stuffs
4
+
3
5
 
4
6
  ## Installation
5
7
 
@@ -19,6 +21,7 @@ Or install it yourself as:
19
21
 
20
22
  ## Usage
21
23
 
24
+ ### config file
22
25
  ```
23
26
  CreditDevice.configure do |config|
24
27
  config.url = "url"
@@ -26,7 +29,49 @@ Or install it yourself as:
26
29
  config.password = "password"
27
30
  end
28
31
  ```
32
+ ### check status
33
+ ```
34
+ # check the status after setup your configuration CreaditDevice
35
+ CreditDevice::Status.check_status
36
+
37
+ ```
38
+
39
+ ### get all companies by term
40
+
41
+ ```
42
+ @company = CreditDevice::Company.new("ABN", "NL",1)
43
+ @company.get_all
44
+ ```
45
+
46
+ ### get all companies with filter by type:
47
+ * ex: by reg_number
48
+ * check all list of parameter here: https://inquiry.creditandcollection.nl/docs/company.html
49
+ * parameters for Comapny.new is : ```def initialize(term, country, page = 1, **parameter)```
50
+
51
+ ```
52
+ @company = CreditDevice::Company.new("97123456", "NL",1, type: CreditDevice::Type::QueryParameterType::REG_NUMBER)
53
+ @company.get_all
54
+ ```
55
+
56
+
57
+
58
+ ### Get Inquiry from the company:
59
+
60
+ ex: using Inquiry above:
61
+ ```
62
+ # D44CI701 => type -> all types on link: [link](https://inquiry.creditandcollection.nl/docs/inquiry.html)
63
+ # l7Ox1kNbDBaL3ljSsWZi+A== => company_id
64
+ # NL = country language
65
+ @inquery = CreditDevice::Inquiry.new("D44CI701", "l7Ox1kNbDBaL3ljSsWZi+A==", "NL")
66
+ ```
67
+
68
+ ### GET Report from path or company_id
29
69
 
70
+ ````
71
+ CreditDevice::Report.new("inquiries/153065/").request_report
72
+ or
73
+ CreditDevice::Report.new(nil, inquiry_id: 153044).request_report
74
+ ````
30
75
  ## Contributing
31
76
 
32
77
  Bug reports and pull requests are welcome on GitHub at https://github.com/rodrigobarreto/credit_device. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/lib/credit_device.rb CHANGED
@@ -1,12 +1,15 @@
1
1
  require "rest-client"
2
2
  require "json"
3
3
  require "credit_device/type/query_parameter_type"
4
+ require "credit_device/type/product_type"
4
5
  require "credit_device/version"
5
6
  require "credit_device/base"
6
7
  require "credit_device/client"
7
8
  require "credit_device/configuration"
8
9
  require "credit_device/status"
9
10
  require "credit_device/company"
11
+ require "credit_device/inquery"
12
+ require "credit_device/report"
10
13
  require "credit_device/base"
11
14
 
12
15
 
@@ -1,5 +1,11 @@
1
1
  module CreditDevice
2
2
  class Base
3
-
3
+ def self.config(url, username, password)
4
+ CreditDevice.configure do |config|
5
+ config.url = url
6
+ config.username = username
7
+ config.password = password
8
+ end
9
+ end
4
10
  end
5
11
  end
@@ -1,3 +1,5 @@
1
+ require 'base64'
2
+
1
3
  module CreditDevice
2
4
  class Client
3
5
  def initialize(type, path, params = {})
@@ -0,0 +1,27 @@
1
+ # https://inquiry.creditandcollection.nl/docs/inquiry.html
2
+
3
+ module CreditDevice
4
+ class Inquiry
5
+ attr_reader :product_type, :company_id, :language
6
+
7
+ def initialize(product_type = CreditDevice::Type::ProductType::D44CI701, company_id = nil, language = "NL", **_parameter)
8
+ @product_type = set_type(product_type)
9
+ @company_id = company_id
10
+ @language = language
11
+ end
12
+
13
+ def request_inquiry
14
+ params = { company_id: @company_id, product: @product_type, language: @language }.to_json
15
+ CreditDevice::Client.new(:post, path, params).request
16
+ end
17
+
18
+ def path
19
+ "inquiries"
20
+ end
21
+
22
+ def set_type(type)
23
+ raise "type invalid, parameters are: #{CreditDevice::Type::ProductType::TYPES.join(',')}" unless CreditDevice::Type::ProductType::TYPES.include? type
24
+ type
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ # https://inquiry.creditandcollection.nl/docs/report.html
2
+
3
+ module CreditDevice
4
+ class Report
5
+ attr_reader :path, :inquiry_id
6
+
7
+ def initialize(path, **_parameter)
8
+ @path = path
9
+ @inquiry_id = _parameter[:inquiry_id]
10
+ end
11
+
12
+ def request_report
13
+ @path = report_by_inquiry_id if @inquiry_id
14
+ CreditDevice::Client.new(:get, @path).request
15
+ end
16
+
17
+ def report_by_inquiry_id
18
+ "inquiries/#{@inquiry_id}/report"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ # types are from https://inquiry.creditandcollection.nl/docs/inquiry.html
2
+
3
+ module CreditDevice
4
+ module Type
5
+ module ProductType
6
+ TYPES = [
7
+ D44CI701 = 'D44CI701'.freeze, # Default
8
+ D44CI102 = 'D44CI102'.freeze,
9
+ D44CI101 = 'D44CI101'.freeze,
10
+ D44CI201 = 'D44CI201'.freeze,
11
+ D44CI301 = 'D44CI301'.freeze,
12
+ D44CI302 = 'D44CI302'.freeze,
13
+ D44CI501 = 'D44CI501'.freeze,
14
+ D44CI702 = 'D44CI702'.freeze,
15
+ D44CI704 = 'D44CI704'.freeze,
16
+ D44CI906 = 'D44CI906'.freeze,
17
+ D44CI707 = 'D44CI707'.freeze,
18
+ D44CI907 = 'D44CI907'.freeze
19
+ ].freeze
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module CreditDevice
2
- VERSION = "0.1.1"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credit_device
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Barreto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-05 00:00:00.000000000 Z
11
+ date: 2018-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,8 +88,6 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
- - ".idea/credit_device.iml"
92
- - ".idea/workspace.xml"
93
91
  - ".rspec"
94
92
  - ".travis.yml"
95
93
  - CODE_OF_CONDUCT.md
@@ -106,7 +104,10 @@ files:
106
104
  - lib/credit_device/client.rb
107
105
  - lib/credit_device/company.rb
108
106
  - lib/credit_device/configuration.rb
107
+ - lib/credit_device/inquery.rb
108
+ - lib/credit_device/report.rb
109
109
  - lib/credit_device/status.rb
110
+ - lib/credit_device/type/product_type.rb
110
111
  - lib/credit_device/type/query_parameter_type.rb
111
112
  - lib/credit_device/version.rb
112
113
  homepage: https://github.com/rodrigonbarreto/credit_device
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  version: '0'
130
131
  requirements: []
131
132
  rubyforge_project:
132
- rubygems_version: 2.6.13
133
+ rubygems_version: 2.7.4
133
134
  signing_key:
134
135
  specification_version: 4
135
136
  summary: A gem to check credit device