gman_client 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.rubocop.yml +9 -0
- data/.simplecov +3 -0
- data/.travis.yml +14 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +1 -0
- data/gman_client.gemspec +29 -0
- data/lib/gman_client/version.rb +4 -0
- data/lib/gman_client.rb +77 -0
- data/pkg/gman_client-0.0.1.gem +0 -0
- data/pkg/gman_client-0.0.2.gem +0 -0
- data/pkg/gman_client-0.0.3.gem +0 -0
- data/pkg/gman_client-0.0.4.gem +0 -0
- data/pkg/gman_client-0.0.5.gem +0 -0
- data/spec/lib/driver_commission_history_response_spec.rb +92 -0
- data/spec/lib/driver_response_spec.rb +35 -0
- data/spec/lib/inventory_item_response_spec.rb +87 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/support/gman_adapter.rb +14 -0
- data/spec/support/vcr.rb +23 -0
- data/spec/vcr_cassettes/driver_commission_histories.yml +127 -0
- data/spec/vcr_cassettes/driver_commission_histories_by_paid_date.yml +127 -0
- data/spec/vcr_cassettes/drivers.yml +87 -0
- data/spec/vcr_cassettes/inventory_items.yml +87 -0
- data/spec/vcr_cassettes/inventory_items_by_id.yml +87 -0
- data/spec/vcr_cassettes/inventory_items_like_id_description.yml +87 -0
- metadata +199 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57faaa3feff67f2e167a5ca07d212253cf6546ff
|
4
|
+
data.tar.gz: f42a9cb5c4fe3a6bf881ca301e745ea556e58d47
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c8f6a583e53b03b85669e46c62f5a31adc6263d4d98f51eb83faad8b8d4adb7e7bf62ecf946ca951418ae6ec143513733a0ebb4bd16dd30341ff7e9b1d51c7d
|
7
|
+
data.tar.gz: f916a6ca562bd24d77f2caf23288efa235d69c28ec86dc065dc001e8c3194ec8421d2121b695369dad6f1685820ff3098dc10e2b68eddf19ecf1bb3d1bd3e0a6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.simplecov
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
rvm:
|
4
|
+
- "2.1.5"
|
5
|
+
- ruby-head
|
6
|
+
script:
|
7
|
+
- export WRAP_URL='http://localhost:3000'
|
8
|
+
- export CLIENT_ID='f444a467ddbbaed52297d61a3edc5efd93e9292fc542058786aa13fa366865a3'
|
9
|
+
- export CLIENT_SECRET='d137a94543da86e52214d3ed86b015f9299ad2fc66681637600afad814cd7d2b'
|
10
|
+
- export TOKEN_URL='http://localhost:3000/oauth/token'
|
11
|
+
- bundle exec rspec -fd
|
12
|
+
matrix:
|
13
|
+
allow_failures:
|
14
|
+
- rvm: ruby-head
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 MichaelAChrisco
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/westernmilling/gman_client.svg?branch=master)](https://travis-ci.org/westernmilling/gman_client) [![Coverage Status](https://coveralls.io/repos/westernmilling/gman_client/badge.svg)](https://coveralls.io/r/westernmilling/gman_client)
|
2
|
+
# GmanClient
|
3
|
+
|
4
|
+
Gem hooks into the Grossman API.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'gman_client', :git => 'git@github.com:michaelachrisco/gman_client.git'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Make sure to include:
|
19
|
+
* WRAP_URL: This URL is the url for the api. Example ```export WRAP_URL="http://example.com"```
|
20
|
+
* CLIENT_ID: Doorkeeper App ID. Example: ```export CLIENT_ID="1234567"```
|
21
|
+
* CLIENT_SECRET: Doorkeeper App Secret. Example: ```export CLIENT_SECRET="1234567"```
|
22
|
+
* TOKEN_URL: URL for token. Example: ```export TOKEN_URL="http://example.com/oauth/token"```
|
23
|
+
|
24
|
+
Or initialize:
|
25
|
+
```Ruby
|
26
|
+
gman = Gman::Client.new(:url => "http://example.com",
|
27
|
+
:token_url => "1234567",
|
28
|
+
:client_id => "1234567",
|
29
|
+
:client_secret => "http://example.com/oauth/token"
|
30
|
+
)
|
31
|
+
```
|
32
|
+
|
33
|
+
How to use:
|
34
|
+
```Ruby
|
35
|
+
gman.drivers
|
36
|
+
gman.driver_commission_histories
|
37
|
+
gman.driver_commission_histories_by_paid_date(DATE.new())
|
38
|
+
```
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
1. Fork it ( https://github.com/michaelachrisco/gman_client/fork )
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/gman_client.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gman_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'gman_client'
|
8
|
+
spec.version = GmanClient::VERSION
|
9
|
+
spec.authors = ['MichaelAChrisco', 'josephbridgwaterrowe']
|
10
|
+
spec.email = ['michaelachrisco@gmail.com']
|
11
|
+
spec.summary = 'GMAN gem client'
|
12
|
+
spec.description = 'GMAN gem client for Grossman API'
|
13
|
+
spec.homepage = 'https://github.com/michaelachrisco/gman_client'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
spec.add_runtime_dependency 'vcr'
|
21
|
+
spec.add_runtime_dependency 'webmock'
|
22
|
+
spec.add_dependency 'blanket_wrapper'
|
23
|
+
spec.add_dependency 'rest-client'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec'
|
27
|
+
spec.add_development_dependency 'rspec-its'
|
28
|
+
|
29
|
+
end
|
data/lib/gman_client.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'gman_client/version'
|
2
|
+
require 'rest_client'
|
3
|
+
require 'json'
|
4
|
+
require 'blanket'
|
5
|
+
|
6
|
+
# GmanClient
|
7
|
+
module Gman
|
8
|
+
# grossman +client+ object
|
9
|
+
class Client
|
10
|
+
attr_accessor :url, :token_url, :client_id, :client_secret
|
11
|
+
def initialize(options = {})
|
12
|
+
@url = options[:url] || ENV['WRAP_URL']
|
13
|
+
@token_url = options[:token_url] || ENV['TOKEN_URL']
|
14
|
+
@client_id = options[:client_id] || ENV['CLIENT_ID']
|
15
|
+
@client_secret = options[:client_secret] || ENV['CLIENT_SECRET']
|
16
|
+
end
|
17
|
+
# class << self
|
18
|
+
|
19
|
+
def drivers
|
20
|
+
response = request.api.v1.drivers.get
|
21
|
+
convert_payload(response)
|
22
|
+
end
|
23
|
+
|
24
|
+
def driver_commission_histories
|
25
|
+
response = request.api.v1.driver_commissions_history.get
|
26
|
+
convert_payload(response)
|
27
|
+
end
|
28
|
+
|
29
|
+
def driver_commission_histories_by_paid_date(paid_date)
|
30
|
+
response = request.api.v1.driver_commissions_history_by_paid_date
|
31
|
+
.get(:params => { :paid_date => paid_date })
|
32
|
+
convert_payload(response)
|
33
|
+
end
|
34
|
+
|
35
|
+
def inventory_items
|
36
|
+
response = request.api.v1.inventory.items.get
|
37
|
+
convert_payload(response)
|
38
|
+
end
|
39
|
+
|
40
|
+
def inventory_items_like_id_description(item_id, in_item_description)
|
41
|
+
response = request.api.v1.inventory.items_like_id_description
|
42
|
+
.get(:params => { :item_id => item_id,
|
43
|
+
:in_item_description => in_item_description }
|
44
|
+
)
|
45
|
+
convert_payload(response)
|
46
|
+
end
|
47
|
+
|
48
|
+
def inventory_items_by_id(item_id)
|
49
|
+
response = request.api.v1.inventory.items_by_id
|
50
|
+
.get(:params => { :item_id => item_id })
|
51
|
+
convert_payload(response)
|
52
|
+
end
|
53
|
+
|
54
|
+
def request
|
55
|
+
token = retrieve_token
|
56
|
+
Blanket.wrap(@url.dup,
|
57
|
+
:extension => :json,
|
58
|
+
:headers => {
|
59
|
+
'Authorization' => "Bearer #{token}" }
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
def retrieve_token
|
64
|
+
response = RestClient.post @token_url.dup,
|
65
|
+
:grant_type => 'client_credentials',
|
66
|
+
:client_id => @client_id.dup,
|
67
|
+
:client_secret => @client_secret.dup
|
68
|
+
|
69
|
+
JSON.parse(response)['access_token']
|
70
|
+
end
|
71
|
+
|
72
|
+
def convert_payload(response)
|
73
|
+
response.payload.first.nil? ? [response.to_h] : response.map(&:to_h)
|
74
|
+
end
|
75
|
+
# end
|
76
|
+
end
|
77
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe GmanClient do
|
4
|
+
describe '.driver_commission_histories' do
|
5
|
+
let(:response) do
|
6
|
+
VCR.use_cassette('driver_commission_histories') do
|
7
|
+
gman_adapter.driver_commission_histories
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
subject(:client_response) { response }
|
12
|
+
let(:driver_commission) { client_response.first }
|
13
|
+
|
14
|
+
it 'client response will not be empty' do
|
15
|
+
is_expected.not_to be_empty
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'responds with a hash list' do
|
19
|
+
is_expected.to satisfy {
|
20
|
+
|h| h.is_a?(Array) && h.all? { |e| e.is_a?(Hash) }
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'first driver' do
|
25
|
+
subject { client_response.first }
|
26
|
+
|
27
|
+
it { is_expected.to have_key(:driver_id) }
|
28
|
+
it { is_expected.to have_key(:backhauls) }
|
29
|
+
it { is_expected.to have_key(:freight_revenue) }
|
30
|
+
it { is_expected.to have_key(:customer_name) }
|
31
|
+
it { is_expected.to have_key(:customer_id) }
|
32
|
+
it { is_expected.to have_key(:delivery_date) }
|
33
|
+
it { is_expected.to have_key(:driver_rate) }
|
34
|
+
it { is_expected.to have_key(:freight_bill_number) }
|
35
|
+
it { is_expected.to have_key(:fuel_surcharge) }
|
36
|
+
it { is_expected.to have_key(:layover) }
|
37
|
+
it { is_expected.to have_key(:movement_type) }
|
38
|
+
it { is_expected.to have_key(:other_hour_dollars) }
|
39
|
+
it { is_expected.to have_key(:order_number_text) }
|
40
|
+
it { is_expected.to have_key(:origin_name) }
|
41
|
+
it { is_expected.to have_key(:paid_date) }
|
42
|
+
it { is_expected.to have_key(:revenue) }
|
43
|
+
it { is_expected.to have_key(:split_rate) }
|
44
|
+
it { is_expected.to have_key(:total_freight_revenue) }
|
45
|
+
it { is_expected.to have_key(:drvrcomh_key) }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
describe '.driver_commission_histories_by_paid_date' do
|
49
|
+
let(:response) do
|
50
|
+
VCR.use_cassette('driver_commission_histories_by_paid_date') do
|
51
|
+
gman_adapter.driver_commission_histories_by_paid_date(
|
52
|
+
Date.new(2014, 01, 01))
|
53
|
+
end
|
54
|
+
end
|
55
|
+
subject(:client_response) { response }
|
56
|
+
let(:driver_commission) { client_response.first }
|
57
|
+
it 'client response will not be empty' do
|
58
|
+
is_expected.not_to be_empty
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'responds with a hash list' do
|
62
|
+
is_expected.to satisfy {
|
63
|
+
|h| h.is_a?(Array) && h.all? { |e| e.is_a?(Hash) }
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'first driver' do
|
68
|
+
subject { client_response.first }
|
69
|
+
|
70
|
+
it { is_expected.to have_key(:driver_id) }
|
71
|
+
it { is_expected.to have_key(:backhauls) }
|
72
|
+
it { is_expected.to have_key(:freight_revenue) }
|
73
|
+
it { is_expected.to have_key(:customer_name) }
|
74
|
+
it { is_expected.to have_key(:customer_id) }
|
75
|
+
it { is_expected.to have_key(:delivery_date) }
|
76
|
+
it { is_expected.to have_key(:driver_rate) }
|
77
|
+
it { is_expected.to have_key(:freight_bill_number) }
|
78
|
+
it { is_expected.to have_key(:fuel_surcharge) }
|
79
|
+
it { is_expected.to have_key(:layover) }
|
80
|
+
it { is_expected.to have_key(:movement_type) }
|
81
|
+
it { is_expected.to have_key(:other_hour_dollars) }
|
82
|
+
it { is_expected.to have_key(:order_number_text) }
|
83
|
+
it { is_expected.to have_key(:origin_name) }
|
84
|
+
it { is_expected.to have_key(:paid_date) }
|
85
|
+
it { is_expected.to have_key(:revenue) }
|
86
|
+
it { is_expected.to have_key(:split_rate) }
|
87
|
+
it { is_expected.to have_key(:total_freight_revenue) }
|
88
|
+
it { is_expected.to have_key(:drvrcomh_key) }
|
89
|
+
it { is_expected.to have_value(Date.new(2014, 01, 01).to_s) }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe GmanClient do
|
4
|
+
describe '.drivers' do
|
5
|
+
let(:response) do
|
6
|
+
VCR.use_cassette('drivers') do
|
7
|
+
gman_adapter.drivers
|
8
|
+
end
|
9
|
+
end
|
10
|
+
subject(:client_response) { response }
|
11
|
+
let(:driver) { client_response.first }
|
12
|
+
|
13
|
+
it 'client response will not be empty' do
|
14
|
+
is_expected.not_to be_empty
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'responds with a hash list' do
|
18
|
+
is_expected.to satisfy {
|
19
|
+
|h| h.is_a?(Array) && h.all? { |e| e.is_a?(Hash) }
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'first driver' do
|
24
|
+
subject { client_response.first }
|
25
|
+
its(:keys) do
|
26
|
+
is_expected.to eq([:driver_id,
|
27
|
+
:active_fg,
|
28
|
+
:driver_type,
|
29
|
+
:sub_hauler_fg,
|
30
|
+
:first_name,
|
31
|
+
:last_name])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe GmanClient do
|
4
|
+
describe '.inventory_items' do
|
5
|
+
let(:response) do
|
6
|
+
VCR.use_cassette('inventory_items') do
|
7
|
+
gman_adapter.inventory_items
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
subject(:client_response) { response }
|
12
|
+
let(:driver_commission) { client_response.first }
|
13
|
+
|
14
|
+
it 'client response will not be empty' do
|
15
|
+
is_expected.not_to be_empty
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'responds with a hash list' do
|
19
|
+
is_expected.to satisfy {
|
20
|
+
|h| h.is_a?(Array) && h.all? { |e| e.is_a?(Hash) }
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'first item' do
|
25
|
+
subject { client_response.first }
|
26
|
+
|
27
|
+
it { is_expected.to have_key(:item_id) }
|
28
|
+
it { is_expected.to have_key(:in_item_description) }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '.inventory_items_like_id_description' do
|
33
|
+
let(:response) do
|
34
|
+
VCR.use_cassette('inventory_items_like_id_description') do
|
35
|
+
gman_adapter.inventory_items_like_id_description(9370, 'Rachelle')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
subject(:client_response) { response }
|
39
|
+
let(:driver_commission) { client_response.first }
|
40
|
+
it 'client response will not be empty' do
|
41
|
+
is_expected.not_to be_empty
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'responds with a hash list' do
|
45
|
+
is_expected.to satisfy {
|
46
|
+
|h| h.is_a?(Array) && h.all? { |e| e.is_a?(Hash) }
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'first item' do
|
51
|
+
subject { client_response.first }
|
52
|
+
|
53
|
+
it { is_expected.to have_key(:item_id) }
|
54
|
+
it { is_expected.to have_key(:in_item_description) }
|
55
|
+
it { is_expected.to have_value(9370) }
|
56
|
+
it { is_expected.to have_value('Rachelle') }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '.inventory_items_by_id' do
|
61
|
+
let(:response) do
|
62
|
+
VCR.use_cassette('inventory_items_by_id') do
|
63
|
+
gman_adapter.inventory_items_by_id(9370)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
subject(:client_response) { response }
|
67
|
+
let(:driver_commission) { client_response.first }
|
68
|
+
it 'client response will not be empty' do
|
69
|
+
is_expected.not_to be_empty
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'responds with a hash list' do
|
73
|
+
is_expected.to satisfy {
|
74
|
+
|h| h.is_a?(Array) && h.all? { |e| e.is_a?(Hash) }
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
describe 'first item' do
|
79
|
+
subject { client_response.first }
|
80
|
+
|
81
|
+
it { is_expected.to have_key(:item_id) }
|
82
|
+
it { is_expected.to have_key(:in_item_description) }
|
83
|
+
it { is_expected.to have_value(9370) }
|
84
|
+
it { is_expected.to have_value('Rachelle') }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
require 'rspec/its'
|
4
|
+
require 'spec_helper'
|
5
|
+
require 'gman_client'
|
6
|
+
require 'vcr'
|
7
|
+
require 'httparty'
|
8
|
+
require 'webmock'
|
9
|
+
require 'support/vcr'
|
10
|
+
require 'support/gman_adapter'
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.expect_with :rspec do |expectations|
|
13
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
14
|
+
end
|
15
|
+
|
16
|
+
config.mock_with :rspec do |mocks|
|
17
|
+
mocks.verify_partial_doubles = true
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
def gman_adapter
|
2
|
+
url = 'http://localhost:3000'
|
3
|
+
token_url = 'http://localhost:3000/oauth/token'
|
4
|
+
# rubocop:disable Metrics/LineLength
|
5
|
+
client_id = 'd137a94543da86e52214d3ed86b015f9299ad2fc66681637600afad814cd7d2b'
|
6
|
+
client_secret = 'f444a467ddbbaed52297d61a3edc5efd93e9292fc542058786aa13fa366865a3'
|
7
|
+
# rubocop:enable Metrics/LineLength
|
8
|
+
|
9
|
+
Gman::Client.new(:url => url,
|
10
|
+
:token_url => token_url,
|
11
|
+
:client_id => client_id,
|
12
|
+
:client_secret => client_secret
|
13
|
+
)
|
14
|
+
end
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
# VCR.configure do |c|
|
4
|
+
# c.hook_into :webmock
|
5
|
+
# c.cassette_library_dir = 'spec/support/vcr_cassettes'
|
6
|
+
# c.configure_rspec_metadata!
|
7
|
+
# c.allow_http_connections_when_no_cassette = true if real_requests
|
8
|
+
# c.default_cassette_options = {:record => :new_episodes}
|
9
|
+
# end
|
10
|
+
|
11
|
+
real_requests = ENV['REAL_REQUESTS']
|
12
|
+
|
13
|
+
VCR.configure do |c|
|
14
|
+
c.cassette_library_dir = 'spec/vcr_cassettes'
|
15
|
+
c.hook_into :webmock
|
16
|
+
c.allow_http_connections_when_no_cassette = true if real_requests
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.before(:each) do
|
21
|
+
VCR.eject_cassette
|
22
|
+
end if real_requests
|
23
|
+
end
|