easypost 2.6.1 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61161e60bf6a4791174a84913e9fc529070d5fb9
4
- data.tar.gz: d4f2ead98f93b0c7bade87d44dd1ee51975da916
3
+ metadata.gz: 9e4ea608f9ed59cd8a5aa358e373884c2b37798f
4
+ data.tar.gz: 4949b48d8f227a058a28fca0de286eb4b1ccfea7
5
5
  SHA512:
6
- metadata.gz: 3aa0be9844f2fc9d50e24de2303e75508168308337ac80d9955b7d1fb1ce1d081587b910680ffcf04222c7b399212c737f5c50720e42d4f1477d95212a7df3d9
7
- data.tar.gz: dbf4390fd05a6b9ba7f5c28934804fead30a595570fffff4ac933df344d2a20899f7153a085f7d0d216533eae9a70e911f5b7d12f3b007e9355f6e708e80a6f3
6
+ metadata.gz: ac2d5c374ddebbf47902f745019154164650f334a48e96b0a21d010e54eb696f7f2bc1be0a5e0b3759dc34018bdad5ac5904b69adb39120aa868b38f1960b700
7
+ data.tar.gz: 375b18e205f8baea6ca2978f266604910dce987351b88e89df5799a6eb049bba85c9355208ab3b8343a6c99267fd2056b246ff6eef74d80d7a52cacd86b76685
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 2.6.2 2017-02-14
2
+
3
+ * Added get_rates method for Orders
4
+
1
5
  === 2.6.1 2017-01-19
2
6
 
3
7
  * Updated create method for ScanForms
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.6.1
1
+ 2.6.2
@@ -1,6 +1,13 @@
1
1
  module EasyPost
2
2
  class Order < Resource
3
3
 
4
+ def get_rates(params={})
5
+ response, api_key = EasyPost.request(:get, url + '/rates', @api_key, params)
6
+ self.refresh_from(response, @api_key, true)
7
+
8
+ return self
9
+ end
10
+
4
11
  def buy(params={})
5
12
  if params.instance_of?(EasyPost::Rate)
6
13
  temp = params.clone
@@ -1,6 +1,30 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe EasyPost::Order do
4
+ describe '#get_rates' do
5
+ it 'refreshes rates' do
6
+ order = EasyPost::Order.create(
7
+ to_address: ADDRESS[:california],
8
+ from_address: ADDRESS[:missouri],
9
+ shipments: [{
10
+ parcel: {length: 8, width: 6, height: 4, weight: 12}
11
+ }]
12
+ )
13
+
14
+ expect(order).to be_an_instance_of(EasyPost::Order)
15
+ expect(order.shipments.first).to be_an_instance_of(EasyPost::Shipment)
16
+
17
+ rate_id = order.shipments.first.rates.first.id
18
+ expect(rate_id).not_to be_nil
19
+
20
+ order.get_rates
21
+
22
+ new_rate_id = order.shipments.first.rates.first.id
23
+ expect(new_rate_id).not_to be_nil
24
+ expect(new_rate_id).not_to eq(rate_id)
25
+ end
26
+ end
27
+
4
28
  describe '#create' do
5
29
  it 'creates an order out of a single shipment' do
6
30
  order = EasyPost::Order.create(
@@ -34,7 +34,7 @@ describe EasyPost::Webhook do
34
34
  describe '#index' do
35
35
  it 'indexes with the recently created webhook as the last one' do
36
36
  webhook
37
- webhooks = EasyPost::Webhook.all({})
37
+ webhooks = EasyPost::Webhook.all()
38
38
 
39
39
  hook = webhooks["webhooks"].last
40
40
 
@@ -48,7 +48,7 @@ describe EasyPost::Webhook do
48
48
 
49
49
  describe '#retrieve' do
50
50
  it 'retrieves' do
51
- hook = webhook.update({})
51
+ hook = webhook.update()
52
52
 
53
53
  expect(hook.id).to eq(webhook.id)
54
54
  expect(hook.url).to eq(url)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easypost
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sawyer Bateman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-19 00:00:00.000000000 Z
11
+ date: 2017-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client