capital_on_tap 0.1.3 → 0.1.4
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 +4 -4
- data/Gemfile.lock +1 -1
- data/bin/console +35 -0
- data/lib/capital_on_tap/configuration.rb +12 -5
- data/lib/capital_on_tap/connection.rb +5 -1
- data/lib/capital_on_tap/version.rb +1 -1
- data/lib/capital_on_tap.rb +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff304abb175e93a841c01589d25435e3f8b6528930ea343220f2d212037c1512
|
4
|
+
data.tar.gz: 191e56331d8a27a8598e79571316713e48390a8bce5a9b86221a4e8654f37ea7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9ff711519ecfa374a4570fe8b7766faee184bdf156ede7d5f2376d157ca51de33c61c0426ab7879b2afbfbd21908263ea24b9ab0f2ef6d21a02847bc2093016
|
7
|
+
data.tar.gz: 75e6517a653a7cf19c401c3a0e6958b629f7c954eadd9f31bb5c0890235606f1fd3ee5c93a0e7098c86dd58d3aae89a791f962b9e43d09c278c53d7d15a150f2
|
data/Gemfile.lock
CHANGED
data/bin/console
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'bundler/setup'
|
5
5
|
require 'capital_on_tap'
|
6
|
+
require 'date'
|
6
7
|
|
7
8
|
require 'dotenv'
|
8
9
|
Dotenv.load
|
@@ -17,5 +18,39 @@ end
|
|
17
18
|
|
18
19
|
CapitalOnTap.setup_connection!
|
19
20
|
|
21
|
+
def generate_params
|
22
|
+
{
|
23
|
+
Salutation: 'Mr',
|
24
|
+
FirstName: 'Roberto',
|
25
|
+
LastName: 'Caras',
|
26
|
+
DateOfBirth: Date.parse("1980-#{rand(1..12)}-#{rand(1..28)}"),
|
27
|
+
MobilePhone: "077123456#{rand(11..99)}",
|
28
|
+
EmailAddress: "oterosantos_#{rand(1..100)}@gmail.com",
|
29
|
+
PersonalAddress: {
|
30
|
+
CountryCode: 'UK',
|
31
|
+
Street: "Unit #{rand(1..99)} Falcon Way Adelaide Industrial Estate, Boucher Road",
|
32
|
+
PostCode: 'BT12 6SQ',
|
33
|
+
City: 'Belfast'
|
34
|
+
},
|
35
|
+
TradingName: 'DUNDER MCMIFFLIN LTD',
|
36
|
+
BusinessLegalName: 'DUNDER MCMIFFLIN LTD',
|
37
|
+
BusinessLandline: '07874186570',
|
38
|
+
YearsTrading: rand(1..10),
|
39
|
+
MonthlyTurnOver: rand(300...9000),
|
40
|
+
BusinessType: 'LimitedCompany',
|
41
|
+
BusinessAddress: {
|
42
|
+
CountryCode: 'UK',
|
43
|
+
Street: "Unit #{rand(1..99)} Falcon Way Adelaide Industrial Estate, Boucher Road",
|
44
|
+
PostCode: 'BT12 6SQ',
|
45
|
+
City: 'Belfast'
|
46
|
+
},
|
47
|
+
RegistrationNumber: 'NI644403'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate_code
|
52
|
+
CapitalOnTap::Application.create(generate_params)
|
53
|
+
end
|
54
|
+
|
20
55
|
require 'pry'
|
21
56
|
Pry.start
|
@@ -5,15 +5,22 @@ module CapitalOnTap
|
|
5
5
|
attr_accessor :client_id, :client_secret, :username, :password, :env
|
6
6
|
attr_writer :debug
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
AUTH_DOMAINS = {
|
9
|
+
production: 'https://api-auth.capitalontap.com',
|
10
|
+
development: 'https://prelive-api-auth.capitalontap.com'
|
11
|
+
}
|
12
|
+
|
13
|
+
API_DOMAINS = {
|
14
|
+
production: 'https://api-partner.capitalontap.com',
|
15
|
+
development: 'https://prelive-api-partner.capitalontap.com'
|
16
|
+
}
|
10
17
|
|
11
18
|
def initialize
|
12
19
|
@client_id = ''
|
13
20
|
@client_secret = ''
|
14
21
|
@username = ''
|
15
22
|
@password = ''
|
16
|
-
@env = :development
|
23
|
+
@env = defined?(Rails) ? Rails.env : :development
|
17
24
|
@debug = false
|
18
25
|
end
|
19
26
|
|
@@ -22,11 +29,11 @@ module CapitalOnTap
|
|
22
29
|
end
|
23
30
|
|
24
31
|
def base_auth_url
|
25
|
-
|
32
|
+
AUTH_DOMAINS[@env.to_sym]
|
26
33
|
end
|
27
34
|
|
28
35
|
def base_url
|
29
|
-
|
36
|
+
API_DOMAINS[@env.to_sym]
|
30
37
|
end
|
31
38
|
end
|
32
39
|
end
|
@@ -28,6 +28,8 @@ module CapitalOnTap
|
|
28
28
|
|
29
29
|
http_response = adapter.get(path, params)
|
30
30
|
|
31
|
+
log "Response: #{http_response.body}"
|
32
|
+
|
31
33
|
Response.new(http_response)
|
32
34
|
end
|
33
35
|
|
@@ -36,6 +38,8 @@ module CapitalOnTap
|
|
36
38
|
|
37
39
|
http_response = adapter.post(path, params.to_json)
|
38
40
|
|
41
|
+
log "Response: #{http_response.body}"
|
42
|
+
|
39
43
|
Response.new(http_response)
|
40
44
|
end
|
41
45
|
|
@@ -62,7 +66,7 @@ module CapitalOnTap
|
|
62
66
|
conn.headers['Content-Type'] = 'application/json'
|
63
67
|
conn.use FaradayMiddleware::ParseJson
|
64
68
|
conn.response :json, parser_options: { symbolize_names: true }
|
65
|
-
conn.response :logger if CapitalOnTap.configuration.debug?
|
69
|
+
# conn.response :logger if CapitalOnTap.configuration.debug?
|
66
70
|
conn.adapter Faraday.default_adapter
|
67
71
|
end
|
68
72
|
end
|
data/lib/capital_on_tap.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capital_on_tap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rikas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|