gman_client 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.hound.yml +6 -0
- data/.rspec +0 -1
- data/.rubocop.yml +248 -8
- data/Gemfile +3 -2
- data/README.md +25 -20
- data/gman_client.gemspec +20 -20
- data/lib/gman/client.rb +72 -0
- data/lib/gman_client/commodity_merchandising/contracts.rb +34 -0
- data/lib/gman_client/inventory/items.rb +0 -0
- data/lib/gman_client/utility.rb +32 -0
- data/lib/gman_client/version.rb +1 -1
- data/lib/gman_client.rb +6 -84
- data/spec/lib/client_contracts_spec.rb +41 -0
- data/spec/lib/driver_response_spec.rb +1 -1
- data/spec/spec_helper.rb +6 -5
- data/spec/support/gman_adapter.rb +4 -4
- data/spec/support/shared_contexts.rb +13 -0
- data/spec/support/vcr.rb +4 -10
- data/spec/vcr_cassettes/contracts.yml +87 -0
- metadata +50 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09ab49afdc0b9bd1a69d929bd9da2ed484faff8f
|
4
|
+
data.tar.gz: 87c0f0b09a018eff03718390227c990774261fec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1d861ede79bcc0de351a0dd185f69461b347a7325a0fcfc5df10b64041eac862f33e8daa8280ebf2d02c82f5c7366ebc0d47acd93c57289df04a8179d2e4e20
|
7
|
+
data.tar.gz: cfd1cdddb8afa17d49d2e3f024f7d1d392dd1bf2cb829c1500251fb94eb5e0c97cf533099623ed5a64f0372728d0b91d56aa262b2ad83f4e290cf3ad0e894c18
|
data/.gitignore
CHANGED
data/.hound.yml
ADDED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,9 +1,249 @@
|
|
1
|
-
Style/HashSyntax:
|
2
|
-
EnforcedStyle: hash_rockets
|
3
|
-
SupportedStyles:
|
4
|
-
- ruby19
|
5
|
-
- hash_rockets
|
6
|
-
|
7
1
|
AllCops:
|
8
|
-
|
9
|
-
|
2
|
+
Exclude:
|
3
|
+
- "vendor/**/*"
|
4
|
+
- "db/schema.rb"
|
5
|
+
UseCache: false
|
6
|
+
Style/CollectionMethods:
|
7
|
+
Description: Preferred collection methods.
|
8
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
|
9
|
+
Enabled: true
|
10
|
+
PreferredMethods:
|
11
|
+
collect: map
|
12
|
+
collect!: map!
|
13
|
+
find: detect
|
14
|
+
find_all: select
|
15
|
+
reduce: inject
|
16
|
+
Style/DotPosition:
|
17
|
+
Description: Checks the position of the dot in multi-line method calls.
|
18
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
|
19
|
+
Enabled: true
|
20
|
+
EnforcedStyle: leading
|
21
|
+
SupportedStyles:
|
22
|
+
- leading
|
23
|
+
- trailing
|
24
|
+
Style/FileName:
|
25
|
+
Description: Use snake_case for source file names.
|
26
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
|
27
|
+
Enabled: false
|
28
|
+
Exclude: []
|
29
|
+
Style/GuardClause:
|
30
|
+
Description: Check for conditionals that can be replaced with guard clauses
|
31
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
32
|
+
Enabled: false
|
33
|
+
MinBodyLength: 1
|
34
|
+
Style/IfUnlessModifier:
|
35
|
+
Description: Favor modifier if/unless usage when you have a single-line body.
|
36
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
|
37
|
+
Enabled: false
|
38
|
+
MaxLineLength: 80
|
39
|
+
Style/OptionHash:
|
40
|
+
Description: Don't use option hashes when you can use keyword arguments.
|
41
|
+
Enabled: false
|
42
|
+
Style/PercentLiteralDelimiters:
|
43
|
+
Description: Use `%`-literal delimiters consistently
|
44
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
|
45
|
+
Enabled: false
|
46
|
+
PreferredDelimiters:
|
47
|
+
"%": "()"
|
48
|
+
"%i": "()"
|
49
|
+
"%q": "()"
|
50
|
+
"%Q": "()"
|
51
|
+
"%r": "{}"
|
52
|
+
"%s": "()"
|
53
|
+
"%w": "()"
|
54
|
+
"%W": "()"
|
55
|
+
"%x": "()"
|
56
|
+
Style/PredicateName:
|
57
|
+
Description: Check the names of predicate methods.
|
58
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
59
|
+
Enabled: true
|
60
|
+
NamePrefix:
|
61
|
+
- is_
|
62
|
+
- has_
|
63
|
+
- have_
|
64
|
+
NamePrefixBlacklist:
|
65
|
+
- is_
|
66
|
+
Exclude:
|
67
|
+
- spec/**/*
|
68
|
+
Style/RaiseArgs:
|
69
|
+
Description: Checks the arguments passed to raise/fail.
|
70
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
|
71
|
+
Enabled: false
|
72
|
+
EnforcedStyle: exploded
|
73
|
+
SupportedStyles:
|
74
|
+
- compact
|
75
|
+
- exploded
|
76
|
+
Style/SignalException:
|
77
|
+
Description: Checks for proper usage of fail and raise.
|
78
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
|
79
|
+
Enabled: false
|
80
|
+
EnforcedStyle: semantic
|
81
|
+
SupportedStyles:
|
82
|
+
- only_raise
|
83
|
+
- only_fail
|
84
|
+
- semantic
|
85
|
+
Style/SingleLineBlockParams:
|
86
|
+
Description: Enforces the names of some block params.
|
87
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
|
88
|
+
Enabled: false
|
89
|
+
Methods:
|
90
|
+
- reduce:
|
91
|
+
- a
|
92
|
+
- e
|
93
|
+
- inject:
|
94
|
+
- a
|
95
|
+
- e
|
96
|
+
Style/SingleLineMethods:
|
97
|
+
Description: Avoid single-line methods.
|
98
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
|
99
|
+
Enabled: false
|
100
|
+
AllowIfMethodIsEmpty: true
|
101
|
+
Style/StringLiterals:
|
102
|
+
Description: Checks if uses of quotes match the configured preference.
|
103
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
|
104
|
+
Enabled: true
|
105
|
+
EnforcedStyle: single_quotes
|
106
|
+
SupportedStyles:
|
107
|
+
- single_quotes
|
108
|
+
- double_quotes
|
109
|
+
Style/StringLiteralsInInterpolation:
|
110
|
+
Description: Checks if uses of quotes inside expressions in interpolated strings
|
111
|
+
match the configured preference.
|
112
|
+
Enabled: true
|
113
|
+
EnforcedStyle: single_quotes
|
114
|
+
SupportedStyles:
|
115
|
+
- single_quotes
|
116
|
+
- double_quotes
|
117
|
+
Style/TrailingCommaInArguments:
|
118
|
+
Description: 'Checks for trailing comma in argument lists.'
|
119
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
120
|
+
Enabled: false
|
121
|
+
EnforcedStyleForMultiline: no_comma
|
122
|
+
SupportedStyles:
|
123
|
+
- comma
|
124
|
+
- consistent_comma
|
125
|
+
- no_comma
|
126
|
+
Style/TrailingCommaInLiteral:
|
127
|
+
Description: 'Checks for trailing comma in array and hash literals.'
|
128
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
129
|
+
Enabled: false
|
130
|
+
EnforcedStyleForMultiline: no_comma
|
131
|
+
SupportedStyles:
|
132
|
+
- comma
|
133
|
+
- consistent_comma
|
134
|
+
- no_comma
|
135
|
+
Metrics/AbcSize:
|
136
|
+
Description: A calculated magnitude based on number of assignments, branches, and
|
137
|
+
conditions.
|
138
|
+
Enabled: false
|
139
|
+
Max: 15
|
140
|
+
Metrics/ClassLength:
|
141
|
+
Description: Avoid classes longer than 100 lines of code.
|
142
|
+
Enabled: false
|
143
|
+
CountComments: false
|
144
|
+
Max: 100
|
145
|
+
Metrics/ModuleLength:
|
146
|
+
CountComments: false
|
147
|
+
Max: 100
|
148
|
+
Description: Avoid modules longer than 100 lines of code.
|
149
|
+
Enabled: false
|
150
|
+
Metrics/CyclomaticComplexity:
|
151
|
+
Description: A complexity metric that is strongly correlated to the number of test
|
152
|
+
cases needed to validate a method.
|
153
|
+
Enabled: false
|
154
|
+
Max: 6
|
155
|
+
Metrics/MethodLength:
|
156
|
+
Description: Avoid methods longer than 10 lines of code.
|
157
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
158
|
+
Enabled: false
|
159
|
+
CountComments: false
|
160
|
+
Max: 10
|
161
|
+
Metrics/ParameterLists:
|
162
|
+
Description: Avoid parameter lists longer than three or four parameters.
|
163
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
|
164
|
+
Enabled: false
|
165
|
+
Max: 5
|
166
|
+
CountKeywordArgs: true
|
167
|
+
Metrics/PerceivedComplexity:
|
168
|
+
Description: A complexity metric geared towards measuring complexity for a human
|
169
|
+
reader.
|
170
|
+
Enabled: false
|
171
|
+
Max: 7
|
172
|
+
Lint/AssignmentInCondition:
|
173
|
+
Description: Don't use assignment in conditions.
|
174
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
|
175
|
+
Enabled: false
|
176
|
+
AllowSafeAssignment: true
|
177
|
+
Style/MultilineOperationIndentation:
|
178
|
+
Enabled: false
|
179
|
+
EnforcedStyle: indented
|
180
|
+
SupportedStyles:
|
181
|
+
- aligned
|
182
|
+
- indented
|
183
|
+
Style/InlineComment:
|
184
|
+
Description: Avoid inline comments.
|
185
|
+
Enabled: false
|
186
|
+
Style/AccessorMethodName:
|
187
|
+
Description: Check the naming of accessor methods for get_/set_.
|
188
|
+
Enabled: false
|
189
|
+
Style/Alias:
|
190
|
+
Description: Use alias_method instead of alias.
|
191
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
|
192
|
+
Enabled: false
|
193
|
+
Style/Documentation:
|
194
|
+
Description: Document classes and non-namespace modules.
|
195
|
+
Enabled: false
|
196
|
+
Style/DoubleNegation:
|
197
|
+
Description: Checks for uses of double negation (!!).
|
198
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
|
199
|
+
Enabled: false
|
200
|
+
Style/EachWithObject:
|
201
|
+
Description: Prefer `each_with_object` over `inject` or `reduce`.
|
202
|
+
Enabled: false
|
203
|
+
Style/EmptyLiteral:
|
204
|
+
Description: Prefer literals to Array.new/Hash.new/String.new.
|
205
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
|
206
|
+
Enabled: false
|
207
|
+
Style/ModuleFunction:
|
208
|
+
Description: Checks for usage of `extend self` in modules.
|
209
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
|
210
|
+
Enabled: false
|
211
|
+
Style/OneLineConditional:
|
212
|
+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
213
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
214
|
+
Enabled: false
|
215
|
+
Style/PerlBackrefs:
|
216
|
+
Description: Avoid Perl-style regex back references.
|
217
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
|
218
|
+
Enabled: false
|
219
|
+
Style/Send:
|
220
|
+
Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
|
221
|
+
may overlap with existing methods.
|
222
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
|
223
|
+
Enabled: false
|
224
|
+
Style/SpecialGlobalVars:
|
225
|
+
Description: Avoid Perl-style global variables.
|
226
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
|
227
|
+
Enabled: false
|
228
|
+
Style/VariableInterpolation:
|
229
|
+
Description: Don't interpolate global, instance and class variables directly in
|
230
|
+
strings.
|
231
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
|
232
|
+
Enabled: false
|
233
|
+
Style/WhenThen:
|
234
|
+
Description: Use when x then ... for one-line cases.
|
235
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
|
236
|
+
Enabled: false
|
237
|
+
Lint/EachWithObjectArgument:
|
238
|
+
Description: Check for immutable argument given to each_with_object.
|
239
|
+
Enabled: true
|
240
|
+
Lint/HandleExceptions:
|
241
|
+
Description: Don't suppress exception.
|
242
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
|
243
|
+
Enabled: false
|
244
|
+
Lint/LiteralInCondition:
|
245
|
+
Description: Checks of literals used in conditions.
|
246
|
+
Enabled: false
|
247
|
+
Lint/LiteralInInterpolation:
|
248
|
+
Description: Checks for literals used in interpolation.
|
249
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
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
|
+
|
2
3
|
# GmanClient
|
3
4
|
|
4
5
|
Gem hooks into the Grossman API.
|
@@ -8,38 +9,42 @@ Gem hooks into the Grossman API.
|
|
8
9
|
Add this line to your application's Gemfile:
|
9
10
|
|
10
11
|
```ruby
|
11
|
-
gem 'gman_client', :
|
12
|
+
gem 'gman_client', git: 'git@github.com:westernmilling/gman_client.git'
|
12
13
|
```
|
13
14
|
|
14
15
|
And then execute:
|
15
16
|
|
16
17
|
$ bundle
|
17
18
|
|
18
|
-
|
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
|
-
```
|
19
|
+
## Usage
|
32
20
|
|
33
21
|
How to use:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
gman
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
client = Gman::Client.new(
|
25
|
+
url: "gman services url",
|
26
|
+
client_id: "client id",
|
27
|
+
client_secret: "client secret"
|
28
|
+
)
|
29
|
+
```
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
client.drivers
|
33
|
+
client.driver_commission_histories
|
34
|
+
client.driver_commission_histories_by_paid_date(DATE.new())
|
35
|
+
```
|
36
|
+
|
37
|
+
## Running the tests
|
38
|
+
|
39
|
+
```bash
|
40
|
+
export GMAN_SERVICES_URL=<Gman Services URL>
|
41
|
+
export GMAN_SERVICES_CLIENT_ID=<Client ID>
|
42
|
+
export GMAN_SERVICES_CLIENT_SECRET=<Client Secret>
|
38
43
|
```
|
39
44
|
|
40
45
|
## Contributing
|
41
46
|
|
42
|
-
1. Fork it ( https://github.com/
|
47
|
+
1. Fork it ( https://github.com/westernmilling/gman_client/fork )
|
43
48
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
49
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
50
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/gman_client.gemspec
CHANGED
@@ -4,28 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'gman_client/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
|
14
|
-
spec.
|
7
|
+
spec.name = 'gman_client'
|
8
|
+
spec.version = GmanClient::VERSION
|
9
|
+
spec.authors = %w(MichaelAChrisco josephbridgwaterrowe)
|
10
|
+
spec.email = ['joe@westernmilling.com']
|
11
|
+
spec.summary = 'Grossman API Client for Ruby'
|
12
|
+
spec.description =
|
13
|
+
'Grossman API Client for accessing gman-services written in Ruby.'
|
14
|
+
spec.homepage = 'https://github.com/westernmilling/gman_client'
|
15
|
+
spec.license = 'MIT'
|
15
16
|
|
16
|
-
spec.files
|
17
|
-
spec.executables
|
18
|
-
spec.test_files
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
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 'hashie'
|
24
|
-
spec.add_dependency 'retries'
|
25
|
-
spec.add_dependency 'rest-client'
|
21
|
+
spec.add_runtime_dependency 'vcr', '3.0.1'
|
22
|
+
spec.add_runtime_dependency 'webmock', '1.22.6'
|
23
|
+
spec.add_dependency 'blanket_wrapper', '3.0.2'
|
24
|
+
spec.add_dependency 'hashie', '3.4.3'
|
25
|
+
spec.add_dependency 'retries', '0.0.5'
|
26
|
+
spec.add_dependency 'rest-client', '1.8.0'
|
26
27
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
27
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
-
spec.add_development_dependency 'rspec'
|
29
|
-
spec.add_development_dependency 'rspec-its'
|
30
|
-
|
29
|
+
spec.add_development_dependency 'rspec', '3.4.0'
|
30
|
+
spec.add_development_dependency 'rspec-its', '1.2.0'
|
31
31
|
end
|
data/lib/gman/client.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
module Gman
|
2
|
+
class Client
|
3
|
+
include GmanClient::CommodityMerchandising::Contracts
|
4
|
+
include GmanClient::Utility
|
5
|
+
|
6
|
+
attr_accessor :url, :client_id, :client_secret
|
7
|
+
def initialize(options)
|
8
|
+
@url = options[:url]
|
9
|
+
@token_url = "#{url}/oauth/token"
|
10
|
+
@client_id = options[:client_id]
|
11
|
+
@client_secret = options[:client_secret]
|
12
|
+
@retry_attempts = options[:retries] || 3
|
13
|
+
end
|
14
|
+
|
15
|
+
def drivers
|
16
|
+
response = attempt(3) { request.api.v1.drivers.get }
|
17
|
+
convert_payload(response)
|
18
|
+
end
|
19
|
+
|
20
|
+
def driver_commission_histories
|
21
|
+
response = attempt(3) do
|
22
|
+
request.api.v1.driver_commissions_history.get
|
23
|
+
end
|
24
|
+
convert_payload(response)
|
25
|
+
end
|
26
|
+
|
27
|
+
def driver_commission_histories_by_paid_date(paid_date)
|
28
|
+
response = attempt(3) do
|
29
|
+
request
|
30
|
+
.api
|
31
|
+
.v1
|
32
|
+
.driver_commissions_history_by_paid_date
|
33
|
+
.get(params: { paid_date: paid_date })
|
34
|
+
end
|
35
|
+
convert_payload(response)
|
36
|
+
end
|
37
|
+
|
38
|
+
def inventory_items
|
39
|
+
response = attempt(3) { request.api.v1.inventory.items.get }
|
40
|
+
convert_payload(response)
|
41
|
+
end
|
42
|
+
|
43
|
+
def inventory_items_like_id_description(item_id, in_item_description)
|
44
|
+
response = attempt(3) do
|
45
|
+
request
|
46
|
+
.api
|
47
|
+
.v1
|
48
|
+
.inventory
|
49
|
+
.items_like_id_description
|
50
|
+
.get(params:
|
51
|
+
{
|
52
|
+
item_id: item_id,
|
53
|
+
in_item_description: in_item_description
|
54
|
+
}
|
55
|
+
)
|
56
|
+
end
|
57
|
+
convert_payload(response)
|
58
|
+
end
|
59
|
+
|
60
|
+
def inventory_items_by_id(item_id)
|
61
|
+
response = attempt(3) do
|
62
|
+
request
|
63
|
+
.api
|
64
|
+
.v1
|
65
|
+
.inventory
|
66
|
+
.items_by_id
|
67
|
+
.get(params: { item_id: item_id })
|
68
|
+
end
|
69
|
+
convert_payload(response)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module GmanClient
|
2
|
+
module CommodityMerchandising
|
3
|
+
module Contracts
|
4
|
+
def contracts(filters)
|
5
|
+
response = attempt(@retry_attempts) do
|
6
|
+
request
|
7
|
+
.api
|
8
|
+
.v1
|
9
|
+
.commodity_merchandising
|
10
|
+
.contracts
|
11
|
+
.get(params: { q: clean_filters(filters) })
|
12
|
+
end
|
13
|
+
|
14
|
+
response
|
15
|
+
.map(&:to_h)
|
16
|
+
.map { |x| transform_response_item(x) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def clean_filters(filters)
|
20
|
+
keep = filters.select do |k, _v|
|
21
|
+
[:commodity_id_eq, :customer_id_eq].include?(k)
|
22
|
+
end
|
23
|
+
|
24
|
+
Hash[filters.to_a & keep.to_a]
|
25
|
+
end
|
26
|
+
|
27
|
+
def transform_response_item(hash)
|
28
|
+
hash.each_with_object({}) do |(k, v), memo|
|
29
|
+
memo[k.to_s.gsub(/cont_/, '').to_sym] = v
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module GmanClient
|
2
|
+
module Utility
|
3
|
+
def request
|
4
|
+
Blanket.wrap(
|
5
|
+
@url,
|
6
|
+
extension: :json,
|
7
|
+
headers: { 'Authorization' => "Bearer #{token}" }
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
def token
|
12
|
+
return @token if @token
|
13
|
+
|
14
|
+
response = RestClient.post(@token_url,
|
15
|
+
grant_type: 'client_credentials',
|
16
|
+
client_id: @client_id,
|
17
|
+
client_secret: @client_secret)
|
18
|
+
|
19
|
+
@token = JSON.parse(response)['access_token']
|
20
|
+
end
|
21
|
+
|
22
|
+
def convert_payload(response)
|
23
|
+
response.map do |hash_request|
|
24
|
+
Hashie.symbolize_keys!(hash_request.to_h)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def attempt(retry_count)
|
29
|
+
with_retries(max_tries: retry_count) { yield }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/gman_client/version.rb
CHANGED
data/lib/gman_client.rb
CHANGED
@@ -1,93 +1,15 @@
|
|
1
|
+
require 'gman_client/commodity_merchandising/contracts'
|
2
|
+
require 'gman_client/utility'
|
1
3
|
require 'gman_client/version'
|
4
|
+
require 'gman/client'
|
2
5
|
require 'rest_client'
|
3
6
|
require 'json'
|
4
7
|
require 'blanket'
|
5
8
|
require 'hashie'
|
6
9
|
require 'retries'
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
class Client
|
12
|
-
attr_accessor :url, :token_url, :client_id, :client_secret
|
13
|
-
def initialize(options = {})
|
14
|
-
@url = options[:url] || ENV['WRAP_URL']
|
15
|
-
@token_url = options[:token_url] || ENV['TOKEN_URL']
|
16
|
-
@client_id = options[:client_id] || ENV['CLIENT_ID']
|
17
|
-
@client_secret = options[:client_secret] || ENV['CLIENT_SECRET']
|
18
|
-
end
|
19
|
-
|
20
|
-
def drivers
|
21
|
-
response = attempt(3) { request.api.v1.drivers.get }
|
22
|
-
convert_payload(response)
|
23
|
-
end
|
24
|
-
|
25
|
-
def driver_commission_histories
|
26
|
-
response = attempt(3) do
|
27
|
-
request.api.v1.driver_commissions_history.get
|
28
|
-
end
|
29
|
-
convert_payload(response)
|
30
|
-
end
|
31
|
-
|
32
|
-
def driver_commission_histories_by_paid_date(paid_date)
|
33
|
-
response = attempt(3) do
|
34
|
-
request.api.v1.driver_commissions_history_by_paid_date
|
35
|
-
.get(:params => { :paid_date => paid_date })
|
36
|
-
end
|
37
|
-
convert_payload(response)
|
38
|
-
end
|
39
|
-
|
40
|
-
def inventory_items
|
41
|
-
response = attempt(3) { request.api.v1.inventory.items.get }
|
42
|
-
convert_payload(response)
|
43
|
-
end
|
44
|
-
|
45
|
-
def inventory_items_like_id_description(item_id, in_item_description)
|
46
|
-
response = attempt(3) do
|
47
|
-
request.api.v1.inventory.items_like_id_description
|
48
|
-
.get(:params => { :item_id => item_id,
|
49
|
-
:in_item_description => in_item_description }
|
50
|
-
)
|
51
|
-
end
|
52
|
-
convert_payload(response)
|
53
|
-
end
|
54
|
-
|
55
|
-
def inventory_items_by_id(item_id)
|
56
|
-
response = attempt(3) do
|
57
|
-
request.api.v1.inventory.items_by_id
|
58
|
-
.get(:params => { :item_id => item_id })
|
59
|
-
end
|
60
|
-
convert_payload(response)
|
61
|
-
end
|
62
|
-
|
63
|
-
def request
|
64
|
-
token = retrieve_token
|
65
|
-
Blanket.wrap(@url.dup,
|
66
|
-
:extension => :json,
|
67
|
-
:headers => {
|
68
|
-
'Authorization' => "Bearer #{token}" }
|
69
|
-
)
|
70
|
-
end
|
71
|
-
|
72
|
-
def retrieve_token
|
73
|
-
response = RestClient.post @token_url.dup,
|
74
|
-
:grant_type => 'client_credentials',
|
75
|
-
:client_id => @client_id.dup,
|
76
|
-
:client_secret => @client_secret.dup
|
77
|
-
|
78
|
-
JSON.parse(response)['access_token']
|
79
|
-
end
|
80
|
-
|
81
|
-
private
|
82
|
-
|
83
|
-
def convert_payload(response)
|
84
|
-
response.map do |hash_request|
|
85
|
-
Hashie.symbolize_keys!(hash_request.to_h)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def attempt(retry_count)
|
90
|
-
with_retries(:max_tries => retry_count) { yield }
|
91
|
-
end
|
11
|
+
module GmanClient
|
12
|
+
def self.root
|
13
|
+
File.expand_path '../..', __FILE__
|
92
14
|
end
|
93
15
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Gman::Client do
|
4
|
+
include_context 'grossman client'
|
5
|
+
|
6
|
+
let(:customer_id) { 100_001 }
|
7
|
+
let(:response) do
|
8
|
+
VCR.use_cassette('contracts') do
|
9
|
+
client.contracts(customer_id_eq: 100_001)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
subject { response }
|
13
|
+
|
14
|
+
it 'should have a client response' do
|
15
|
+
is_expected.not_to be_empty
|
16
|
+
end
|
17
|
+
it 'should have responded with an array of hashes' do
|
18
|
+
is_expected
|
19
|
+
.to satisfy { |h| h.is_a?(Array) && h.all? { |e| e.is_a?(Hash) } }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'first contract' do
|
23
|
+
subject { response.first }
|
24
|
+
its(:keys) do
|
25
|
+
is_expected.to include(
|
26
|
+
:contract_id,
|
27
|
+
:commodity_id,
|
28
|
+
:customer_id,
|
29
|
+
:contract_number,
|
30
|
+
:contract_date,
|
31
|
+
:contract_type,
|
32
|
+
:quantity,
|
33
|
+
:delivered_bushels,
|
34
|
+
:price,
|
35
|
+
:freight_adjustment,
|
36
|
+
:from_date,
|
37
|
+
:to_date
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
require '
|
2
|
-
|
1
|
+
require 'codeclimate-test-reporter'
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
|
3
4
|
require 'rspec/its'
|
4
5
|
require 'spec_helper'
|
5
6
|
require 'gman_client'
|
6
|
-
require 'vcr'
|
7
7
|
require 'httparty'
|
8
8
|
require 'webmock'
|
9
|
-
|
10
|
-
|
9
|
+
|
10
|
+
Dir[File.join(GmanClient.root, 'spec/support/**/*.rb')].each { |f| require f }
|
11
|
+
|
11
12
|
RSpec.configure do |config|
|
12
13
|
config.expect_with :rspec do |expectations|
|
13
14
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
@@ -6,9 +6,9 @@ def gman_adapter
|
|
6
6
|
client_secret = 'f444a467ddbbaed52297d61a3edc5efd93e9292fc542058786aa13fa366865a3'
|
7
7
|
# rubocop:enable Metrics/LineLength
|
8
8
|
|
9
|
-
Gman::Client.new(:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
9
|
+
Gman::Client.new(url: url,
|
10
|
+
token_url: token_url,
|
11
|
+
client_id: client_id,
|
12
|
+
client_secret: client_secret
|
13
13
|
)
|
14
14
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
RSpec.shared_context 'grossman client' do
|
2
|
+
let(:client) do
|
3
|
+
url = ENV['GMAN_SERVICES_URL']
|
4
|
+
client_id = ENV['GMAN_SERVICES_CLIENT_ID']
|
5
|
+
client_secret = ENV['GMAN_SERVICES_CLIENT_SECRET']
|
6
|
+
|
7
|
+
Gman::Client.new(
|
8
|
+
url: url,
|
9
|
+
client_id: client_id,
|
10
|
+
client_secret: client_secret
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
data/spec/support/vcr.rb
CHANGED
@@ -1,19 +1,13 @@
|
|
1
1
|
require 'vcr'
|
2
2
|
|
3
|
-
|
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']
|
3
|
+
real_requests = ENV['VCR_ALLOW_ACTUAL_REQUESTS']
|
12
4
|
|
13
5
|
VCR.configure do |c|
|
6
|
+
c.allow_http_connections_when_no_cassette = true if real_requests
|
14
7
|
c.cassette_library_dir = 'spec/vcr_cassettes'
|
8
|
+
c.configure_rspec_metadata!
|
9
|
+
c.default_cassette_options = { record: :new_episodes }
|
15
10
|
c.hook_into :webmock
|
16
|
-
c.allow_http_connections_when_no_cassette = true if real_requests
|
17
11
|
end
|
18
12
|
|
19
13
|
RSpec.configure do |config|
|
@@ -0,0 +1,87 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:5000/oauth/token
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: grant_type=client_credentials&client_id=8341662f1b6dd15a0699c551fbc548f236244ffd8fbddb51b6de09ab95bea6a5&client_secret=49d24c41f48c203746fb221f38810149303f8bea1ba2bf5732011a64e260d87c
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Length:
|
15
|
+
- '183'
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
Cache-Control:
|
32
|
+
- no-store
|
33
|
+
Pragma:
|
34
|
+
- no-cache
|
35
|
+
Content-Type:
|
36
|
+
- application/json; charset=utf-8
|
37
|
+
Etag:
|
38
|
+
- '"9528aabe1ed9f772c139e5db6be7e32a"'
|
39
|
+
X-Request-Id:
|
40
|
+
- 5a6eca3f-cc5a-4083-b6c1-d1a5674b4cac
|
41
|
+
X-Runtime:
|
42
|
+
- '0.490000'
|
43
|
+
Transfer-Encoding:
|
44
|
+
- chunked
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"access_token":"ad70c595ff437569ea369aba202205235fb99aa3f8193c320644452c05a834ff","token_type":"bearer","created_at":1455564928}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Mon, 15 Feb 2016 19:35:28 GMT
|
50
|
+
- request:
|
51
|
+
method: get
|
52
|
+
uri: http://localhost:5000/api/v1/commodity_merchandising/contracts.json?q%5Bcustomer_id_eq%5D=100001
|
53
|
+
body:
|
54
|
+
encoding: US-ASCII
|
55
|
+
string: ''
|
56
|
+
headers:
|
57
|
+
Authorization:
|
58
|
+
- Bearer ad70c595ff437569ea369aba202205235fb99aa3f8193c320644452c05a834ff
|
59
|
+
response:
|
60
|
+
status:
|
61
|
+
code: 200
|
62
|
+
message: OK
|
63
|
+
headers:
|
64
|
+
X-Frame-Options:
|
65
|
+
- SAMEORIGIN
|
66
|
+
X-Xss-Protection:
|
67
|
+
- 1; mode=block
|
68
|
+
X-Content-Type-Options:
|
69
|
+
- nosniff
|
70
|
+
Content-Type:
|
71
|
+
- application/json; charset=utf-8
|
72
|
+
Etag:
|
73
|
+
- '"005b73fb5d637ae3fa00289d31083c22"'
|
74
|
+
Cache-Control:
|
75
|
+
- max-age=0, private, must-revalidate
|
76
|
+
X-Request-Id:
|
77
|
+
- 22d28c69-d776-42a6-b971-52dc2b688ee4
|
78
|
+
X-Runtime:
|
79
|
+
- '0.562000'
|
80
|
+
Transfer-Encoding:
|
81
|
+
- chunked
|
82
|
+
body:
|
83
|
+
encoding: UTF-8
|
84
|
+
string: '[{"contract_id":"000100001S","customer_id":"100001","commodity_id":"1218","cont_contract_number":100001,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":26502,"cont_price":"373.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100002P","customer_id":"100001","commodity_id":"1217","cont_contract_number":100002,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":90205,"cont_price":"352.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100003S","customer_id":"100001","commodity_id":"1999","cont_contract_number":100003,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":92786,"cont_price":"290.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100004P","customer_id":"100001","commodity_id":"1834","cont_contract_number":100004,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":30727,"cont_price":"268.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100005S","customer_id":"100001","commodity_id":"1211","cont_contract_number":100005,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":33145,"cont_price":"206.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100006S","customer_id":"100001","commodity_id":"1263","cont_contract_number":100006,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":46419,"cont_price":"288.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100007S","customer_id":"100001","commodity_id":"1560","cont_contract_number":100007,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":71675,"cont_price":"291.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100008P","customer_id":"100001","commodity_id":"1334","cont_contract_number":100008,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":37007,"cont_price":"214.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100009P","customer_id":"100001","commodity_id":"1335","cont_contract_number":100009,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":13501,"cont_price":"295.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100010P","customer_id":"100001","commodity_id":"1743","cont_contract_number":100010,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":8293,"cont_price":"390.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100011P","customer_id":"100002","commodity_id":"1113","cont_contract_number":100011,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":25201,"cont_price":"306.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100012P","customer_id":"100002","commodity_id":"1180","cont_contract_number":100012,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":16784,"cont_price":"388.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100013P","customer_id":"100002","commodity_id":"1730","cont_contract_number":100013,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":34720,"cont_price":"251.0","cont_freight_adjustment":"0.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100014S","customer_id":"100002","commodity_id":"1598","cont_contract_number":100014,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":957,"cont_price":"355.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100015S","customer_id":"100002","commodity_id":"1773","cont_contract_number":100015,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":96225,"cont_price":"241.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100016P","customer_id":"100002","commodity_id":"1187","cont_contract_number":100016,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":4731,"cont_price":"285.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100017S","customer_id":"100002","commodity_id":"1367","cont_contract_number":100017,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":48392,"cont_price":"254.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100018P","customer_id":"100002","commodity_id":"1756","cont_contract_number":100018,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":26394,"cont_price":"309.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100019S","customer_id":"100002","commodity_id":"1695","cont_contract_number":100019,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":51655,"cont_price":"228.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100020S","customer_id":"100002","commodity_id":"1207","cont_contract_number":100020,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":4799,"cont_price":"335.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100021P","customer_id":"100003","commodity_id":"1128","cont_contract_number":100021,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":12785,"cont_price":"283.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100022P","customer_id":"100003","commodity_id":"1199","cont_contract_number":100022,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":9926,"cont_price":"280.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100023S","customer_id":"100003","commodity_id":"1452","cont_contract_number":100023,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":49654,"cont_price":"392.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100024P","customer_id":"100003","commodity_id":"1011","cont_contract_number":100024,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":63431,"cont_price":"229.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100025S","customer_id":"100003","commodity_id":"1517","cont_contract_number":100025,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":49803,"cont_price":"326.0","cont_freight_adjustment":"0.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100026S","customer_id":"100003","commodity_id":"1276","cont_contract_number":100026,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":53860,"cont_price":"244.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100027P","customer_id":"100003","commodity_id":"1107","cont_contract_number":100027,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":87247,"cont_price":"365.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100028S","customer_id":"100003","commodity_id":"1723","cont_contract_number":100028,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":65936,"cont_price":"325.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100029P","customer_id":"100003","commodity_id":"1267","cont_contract_number":100029,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":33810,"cont_price":"398.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100030S","customer_id":"100003","commodity_id":"1470","cont_contract_number":100030,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":39243,"cont_price":"209.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100031P","customer_id":"100004","commodity_id":"1642","cont_contract_number":100031,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":44453,"cont_price":"261.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100032S","customer_id":"100004","commodity_id":"1632","cont_contract_number":100032,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":98337,"cont_price":"389.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100033P","customer_id":"100004","commodity_id":"1876","cont_contract_number":100033,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":20681,"cont_price":"294.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100034S","customer_id":"100004","commodity_id":"1417","cont_contract_number":100034,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":73836,"cont_price":"222.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100035P","customer_id":"100004","commodity_id":"1310","cont_contract_number":100035,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":27384,"cont_price":"226.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100036S","customer_id":"100004","commodity_id":"1753","cont_contract_number":100036,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":41156,"cont_price":"304.0","cont_freight_adjustment":"0.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100037S","customer_id":"100004","commodity_id":"1524","cont_contract_number":100037,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":34015,"cont_price":"333.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100038S","customer_id":"100004","commodity_id":"1027","cont_contract_number":100038,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":60081,"cont_price":"311.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100039S","customer_id":"100004","commodity_id":"1071","cont_contract_number":100039,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":57422,"cont_price":"250.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100040P","customer_id":"100004","commodity_id":"1757","cont_contract_number":100040,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":32371,"cont_price":"241.0","cont_freight_adjustment":"0.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100041P","customer_id":"100005","commodity_id":"1268","cont_contract_number":100041,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":86915,"cont_price":"277.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100042S","customer_id":"100005","commodity_id":"1832","cont_contract_number":100042,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":21967,"cont_price":"383.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100043S","customer_id":"100005","commodity_id":"1717","cont_contract_number":100043,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":251,"cont_price":"205.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100044S","customer_id":"100005","commodity_id":"1083","cont_contract_number":100044,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":100000,"cont_delivered_bushels":84469,"cont_price":"312.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100045S","customer_id":"100005","commodity_id":"1183","cont_contract_number":100045,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":20187,"cont_price":"211.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100046S","customer_id":"100005","commodity_id":"1130","cont_contract_number":100046,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":18806,"cont_price":"213.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100047P","customer_id":"100005","commodity_id":"1210","cont_contract_number":100047,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":10762,"cont_price":"384.0","cont_freight_adjustment":"6.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100048S","customer_id":"100005","commodity_id":"1003","cont_contract_number":100048,"cont_contract_type":"S","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":26977,"cont_price":"295.0","cont_freight_adjustment":"7.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100049P","customer_id":"100005","commodity_id":"1578","cont_contract_number":100049,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":32922,"cont_price":"395.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"},{"contract_id":"000100050P","customer_id":"100005","commodity_id":"1117","cont_contract_number":100050,"cont_contract_type":"P","cont_contract_date":"2016-02-15","cont_quantity":50000,"cont_delivered_bushels":29422,"cont_price":"356.0","cont_freight_adjustment":"5.0","cont_from_date":"2016-02-15","cont_to_date":"2017-02-15"}]'
|
85
|
+
http_version:
|
86
|
+
recorded_at: Mon, 15 Feb 2016 19:35:28 GMT
|
87
|
+
recorded_with: VCR 3.0.1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gman_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MichaelAChrisco
|
@@ -9,92 +9,92 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: vcr
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 3.0.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 3.0.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: webmock
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 1.22.6
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 1.22.6
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: blanket_wrapper
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - '='
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 3.0.2
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 3.0.2
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: hashie
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 3.4.3
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 3.4.3
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: retries
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 0.0.5
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 0.0.5
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rest-client
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 1.8.0
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
97
|
+
version: 1.8.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: bundler
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,38 +127,39 @@ dependencies:
|
|
127
127
|
name: rspec
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - '='
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: 3.4.0
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - '='
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 3.4.0
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: rspec-its
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- -
|
144
|
+
- - '='
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
146
|
+
version: 1.2.0
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- -
|
151
|
+
- - '='
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
154
|
-
description:
|
153
|
+
version: 1.2.0
|
154
|
+
description: Grossman API Client for accessing gman-services written in Ruby.
|
155
155
|
email:
|
156
|
-
-
|
156
|
+
- joe@westernmilling.com
|
157
157
|
executables: []
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
161
|
- ".gitignore"
|
162
|
+
- ".hound.yml"
|
162
163
|
- ".rspec"
|
163
164
|
- ".rubocop.yml"
|
164
165
|
- ".simplecov"
|
@@ -168,26 +169,33 @@ files:
|
|
168
169
|
- README.md
|
169
170
|
- Rakefile
|
170
171
|
- gman_client.gemspec
|
172
|
+
- lib/gman/client.rb
|
171
173
|
- lib/gman_client.rb
|
174
|
+
- lib/gman_client/commodity_merchandising/contracts.rb
|
175
|
+
- lib/gman_client/inventory/items.rb
|
176
|
+
- lib/gman_client/utility.rb
|
172
177
|
- lib/gman_client/version.rb
|
173
178
|
- pkg/gman_client-0.0.1.gem
|
174
179
|
- pkg/gman_client-0.0.2.gem
|
175
180
|
- pkg/gman_client-0.0.3.gem
|
176
181
|
- pkg/gman_client-0.0.4.gem
|
177
182
|
- pkg/gman_client-0.0.5.gem
|
183
|
+
- spec/lib/client_contracts_spec.rb
|
178
184
|
- spec/lib/driver_commission_history_response_spec.rb
|
179
185
|
- spec/lib/driver_response_spec.rb
|
180
186
|
- spec/lib/inventory_item_response_spec.rb
|
181
187
|
- spec/spec_helper.rb
|
182
188
|
- spec/support/gman_adapter.rb
|
189
|
+
- spec/support/shared_contexts.rb
|
183
190
|
- spec/support/vcr.rb
|
191
|
+
- spec/vcr_cassettes/contracts.yml
|
184
192
|
- spec/vcr_cassettes/driver_commission_histories.yml
|
185
193
|
- spec/vcr_cassettes/driver_commission_histories_by_paid_date.yml
|
186
194
|
- spec/vcr_cassettes/drivers.yml
|
187
195
|
- spec/vcr_cassettes/inventory_items.yml
|
188
196
|
- spec/vcr_cassettes/inventory_items_by_id.yml
|
189
197
|
- spec/vcr_cassettes/inventory_items_like_id_description.yml
|
190
|
-
homepage: https://github.com/
|
198
|
+
homepage: https://github.com/westernmilling/gman_client
|
191
199
|
licenses:
|
192
200
|
- MIT
|
193
201
|
metadata: {}
|
@@ -207,17 +215,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
215
|
version: '0'
|
208
216
|
requirements: []
|
209
217
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.4.
|
218
|
+
rubygems_version: 2.4.8
|
211
219
|
signing_key:
|
212
220
|
specification_version: 4
|
213
|
-
summary:
|
221
|
+
summary: Grossman API Client for Ruby
|
214
222
|
test_files:
|
223
|
+
- spec/lib/client_contracts_spec.rb
|
215
224
|
- spec/lib/driver_commission_history_response_spec.rb
|
216
225
|
- spec/lib/driver_response_spec.rb
|
217
226
|
- spec/lib/inventory_item_response_spec.rb
|
218
227
|
- spec/spec_helper.rb
|
219
228
|
- spec/support/gman_adapter.rb
|
229
|
+
- spec/support/shared_contexts.rb
|
220
230
|
- spec/support/vcr.rb
|
231
|
+
- spec/vcr_cassettes/contracts.yml
|
221
232
|
- spec/vcr_cassettes/driver_commission_histories.yml
|
222
233
|
- spec/vcr_cassettes/driver_commission_histories_by_paid_date.yml
|
223
234
|
- spec/vcr_cassettes/drivers.yml
|