easypost 2.1.7 → 2.1.8

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: 93767485a634671d0c97eb7b68725a35d0275a4b
4
- data.tar.gz: 9319e39be6fe88ffc5d3be9bf71254409636d0b2
3
+ metadata.gz: 27f671afab9c3354d08fe18adca0c53a6b4a7e4c
4
+ data.tar.gz: c25c8b164cd7b3b830fd4be8380dc54823c83caf
5
5
  SHA512:
6
- metadata.gz: 86f6d3195b6368f05088f049128a201d57dbb8ba1e34406a55afa7d511d29851bebb38ed9bbf950f0c64da24784ea9ca8f4ba911d5c9315b6ab990efc2029159
7
- data.tar.gz: fa2fd4cc6e585d8c18363f397b3a8e4e217b9daed6c205de3fe05805ba5cb08f7f8cb65d9e29283865fb40526d051e19261c052ab7495140dce5e50e0bef499d
6
+ metadata.gz: cff30106b921be6737f607e7bdacdfd7a6c62254d46ef204167eaf2a89bcc8a16612934e33cbd0f03aa1a718a4efe80da9420573eecad5951e817453e93d4446
7
+ data.tar.gz: 03c9e2c39eeff00ecd6f25896438a25f9eb047c4aeee6b8adf6d8c48cc0bedf5c1de2ef454e67b604d8661bc5dd0d2d3d566321c8c2d81a0c7109e88e713e0f7
data/CHANGELOG CHANGED
@@ -1,3 +1,24 @@
1
+ === 2.1.8 2015-10-21
2
+
3
+ * Added Cancel method for Pickups (thanks Ramie Blatt!)
4
+
5
+
6
+ === 2.1.7 2015-10-05
7
+
8
+ * Fixed Address.create_and_verify and changed how errors are raised (thanks Dimitri Roche!)
9
+ * Require newer version of the multi_json package
10
+
11
+
12
+ === 2.1.6 2015-06-10
13
+
14
+ * Added Address message accessor for backwards compatability
15
+
16
+
17
+ === 2.1.5 2015-06-10
18
+
19
+ * Removed Address.message
20
+
21
+
1
22
  === 2.1.4 2015-06-03
2
23
 
3
24
  * Add Printer and PrintJob resources.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.7
1
+ 2.1.8
@@ -15,5 +15,11 @@ module EasyPost
15
15
  return self
16
16
  end
17
17
 
18
+ def cancel(params={})
19
+ response, api_key = EasyPost.request(:post, url + '/cancel', @api_key, params)
20
+ self.refresh_from(response, @api_key, true)
21
+
22
+ return self
23
+ end
18
24
  end
19
25
  end
data/spec/pickup_spec.rb CHANGED
@@ -3,13 +3,16 @@ require 'spec_helper'
3
3
  describe EasyPost::Pickup do
4
4
  before { EasyPost.api_key = "cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi" }
5
5
 
6
+ let(:shipment) do
7
+ shipment = EasyPost::Shipment.create(
8
+ to_address: ADDRESS[:california],
9
+ from_address: ADDRESS[:missouri],
10
+ parcel: PARCEL[:dimensions]
11
+ )
12
+ end
13
+
6
14
  describe '#create' do
7
15
  it 'creates a pickup and returns rates' do
8
- shipment = EasyPost::Shipment.create(
9
- to_address: ADDRESS[:california],
10
- from_address: ADDRESS[:missouri],
11
- parcel: PARCEL[:dimensions]
12
- )
13
16
  shipment.buy(rate: shipment.lowest_rate("ups", "NextDayAirEarlyAM"))
14
17
  pickup = EasyPost::Pickup.create(
15
18
  address: ADDRESS[:missouri],
@@ -26,11 +29,6 @@ describe EasyPost::Pickup do
26
29
  end
27
30
 
28
31
  it 'fails to create a pickup' do
29
- shipment = EasyPost::Shipment.create(
30
- to_address: ADDRESS[:california],
31
- from_address: ADDRESS[:missouri],
32
- parcel: PARCEL[:dimensions]
33
- )
34
32
  shipment.buy(rate: shipment.lowest_rate("ups", "NextDayAirEarlyAM"))
35
33
  expect { pickup = EasyPost::Pickup.create(
36
34
  address: ADDRESS[:california],
@@ -45,11 +43,6 @@ describe EasyPost::Pickup do
45
43
 
46
44
  describe '#buy' do
47
45
  it 'buys a pickup rate' do
48
- shipment = EasyPost::Shipment.create(
49
- to_address: ADDRESS[:california],
50
- from_address: ADDRESS[:missouri],
51
- parcel: PARCEL[:dimensions]
52
- )
53
46
  shipment.buy(rate: shipment.lowest_rate("ups", "NextDayAirEarlyAM"))
54
47
  pickup = EasyPost::Pickup.create(
55
48
  address: ADDRESS[:california],
@@ -65,4 +58,26 @@ describe EasyPost::Pickup do
65
58
  expect(pickup.confirmation).not_to be_empty
66
59
  end
67
60
  end
61
+
62
+ describe '#cancel' do
63
+ it 'cancels a pickup' do
64
+ shipment.buy(rate: shipment.lowest_rate("ups", "NextDayAirEarlyAM"))
65
+ pickup = EasyPost::Pickup.create(
66
+ address: ADDRESS[:california],
67
+ reference: "buy12345678",
68
+ min_datetime: DateTime.now(),
69
+ max_datetime: DateTime.now() + 14400,
70
+ is_account_address: false,
71
+ instructions: "",
72
+ shipment: shipment
73
+ )
74
+ pickup.buy(pickup.pickup_rates.first)
75
+
76
+ expect(pickup.status).to eq("scheduled")
77
+
78
+ pickup.cancel
79
+
80
+ expect(pickup.status).to eq("canceled")
81
+ end
82
+ end
68
83
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easypost
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.7
4
+ version: 2.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sawyer Bateman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.7'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.7'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '10.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '2.13'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.13'
83
83
  description: Client library for accessing the EasyPost shipping API via Ruby.
@@ -87,7 +87,7 @@ executables:
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - ".gitignore"
90
+ - .gitignore
91
91
  - CHANGELOG
92
92
  - Gemfile
93
93
  - LICENSE
@@ -144,17 +144,17 @@ require_paths:
144
144
  - lib
145
145
  required_ruby_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - ">="
147
+ - - '>='
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - ">="
152
+ - - '>='
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.2.5
157
+ rubygems_version: 2.0.14
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: EasyPost Ruby Client Library