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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff304abb175e93a841c01589d25435e3f8b6528930ea343220f2d212037c1512
4
- data.tar.gz: 191e56331d8a27a8598e79571316713e48390a8bce5a9b86221a4e8654f37ea7
3
+ metadata.gz: 3183097cf91d6bddb3da967e9f7922ac6a2cca30b898b5f72b363b7ee3bb8957
4
+ data.tar.gz: d360e41c71415ef5b689ff9f5968017b00a52c3e963e06b0f2d4e2f9e276fd74
5
5
  SHA512:
6
- metadata.gz: b9ff711519ecfa374a4570fe8b7766faee184bdf156ede7d5f2376d157ca51de33c61c0426ab7879b2afbfbd21908263ea24b9ab0f2ef6d21a02847bc2093016
7
- data.tar.gz: 75e6517a653a7cf19c401c3a0e6958b629f7c954eadd9f31bb5c0890235606f1fd3ee5c93a0e7098c86dd58d3aae89a791f962b9e43d09c278c53d7d15a150f2
6
+ metadata.gz: a07ab947afba10aaebfc92beded975658055ef593df5a4833dbf39e1cdaa604f2896a4333c07bf150505b512489b09e885b14f8c5448c65210c20f20f20b0619
7
+ data.tar.gz: 5e6b24830af44b5d0b578ea321ebe18b7c990ae4cc43075917edc1e2b71ab40c970402386c20a8d80a8b95ceb8e1ea70bb4948400908cc7243aa05fddde32e16
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
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)
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.13.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
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/bin/console CHANGED
@@ -18,38 +18,36 @@ end
18
18
 
19
19
  CapitalOnTap.setup_connection!
20
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
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(generate_params)
50
+ CapitalOnTap::Application.create(TEST_PARAMS)
53
51
  end
54
52
 
55
53
  require 'pry'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
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('..', __FILE__)) do
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
@@ -22,7 +22,7 @@ module CapitalOnTap
22
22
  end
23
23
 
24
24
  def setup_connection!
25
- token_params = CapitalOnTap::Auth.get_token
25
+ token_params = CapitalOnTap::Auth.obtain_token
26
26
 
27
27
  raise "ERROR: #{token_params[:error_description]}" if token_params[:error]
28
28
 
@@ -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: 10000,
34
+ MonthlyTurnOver: 10_000,
35
35
  BusinessType: 'LimitedCompany',
36
- RegistrationNumber: 10322035,
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: 10000,
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:
@@ -18,8 +18,8 @@ module CapitalOnTap
18
18
  new.refresh_token(refresh_token)
19
19
  end
20
20
 
21
- def self.get_token
22
- new.get_token
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 get_token
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}" if !@access_token.to_s.empty?
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 }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CapitalOnTap
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
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
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: dotenv
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: pry-byebug
168
+ name: rubocop-rspec
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
171
  - - ">="