capital_on_tap 0.1.0
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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +31 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +62 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +22 -0
- data/bin/setup +8 -0
- data/capital_on_tap.gemspec +38 -0
- data/lib/capital_on_tap.rb +32 -0
- data/lib/capital_on_tap/application.rb +82 -0
- data/lib/capital_on_tap/auth.rb +65 -0
- data/lib/capital_on_tap/configuration.rb +27 -0
- data/lib/capital_on_tap/connection.rb +71 -0
- data/lib/capital_on_tap/response.rb +9 -0
- data/lib/capital_on_tap/version.rb +5 -0
- metadata +203 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5ee93206500bbc4d766b102842c5abd719fc96824d78d959e851610516459266
|
4
|
+
data.tar.gz: faa9a13f0c6640d4806991c4a5ff9a5dca7d9a151f591c25e9f6fa568c787b8a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0a18e9adb4ddf3844601138acfbde65d6fa0d73f1853504742b40c7787fdc599b0236895ed5c1a7e7a02c1be76f2e1ef1f07690c12cd6c72f89d7df1490f9fd8
|
7
|
+
data.tar.gz: 34b80be737a174048ea8d2473bdf5d29080702c558a58c245eec10627171dc705eea76cf6dd55d01c8fa52b8bdfb34a40fa8178aef2470d51f17e2290a1c7a4d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.5.1
|
5
|
+
|
6
|
+
# Don't force top level comments in every class
|
7
|
+
Style/Documentation:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
# A good line length is 100 chars
|
11
|
+
Metrics/LineLength:
|
12
|
+
Max: 100
|
13
|
+
AllowURI: true
|
14
|
+
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/ClassLength:
|
19
|
+
Max: 300
|
20
|
+
|
21
|
+
Metrics/MethodLength:
|
22
|
+
Max: 20
|
23
|
+
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Max: 30
|
26
|
+
|
27
|
+
RSpec/ExampleLength:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
RSpec/MultipleExpectations:
|
31
|
+
Max: 10
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capital_on_tap (0.1.0)
|
5
|
+
addressable
|
6
|
+
faraday
|
7
|
+
faraday_middleware
|
8
|
+
multi_json
|
9
|
+
rainbow
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
addressable (2.5.2)
|
15
|
+
public_suffix (>= 2.0.2, < 4.0)
|
16
|
+
byebug (10.0.2)
|
17
|
+
coderay (1.1.2)
|
18
|
+
diff-lcs (1.3)
|
19
|
+
dotenv (2.5.0)
|
20
|
+
faraday (0.15.3)
|
21
|
+
multipart-post (>= 1.2, < 3)
|
22
|
+
faraday_middleware (0.12.2)
|
23
|
+
faraday (>= 0.7.4, < 1.0)
|
24
|
+
method_source (0.9.0)
|
25
|
+
multi_json (1.13.1)
|
26
|
+
multipart-post (2.0.0)
|
27
|
+
pry (0.11.3)
|
28
|
+
coderay (~> 1.1.0)
|
29
|
+
method_source (~> 0.9.0)
|
30
|
+
pry-byebug (3.6.0)
|
31
|
+
byebug (~> 10.0)
|
32
|
+
pry (~> 0.10)
|
33
|
+
public_suffix (3.0.3)
|
34
|
+
rainbow (3.0.0)
|
35
|
+
rake (10.5.0)
|
36
|
+
rspec (3.8.0)
|
37
|
+
rspec-core (~> 3.8.0)
|
38
|
+
rspec-expectations (~> 3.8.0)
|
39
|
+
rspec-mocks (~> 3.8.0)
|
40
|
+
rspec-core (3.8.0)
|
41
|
+
rspec-support (~> 3.8.0)
|
42
|
+
rspec-expectations (3.8.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.8.0)
|
45
|
+
rspec-mocks (3.8.0)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.8.0)
|
48
|
+
rspec-support (3.8.0)
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
bundler (~> 1.16)
|
55
|
+
capital_on_tap!
|
56
|
+
dotenv
|
57
|
+
pry-byebug
|
58
|
+
rake (~> 10.0)
|
59
|
+
rspec (~> 3.0)
|
60
|
+
|
61
|
+
BUNDLED WITH
|
62
|
+
1.16.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 rikas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# CapitalOnTap
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/capital_on_tap`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'capital_on_tap'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install capital_on_tap
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/capital_on_tap.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'capital_on_tap'
|
6
|
+
|
7
|
+
require 'dotenv'
|
8
|
+
Dotenv.load
|
9
|
+
|
10
|
+
CapitalOnTap.configure do |config|
|
11
|
+
config.client_id = ENV['CLIENT_ID']
|
12
|
+
config.client_secret = ENV['CLIENT_SECRET']
|
13
|
+
config.username = ENV['USERNAME']
|
14
|
+
config.password = ENV['PASSWORD']
|
15
|
+
config.debug = true
|
16
|
+
end
|
17
|
+
|
18
|
+
token_params = CapitalOnTap::Auth.get_token
|
19
|
+
CapitalOnTap.setup_connection(token_params)
|
20
|
+
|
21
|
+
require 'pry'
|
22
|
+
Pry.start
|
data/bin/setup
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'capital_on_tap/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'capital_on_tap'
|
9
|
+
spec.version = CapitalOnTap::VERSION
|
10
|
+
spec.authors = ['rikas']
|
11
|
+
spec.email = ['oterosantos@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'Capital on Tap API wrapper'
|
14
|
+
spec.description = spec.summary
|
15
|
+
spec.homepage = 'https://gitlab.com/finpoint/capital-on-tap'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
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
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_dependency 'addressable'
|
28
|
+
spec.add_dependency 'faraday'
|
29
|
+
spec.add_dependency 'faraday_middleware'
|
30
|
+
spec.add_dependency 'multi_json'
|
31
|
+
spec.add_dependency 'rainbow'
|
32
|
+
|
33
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
34
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
35
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
|
+
spec.add_development_dependency 'dotenv'
|
37
|
+
spec.add_development_dependency 'pry-byebug'
|
38
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'capital_on_tap/version'
|
4
|
+
require 'capital_on_tap/configuration'
|
5
|
+
require 'capital_on_tap/connection'
|
6
|
+
require 'capital_on_tap/auth'
|
7
|
+
|
8
|
+
module CapitalOnTap
|
9
|
+
module_function
|
10
|
+
|
11
|
+
def configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def connection
|
16
|
+
@connection
|
17
|
+
end
|
18
|
+
|
19
|
+
def configure
|
20
|
+
yield(configuration)
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_connection(params = {})
|
24
|
+
raise "ERROR: #{params[:error_description]}" if params[:error]
|
25
|
+
|
26
|
+
@connection = Connection.new(
|
27
|
+
access_token: params[:access_token],
|
28
|
+
expires_in: params[:expires_in],
|
29
|
+
refresh_token: params[:refresh_token]
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CapitalOnTap
|
4
|
+
class Application
|
5
|
+
SALUTATIONS = %w[Mr Mrs Miss Ms Dr]
|
6
|
+
|
7
|
+
BUSINESS_TYPES = %w[SoleTrader Partnership LimitedCompany LimitedLiabilityPartnership].freeze
|
8
|
+
|
9
|
+
attr_accessor :salutation, :first_name, :middle_name, :last_name, :date_of_birth, :mobile_phone
|
10
|
+
attr_accessor :home_phone, :email_address, :customer_uses_personal_bank_account_for_business
|
11
|
+
attr_accessor :monthly_income, :monthly_expenditure, :personal_address
|
12
|
+
attr_accessor :trading_name, :business_legal_name, :business_land_line, :years_trading
|
13
|
+
attr_accessor :monthly_turn_over, :business_type, :registration_number, :business_address
|
14
|
+
attr_accessor :promo_code, :on_paste_event_fields, :montly_business_expenditure
|
15
|
+
attr_accessor :external_reference, :partner_code, :restricted_countries, :requested_credit
|
16
|
+
|
17
|
+
# Create a new application with the given parameters
|
18
|
+
# Example JSON:
|
19
|
+
# {
|
20
|
+
# "salutation": "Mr",
|
21
|
+
# "firstName": "Joe",
|
22
|
+
# "middleName": "Fred",
|
23
|
+
# "lastName": "Bloggs",
|
24
|
+
# "dateOfBirth": "1970-02-15",
|
25
|
+
# "mobilePhone": "07700900408",
|
26
|
+
# "homePhone": "02079460794",
|
27
|
+
# "emailAddress": "joe.bloggs@mail.com",
|
28
|
+
# "customerUsesPersonalBankAccountforBusiness": true,
|
29
|
+
# "monthlyIncome": "3000",
|
30
|
+
# "monthlyExpenditure": "2000",
|
31
|
+
#
|
32
|
+
# "personalAddress": {
|
33
|
+
# "company" : ""
|
34
|
+
# "buildingName": "Home Building",
|
35
|
+
# "buildingNumber": "123",
|
36
|
+
# "unitNumber": "A",
|
37
|
+
# "street": "Home Street",
|
38
|
+
# "city": "London",
|
39
|
+
# "postCode": "W123456",
|
40
|
+
# "countryCode": "UK",
|
41
|
+
# "line1":"PostApplication",
|
42
|
+
# "line2":null
|
43
|
+
# },
|
44
|
+
#
|
45
|
+
# "tradingName": "Joe Bloggs Ltd",
|
46
|
+
# "businessLegalName": "Joe Bloggs Ltd",
|
47
|
+
# "businessLandline": "02079460182",
|
48
|
+
# "yearsTrading": "5",
|
49
|
+
# "monthlyTurnOver": "10000",
|
50
|
+
# "businessType": "SoleTrader",
|
51
|
+
# "registrationNumber": "12345678",
|
52
|
+
#
|
53
|
+
# "businessAddress": {
|
54
|
+
# "company" : null,
|
55
|
+
# "buildingName": "Business Building",
|
56
|
+
# "buildingNumber": "123",
|
57
|
+
# "unitNumber": "A",
|
58
|
+
# "street": "Business Street",
|
59
|
+
# "city": "London",
|
60
|
+
# "postCode": "W123456",
|
61
|
+
# "countryCode": "UK",
|
62
|
+
# "line1":"PostApplication",
|
63
|
+
# "line2":null
|
64
|
+
# },
|
65
|
+
# "promoCode": "ExampleCode",
|
66
|
+
# "onPasteEventFields": "firstName",
|
67
|
+
# "monthlyBusinessExpenditure": "5000",
|
68
|
+
# "externalReference": "ExampleAccountNumber",
|
69
|
+
# "partnerCode":null,
|
70
|
+
# "restrictedCountries":false,
|
71
|
+
# "requestedCredit":10000,
|
72
|
+
# }
|
73
|
+
def self.create(params)
|
74
|
+
response = CapitalOnTap.connection.post('/Applications', params)
|
75
|
+
response
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.status(locator_id)
|
79
|
+
CapitalOnTap.connection.get("/Applications/#{locator_id}")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'multi_json'
|
4
|
+
require 'faraday'
|
5
|
+
require 'faraday_middleware'
|
6
|
+
require 'addressable'
|
7
|
+
|
8
|
+
module CapitalOnTap
|
9
|
+
class Auth
|
10
|
+
extend Forwardable
|
11
|
+
|
12
|
+
TOKEN_PATH = '/connect/token'
|
13
|
+
DEFAULT_GRANT_TYPE = 'password'
|
14
|
+
|
15
|
+
def_delegators :@configuration, :client_id, :client_secret, :username, :password
|
16
|
+
|
17
|
+
def self.refresh_token(refresh_token)
|
18
|
+
new.refresh_token(refresh_token)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get_token
|
22
|
+
new.get_token
|
23
|
+
end
|
24
|
+
|
25
|
+
# Requests a new token. The response will be something like:
|
26
|
+
#
|
27
|
+
# {
|
28
|
+
# scope: 'profile offline_access',
|
29
|
+
# token_type: 'Bearer',
|
30
|
+
# access_token: '<access_token>',
|
31
|
+
# expires_in: 1200,
|
32
|
+
# refresh_token: '<refresh_token>'
|
33
|
+
# }
|
34
|
+
def get_token
|
35
|
+
client = Faraday.new(url: config.base_url) do |conn|
|
36
|
+
conn.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
37
|
+
conn.response :logger if config.debug?
|
38
|
+
conn.adapter Faraday.default_adapter
|
39
|
+
end
|
40
|
+
|
41
|
+
result = client.post do |req|
|
42
|
+
req.url TOKEN_PATH
|
43
|
+
req.body = URI.encode_www_form(token_params)
|
44
|
+
end
|
45
|
+
|
46
|
+
MultiJson.load(result.body, symbolize_keys: true)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def config
|
52
|
+
CapitalOnTap.configuration
|
53
|
+
end
|
54
|
+
|
55
|
+
def token_params
|
56
|
+
{
|
57
|
+
client_id: config.client_id,
|
58
|
+
client_secret: config.client_secret,
|
59
|
+
grant_type: DEFAULT_GRANT_TYPE,
|
60
|
+
username: config.username,
|
61
|
+
password: config.password
|
62
|
+
}
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CapitalOnTap
|
4
|
+
class Configuration
|
5
|
+
attr_accessor :client_id, :client_secret, :username, :password, :env
|
6
|
+
attr_writer :debug
|
7
|
+
|
8
|
+
DEFAULT_DOMAIN = 'https://prelive-api-auth.capitalontap.com'
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@client_id = ''
|
12
|
+
@client_secret = ''
|
13
|
+
@username = ''
|
14
|
+
@password = ''
|
15
|
+
@env = :development
|
16
|
+
@debug = false
|
17
|
+
end
|
18
|
+
|
19
|
+
def debug?
|
20
|
+
@debug
|
21
|
+
end
|
22
|
+
|
23
|
+
def base_url
|
24
|
+
DEFAULT_DOMAIN
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
5
|
+
require 'rainbow'
|
6
|
+
require 'addressable'
|
7
|
+
|
8
|
+
require 'capital_on_tap/response'
|
9
|
+
|
10
|
+
module CapitalOnTap
|
11
|
+
class Connection
|
12
|
+
attr_accessor :debug, :access_token, :expires_in, :refresh_token
|
13
|
+
|
14
|
+
# This is a block to be run when the token is refreshed. This way you can do whatever you want
|
15
|
+
# with the new parameters returned by the refresh method.
|
16
|
+
attr_accessor :on_refresh_cb
|
17
|
+
|
18
|
+
BASE_PATH = '/api/v1/'
|
19
|
+
|
20
|
+
def initialize(access_token:, expires_in: 1200, refresh_token: nil)
|
21
|
+
@access_token = access_token
|
22
|
+
@expires_in = expires_in
|
23
|
+
@refresh_token ||= refresh_token # do not overwrite if it's already set
|
24
|
+
end
|
25
|
+
|
26
|
+
def get(path, params = {})
|
27
|
+
log "GET #{path} with #{params}"
|
28
|
+
|
29
|
+
http_reponse = adapter.get(path, params)
|
30
|
+
|
31
|
+
response = Response.new(http_response)
|
32
|
+
response.body
|
33
|
+
end
|
34
|
+
|
35
|
+
def post(path, params = {})
|
36
|
+
log "POST #{path} with #{params}"
|
37
|
+
|
38
|
+
http_reponse = adapter.post(path, params)
|
39
|
+
|
40
|
+
response = Response.new(http_response)
|
41
|
+
response.body
|
42
|
+
end
|
43
|
+
|
44
|
+
def log(text)
|
45
|
+
return unless CapitalOnTap.configuration.debug?
|
46
|
+
|
47
|
+
puts Rainbow("[CapitalOnTap] #{text}").magenta.bright
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def base_url
|
53
|
+
Addressable::URI.join(CapitalOnTap.configuration.base_url, BASE_PATH).to_s
|
54
|
+
end
|
55
|
+
|
56
|
+
# The authorization header that must be added to every request for authorized requests.
|
57
|
+
def authorization_header
|
58
|
+
{ 'Authorization' => "Bearer #{@access_token}" }
|
59
|
+
end
|
60
|
+
|
61
|
+
def adapter
|
62
|
+
Faraday.new(url: base_url) do |conn|
|
63
|
+
conn.headers = authorization_header if !@access_token.to_s.empty?
|
64
|
+
conn.use FaradayMiddleware::ParseJson
|
65
|
+
conn.response :json, parser_options: { symbolize_names: true }
|
66
|
+
conn.response :logger if CapitalOnTap.configuration.debug?
|
67
|
+
conn.adapter Faraday.default_adapter
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capital_on_tap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- rikas
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: addressable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday_middleware
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: multi_json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rainbow
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.16'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.16'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: dotenv
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry-byebug
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: Capital on Tap API wrapper
|
154
|
+
email:
|
155
|
+
- oterosantos@gmail.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".gitignore"
|
161
|
+
- ".rspec"
|
162
|
+
- ".rubocop.yml"
|
163
|
+
- ".travis.yml"
|
164
|
+
- Gemfile
|
165
|
+
- Gemfile.lock
|
166
|
+
- LICENSE.txt
|
167
|
+
- README.md
|
168
|
+
- Rakefile
|
169
|
+
- bin/console
|
170
|
+
- bin/setup
|
171
|
+
- capital_on_tap.gemspec
|
172
|
+
- lib/capital_on_tap.rb
|
173
|
+
- lib/capital_on_tap/application.rb
|
174
|
+
- lib/capital_on_tap/auth.rb
|
175
|
+
- lib/capital_on_tap/configuration.rb
|
176
|
+
- lib/capital_on_tap/connection.rb
|
177
|
+
- lib/capital_on_tap/response.rb
|
178
|
+
- lib/capital_on_tap/version.rb
|
179
|
+
homepage: https://gitlab.com/finpoint/capital-on-tap
|
180
|
+
licenses:
|
181
|
+
- MIT
|
182
|
+
metadata: {}
|
183
|
+
post_install_message:
|
184
|
+
rdoc_options: []
|
185
|
+
require_paths:
|
186
|
+
- lib
|
187
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
requirements: []
|
198
|
+
rubyforge_project:
|
199
|
+
rubygems_version: 2.7.6
|
200
|
+
signing_key:
|
201
|
+
specification_version: 4
|
202
|
+
summary: Capital on Tap API wrapper
|
203
|
+
test_files: []
|