easypost 2.0.10 → 2.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ === 2.0.11 2013-12-16
2
+
3
+ * Added Event.receive method for parsing events sent by webhook.
4
+ * Fixed tests to account for the tracking code returning and array of details instead of a Hash
5
+
6
+
1
7
  === 2.0.10 2013-10-03
2
8
 
3
9
  * API Addition: Event resource added for webhook consumption.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.10
1
+ 2.0.11
@@ -1,5 +1,10 @@
1
+ require 'json'
2
+
1
3
  module EasyPost
2
4
  class Event < Resource
3
-
5
+
6
+ def self.receive(values)
7
+ return EasyPost::Util::convert_to_easypost_object(JSON.parse(values), nil)
8
+ end
4
9
  end
5
10
  end
@@ -40,7 +40,6 @@ describe EasyPost::Shipment do
40
40
  to_address = address_canada
41
41
  from_address = address_california
42
42
  expect(to_address).to be_an_instance_of(EasyPost::Address)
43
- expect(from_address).to be_an_instance_of(EasyPost::Address)
44
43
 
45
44
  parcel = parcel_dimensions
46
45
  expect(parcel).to be_an_instance_of(EasyPost::Parcel)
@@ -65,7 +64,6 @@ describe EasyPost::Shipment do
65
64
  it 'purchases postage for a domestic shipment' do
66
65
  to_address = address_california
67
66
  from_address = address_missouri
68
- expect(to_address).to be_an_instance_of(EasyPost::Address)
69
67
  expect(from_address).to be_an_instance_of(EasyPost::Address)
70
68
 
71
69
  parcel = parcel_dimensions
@@ -89,7 +87,6 @@ describe EasyPost::Shipment do
89
87
  it 'returns a stamp for a domestic shipment' do
90
88
  to_address = address_california
91
89
  from_address = address_missouri
92
- expect(to_address).to be_an_instance_of(EasyPost::Address)
93
90
  expect(from_address).to be_an_instance_of(EasyPost::Address)
94
91
 
95
92
  parcel = parcel_dimensions
@@ -116,7 +113,6 @@ describe EasyPost::Shipment do
116
113
  it 'returns a barcode for a domestic shipment' do
117
114
  to_address = address_california
118
115
  from_address = address_missouri
119
- expect(to_address).to be_an_instance_of(EasyPost::Address)
120
116
  expect(from_address).to be_an_instance_of(EasyPost::Address)
121
117
 
122
118
  parcel = parcel_dimensions
@@ -163,10 +159,9 @@ describe EasyPost::Shipment do
163
159
  :carrier => 'usps',
164
160
  :tracking_code => '9499907123456123456781'
165
161
  })
166
-
167
- expect(tracking).to be_an_instance_of(Hash)
168
- expect(tracking[:tracking_details].length).to be > 0
169
- expect(tracking[:status].length).to be > 0
162
+ expect(tracking).to be_an_instance_of(Array)
163
+ expect(tracking[0][:status].length).to be > 0
164
+ expect(tracking[0][:message].length).to be > 0
170
165
  end
171
166
  end
172
167
 
@@ -16,7 +16,7 @@ def address_canada
16
16
  end
17
17
 
18
18
  def address_california
19
- address = EasyPost::Address.create(
19
+ {
20
20
  :company => 'Simpler Postage Inc',
21
21
  :street1 => '388 Townsend Street',
22
22
  :street2 => 'Apt 20',
@@ -24,8 +24,7 @@ def address_california
24
24
  :state => 'CA',
25
25
  :zip => '94107',
26
26
  :phone => '415-456-7890'
27
- )
28
- return address
27
+ }
29
28
  end
30
29
 
31
30
  def address_missouri
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easypost
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.10
4
+ version: 2.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-03 00:00:00.000000000 Z
12
+ date: 2013-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client