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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a30fc4c7716e4880cd056dd66644da31b423f577
4
- data.tar.gz: 567fbdde1e965fab69de0fc2bf5a83d4941ab1e2
3
+ metadata.gz: 3d198de3ab8a6e3ccd62103f3676a8b99cadfa04
4
+ data.tar.gz: c1dedbf6dc40cb6d6420f969ad0978f5eca37bf1
5
5
  SHA512:
6
- metadata.gz: 3711ce543943439d54172926c2c9847fcf99c4463a4e292439163741903691ab830004415627360eb4d70117ec2ea69267c49a83c746a7407fc74cd4c4be3ada
7
- data.tar.gz: 8e09d32f020b5e80cfc4f86aa83527102013b5b0b587338126218e9760a458db1f463e9cf036e261950753185249c4414503689eb22158ae14430238f5fdca16
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
  [![Code Climate](https://codeclimate.com/github/rmevans1/odfl-gem/badges/gpa.svg)](https://codeclimate.com/github/rmevans1/odfl-gem)
9
9
  [![Test Coverage](https://codeclimate.com/github/rmevans1/odfl-gem/badges/coverage.svg)](https://codeclimate.com/github/rmevans1/odfl-gem)
10
10
  [![Build Status](https://travis-ci.org/rmevans1/odfl-gem.svg?branch=master)](https://travis-ci.org/rmevans1/odfl-gem)
11
+ [![security](https://hakiri.io/github/rmevans1/odfl-gem/master.svg)](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][:string]
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
@@ -1,3 +1,3 @@
1
1
  class Odfl
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -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.0
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-20 00:00:00.000000000 Z
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.5
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