odfl 1.1.0 → 1.1.1
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 +4 -4
- data/README.md +2 -0
- data/lib/odfl.rb +23 -1
- data/lib/odfl/version.rb +1 -1
- data/spec/lib/odfl_spec.rb +17 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d198de3ab8a6e3ccd62103f3676a8b99cadfa04
|
4
|
+
data.tar.gz: c1dedbf6dc40cb6d6420f969ad0978f5eca37bf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9199a23a640468efd90770db4aa5802edad75fc1a95b01e4a6a2e3a19cea5f3ad09c0473b85276b530d64a18978cb385ca017d766d721abae59293c7b8e64a79
|
7
|
+
data.tar.gz: fc1bc43456f388b8776067d7cdd93dcf7698194c0d59eafd933219917a35e3b7a5a3325f1d659e6861f5f763f9c37499ba239b459055624a9f7107dc4726d032
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ Get Old Dominion Freight Line Shipping Quotes
|
|
8
8
|
[](https://codeclimate.com/github/rmevans1/odfl-gem)
|
9
9
|
[](https://codeclimate.com/github/rmevans1/odfl-gem)
|
10
10
|
[](https://travis-ci.org/rmevans1/odfl-gem)
|
11
|
+
[](https://hakiri.io/github/rmevans1/odfl-gem/master)
|
11
12
|
|
12
13
|
The gem allows you to retrieve shipping quotes from Old Dominion Freight Line.
|
13
14
|
A customer account is required to retrieve customer specific pricing. However,
|
@@ -52,6 +53,7 @@ quote.addFreight(pallet.to_hash)
|
|
52
53
|
|
53
54
|
# Get rates
|
54
55
|
quote.get_rates
|
56
|
+
estimate = quote.get_estimate # Gets the actual estimate from ODFL
|
55
57
|
```
|
56
58
|
|
57
59
|
### Debugging
|
data/lib/odfl.rb
CHANGED
@@ -214,6 +214,18 @@ class Odfl
|
|
214
214
|
self.addAccessorial('COD')
|
215
215
|
end
|
216
216
|
|
217
|
+
# Runs the rate request
|
218
|
+
#
|
219
|
+
# ==== Usage
|
220
|
+
# quote = Odfl.new
|
221
|
+
# assuming all other data has been correctly input
|
222
|
+
# quote.get_rates
|
223
|
+
#
|
224
|
+
# ==== Return Values
|
225
|
+
# true if quote was successfully generated
|
226
|
+
# call quote.get_estimate for the actual estimate information
|
227
|
+
# false if there was an error
|
228
|
+
# call quote.get_error for the error message
|
217
229
|
def get_rates
|
218
230
|
@response = @client.call(:get_rate_estimate, message: { originPostalCode: @originPostalCode,
|
219
231
|
originCountry: @originCountry,
|
@@ -259,20 +271,30 @@ class Odfl
|
|
259
271
|
end
|
260
272
|
end
|
261
273
|
|
274
|
+
# Return the originating service center information
|
262
275
|
def getOriginatingServiceCenter
|
263
276
|
@resultHash[:originating_service_center]
|
264
277
|
end
|
265
278
|
|
279
|
+
# Return the destination service center information
|
266
280
|
def getDestinationServiceCenter
|
267
281
|
@resultHash[:destination_service_center]
|
268
282
|
end
|
269
283
|
|
284
|
+
# Return the estimate information
|
270
285
|
def get_estimate
|
271
286
|
@resultHash[:rate_estimate]
|
272
287
|
end
|
273
288
|
|
289
|
+
# Return the error message if any messages exist
|
290
|
+
# Returns false if no error exist
|
274
291
|
def get_error
|
275
|
-
@resultHash[:error_messages]
|
292
|
+
error = @resultHash[:error_messages]
|
293
|
+
if !error.nil?
|
294
|
+
error[:string]
|
295
|
+
else
|
296
|
+
false
|
297
|
+
end
|
276
298
|
end
|
277
299
|
|
278
300
|
private
|
data/lib/odfl/version.rb
CHANGED
data/spec/lib/odfl_spec.rb
CHANGED
@@ -99,6 +99,23 @@ describe Odfl do
|
|
99
99
|
expect(quote.get_error).to be_a_kind_of(String)
|
100
100
|
end
|
101
101
|
|
102
|
+
it 'get_error function should return false when no errors exist' do
|
103
|
+
quote = Odfl.new
|
104
|
+
|
105
|
+
quote.set_origin(20602)
|
106
|
+
quote.set_destination(90210)
|
107
|
+
|
108
|
+
pallet = OdflFreight.new
|
109
|
+
pallet.ratedClass = 70
|
110
|
+
pallet.weight = 1000
|
111
|
+
quote.addFreight(pallet.to_hash)
|
112
|
+
|
113
|
+
result = quote.get_rates
|
114
|
+
expect(result).to be_truthy
|
115
|
+
|
116
|
+
expect(quote.get_error).to be_falsey
|
117
|
+
end
|
118
|
+
|
102
119
|
it 'should return a valid rate estimate for a valid quote' do
|
103
120
|
quote = Odfl.new
|
104
121
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odfl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.4.
|
122
|
+
rubygems_version: 2.4.4
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Get freight quotes from Old Dominion Freight Line
|