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 +4 -4
- data/CHANGELOG +4 -0
- data/VERSION +1 -1
- data/lib/easypost/order.rb +7 -0
- data/spec/order_spec.rb +24 -0
- data/spec/webhook_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e4ea608f9ed59cd8a5aa358e373884c2b37798f
|
4
|
+
data.tar.gz: 4949b48d8f227a058a28fca0de286eb4b1ccfea7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac2d5c374ddebbf47902f745019154164650f334a48e96b0a21d010e54eb696f7f2bc1be0a5e0b3759dc34018bdad5ac5904b69adb39120aa868b38f1960b700
|
7
|
+
data.tar.gz: 375b18e205f8baea6ca2978f266604910dce987351b88e89df5799a6eb049bba85c9355208ab3b8343a6c99267fd2056b246ff6eef74d80d7a52cacd86b76685
|
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.2
|
data/lib/easypost/order.rb
CHANGED
@@ -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
|
data/spec/order_spec.rb
CHANGED
@@ -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(
|
data/spec/webhook_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|