capital_on_tap 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -2
- data/Gemfile.lock +20 -2
- data/Rakefile +5 -3
- data/bin/console +28 -30
- data/capital_on_tap.gemspec +6 -4
- data/lib/capital_on_tap.rb +1 -1
- data/lib/capital_on_tap/application.rb +6 -6
- data/lib/capital_on_tap/auth.rb +3 -3
- data/lib/capital_on_tap/configuration.rb +4 -4
- data/lib/capital_on_tap/connection.rb +1 -1
- data/lib/capital_on_tap/version.rb +1 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3183097cf91d6bddb3da967e9f7922ac6a2cca30b898b5f72b363b7ee3bb8957
|
4
|
+
data.tar.gz: d360e41c71415ef5b689ff9f5968017b00a52c3e963e06b0f2d4e2f9e276fd74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07ab947afba10aaebfc92beded975658055ef593df5a4833dbf39e1cdaa604f2896a4333c07bf150505b512489b09e885b14f8c5448c65210c20f20f20b0619
|
7
|
+
data.tar.gz: 5e6b24830af44b5d0b578ea321ebe18b7c990ae4cc43075917edc1e2b71ab40c970402386c20a8d80a8b95ceb8e1ea70bb4948400908cc7243aa05fddde32e16
|
data/Gemfile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
6
|
|
5
7
|
# Specify your gem's dependencies in capital_on_tap.gemspec
|
6
8
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capital_on_tap (0.1.
|
4
|
+
capital_on_tap (0.1.5)
|
5
5
|
addressable
|
6
6
|
faraday
|
7
7
|
faraday_middleware
|
@@ -13,6 +13,7 @@ GEM
|
|
13
13
|
specs:
|
14
14
|
addressable (2.7.0)
|
15
15
|
public_suffix (>= 2.0.2, < 5.0)
|
16
|
+
ast (2.4.0)
|
16
17
|
byebug (11.0.1)
|
17
18
|
coderay (1.1.2)
|
18
19
|
diff-lcs (1.3)
|
@@ -21,9 +22,13 @@ GEM
|
|
21
22
|
multipart-post (>= 1.2, < 3)
|
22
23
|
faraday_middleware (0.13.1)
|
23
24
|
faraday (>= 0.7.4, < 1.0)
|
25
|
+
jaro_winkler (1.5.4)
|
24
26
|
method_source (0.9.2)
|
25
|
-
multi_json (1.
|
27
|
+
multi_json (1.14.1)
|
26
28
|
multipart-post (2.1.1)
|
29
|
+
parallel (1.19.0)
|
30
|
+
parser (2.6.5.0)
|
31
|
+
ast (~> 2.4.0)
|
27
32
|
pry (0.12.2)
|
28
33
|
coderay (~> 1.1.0)
|
29
34
|
method_source (~> 0.9.0)
|
@@ -46,6 +51,17 @@ GEM
|
|
46
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
52
|
rspec-support (~> 3.8.0)
|
48
53
|
rspec-support (3.8.2)
|
54
|
+
rubocop (0.76.0)
|
55
|
+
jaro_winkler (~> 1.5.1)
|
56
|
+
parallel (~> 1.10)
|
57
|
+
parser (>= 2.6)
|
58
|
+
rainbow (>= 2.2.2, < 4.0)
|
59
|
+
ruby-progressbar (~> 1.7)
|
60
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
61
|
+
rubocop-rspec (1.36.0)
|
62
|
+
rubocop (>= 0.68.1)
|
63
|
+
ruby-progressbar (1.10.1)
|
64
|
+
unicode-display_width (1.6.0)
|
49
65
|
|
50
66
|
PLATFORMS
|
51
67
|
ruby
|
@@ -57,6 +73,8 @@ DEPENDENCIES
|
|
57
73
|
pry-byebug
|
58
74
|
rake (~> 10.0)
|
59
75
|
rspec (~> 3.0)
|
76
|
+
rubocop
|
77
|
+
rubocop-rspec
|
60
78
|
|
61
79
|
BUNDLED WITH
|
62
80
|
2.0.2
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -18,38 +18,36 @@ end
|
|
18
18
|
|
19
19
|
CapitalOnTap.setup_connection!
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
end
|
21
|
+
TEST_PARAMS = {
|
22
|
+
Salutation: 'Mr',
|
23
|
+
FirstName: 'Roberto',
|
24
|
+
LastName: 'Caras',
|
25
|
+
DateOfBirth: Date.parse("1980-#{rand(1..12)}-#{rand(1..28)}"),
|
26
|
+
MobilePhone: "077123456#{rand(11..99)}",
|
27
|
+
EmailAddress: "oterosantos_#{rand(1..100)}@gmail.com",
|
28
|
+
PersonalAddress: {
|
29
|
+
CountryCode: 'UK',
|
30
|
+
Street: "Unit #{rand(1..99)} Falcon Way Adelaide Industrial Estate, Boucher Road",
|
31
|
+
PostCode: 'BT12 6SQ',
|
32
|
+
City: 'Belfast'
|
33
|
+
},
|
34
|
+
TradingName: 'DUNDER MCMIFFLIN LTD',
|
35
|
+
BusinessLegalName: 'DUNDER MCMIFFLIN LTD',
|
36
|
+
BusinessLandline: '07874186570',
|
37
|
+
YearsTrading: rand(1..10),
|
38
|
+
MonthlyTurnOver: rand(300...9000),
|
39
|
+
BusinessType: 'LimitedCompany',
|
40
|
+
BusinessAddress: {
|
41
|
+
CountryCode: 'UK',
|
42
|
+
Street: "Unit #{rand(1..99)} Falcon Way Adelaide Industrial Estate, Boucher Road",
|
43
|
+
PostCode: 'BT12 6SQ',
|
44
|
+
City: 'Belfast'
|
45
|
+
},
|
46
|
+
RegistrationNumber: 'NI644403'
|
47
|
+
}.freeze
|
50
48
|
|
51
49
|
def generate_code
|
52
|
-
CapitalOnTap::Application.create(
|
50
|
+
CapitalOnTap::Application.create(TEST_PARAMS)
|
53
51
|
end
|
54
52
|
|
55
53
|
require 'pry'
|
data/capital_on_tap.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'capital_on_tap/version'
|
6
6
|
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
-
spec.files = Dir.chdir(File.expand_path(
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
21
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
22
|
end
|
23
23
|
spec.bindir = 'exe'
|
@@ -31,8 +31,10 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency 'rainbow'
|
32
32
|
|
33
33
|
spec.add_development_dependency 'bundler'
|
34
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
35
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
34
|
spec.add_development_dependency 'dotenv'
|
37
35
|
spec.add_development_dependency 'pry-byebug'
|
36
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
37
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
38
|
+
spec.add_development_dependency 'rubocop'
|
39
|
+
spec.add_development_dependency 'rubocop-rspec'
|
38
40
|
end
|
data/lib/capital_on_tap.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module CapitalOnTap
|
4
4
|
class Application
|
5
|
-
SALUTATIONS = %w[Mr Mrs Miss Ms Dr]
|
5
|
+
SALUTATIONS = %w[Mr Mrs Miss Ms Dr].freeze
|
6
6
|
|
7
7
|
BUSINESS_TYPES = %w[SoleTrader Partnership LimitedCompany LimitedLiabilityPartnership].freeze
|
8
8
|
|
@@ -31,9 +31,9 @@ module CapitalOnTap
|
|
31
31
|
BusinessLegalName: 'Glamour Bikinis And Clothing Boutique Limited',
|
32
32
|
BusinessLandline: '07874186570',
|
33
33
|
YearsTrading: 8,
|
34
|
-
MonthlyTurnOver:
|
34
|
+
MonthlyTurnOver: 10_000,
|
35
35
|
BusinessType: 'LimitedCompany',
|
36
|
-
RegistrationNumber:
|
36
|
+
RegistrationNumber: 10_322_035,
|
37
37
|
BusinessAddress: {},
|
38
38
|
PromoCode: nil,
|
39
39
|
OnPasteEventFields: nil,
|
@@ -41,10 +41,10 @@ module CapitalOnTap
|
|
41
41
|
GoogleSessionId: nil,
|
42
42
|
PartnerCode: nil,
|
43
43
|
ExternalReference: nil,
|
44
|
-
RestrictedCountries:false,
|
45
|
-
RequestedCredit:
|
44
|
+
RestrictedCountries: false,
|
45
|
+
RequestedCredit: 10_000,
|
46
46
|
ApplicationGuid: nil
|
47
|
-
}
|
47
|
+
}.freeze
|
48
48
|
|
49
49
|
# Create a new application with the given parameters
|
50
50
|
# Example JSON:
|
data/lib/capital_on_tap/auth.rb
CHANGED
@@ -18,8 +18,8 @@ module CapitalOnTap
|
|
18
18
|
new.refresh_token(refresh_token)
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.
|
22
|
-
new.
|
21
|
+
def self.obtain_token
|
22
|
+
new.obtain_token
|
23
23
|
end
|
24
24
|
|
25
25
|
# Requests a new token. The response will be something like:
|
@@ -31,7 +31,7 @@ module CapitalOnTap
|
|
31
31
|
# expires_in: 1200,
|
32
32
|
# refresh_token: '<refresh_token>'
|
33
33
|
# }
|
34
|
-
def
|
34
|
+
def obtain_token
|
35
35
|
client = Faraday.new(url: config.base_auth_url) do |conn|
|
36
36
|
conn.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
37
37
|
conn.response :logger if config.debug?
|
@@ -8,12 +8,12 @@ module CapitalOnTap
|
|
8
8
|
AUTH_DOMAINS = {
|
9
9
|
production: 'https://api-auth.capitalontap.com',
|
10
10
|
development: 'https://prelive-api-auth.capitalontap.com'
|
11
|
-
}
|
11
|
+
}.freeze
|
12
12
|
|
13
13
|
API_DOMAINS = {
|
14
14
|
production: 'https://api-partner.capitalontap.com',
|
15
15
|
development: 'https://prelive-api-partner.capitalontap.com'
|
16
|
-
}
|
16
|
+
}.freeze
|
17
17
|
|
18
18
|
def initialize
|
19
19
|
@client_id = ''
|
@@ -29,11 +29,11 @@ module CapitalOnTap
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def base_auth_url
|
32
|
-
AUTH_DOMAINS[@env.to_sym]
|
32
|
+
AUTH_DOMAINS[@env.to_sym] || AUTH_DOMAINS[:development]
|
33
33
|
end
|
34
34
|
|
35
35
|
def base_url
|
36
|
-
API_DOMAINS[@env.to_sym]
|
36
|
+
API_DOMAINS[@env.to_sym] || API_DOMAINS[:development]
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -62,7 +62,7 @@ module CapitalOnTap
|
|
62
62
|
|
63
63
|
def adapter
|
64
64
|
Faraday.new(url: base_url) do |conn|
|
65
|
-
conn.headers['Authorization'] = "Bearer #{@access_token}"
|
65
|
+
conn.headers['Authorization'] = "Bearer #{@access_token}" unless @access_token.to_s.empty?
|
66
66
|
conn.headers['Content-Type'] = 'application/json'
|
67
67
|
conn.use FaradayMiddleware::ParseJson
|
68
68
|
conn.response :json, parser_options: { symbolize_names: true }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rikas
|
@@ -94,6 +94,34 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: dotenv
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: rake
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +151,7 @@ dependencies:
|
|
123
151
|
- !ruby/object:Gem::Version
|
124
152
|
version: '3.0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
154
|
+
name: rubocop
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
157
|
- - ">="
|
@@ -137,7 +165,7 @@ dependencies:
|
|
137
165
|
- !ruby/object:Gem::Version
|
138
166
|
version: '0'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
168
|
+
name: rubocop-rspec
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
142
170
|
requirements:
|
143
171
|
- - ">="
|