easypost 2.0.9 → 2.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ === 2.0.10 2013-10-03
2
+
3
+ * API Addition: Event resource added for webhook consumption.
4
+
5
+
1
6
  === 2.0.9 2013-09-19
2
7
 
3
8
  * Interface Change: Changed batch.scan_form to batch.create_scan_form to support the ability to refer to scan forms associated to batches.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- easypost (2.0.4)
4
+ easypost (2.0.10)
5
5
  multi_json (>= 1.0.4, < 2)
6
6
  rest-client (~> 1.4)
7
7
 
@@ -10,7 +10,7 @@ GEM
10
10
  specs:
11
11
  diff-lcs (1.2.4)
12
12
  mime-types (1.23)
13
- multi_json (1.7.8)
13
+ multi_json (1.7.7)
14
14
  rest-client (1.6.7)
15
15
  mime-types (>= 1.16)
16
16
  rspec (2.13.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.9
1
+ 2.0.10
data/lib/easypost.rb CHANGED
@@ -18,6 +18,7 @@ require 'easypost/rate'
18
18
  require 'easypost/postage_label'
19
19
  require 'easypost/scan_form'
20
20
  require 'easypost/refund'
21
+ require 'easypost/event'
21
22
  require 'easypost/batch'
22
23
  require 'easypost/tracker'
23
24
 
@@ -0,0 +1,5 @@
1
+ module EasyPost
2
+ class Event < Resource
3
+
4
+ end
5
+ end
data/lib/easypost/util.rb CHANGED
@@ -24,6 +24,7 @@ module EasyPost
24
24
  'Shipment' => Shipment,
25
25
  'Rate' => Rate,
26
26
  'Refund' => Refund,
27
+ 'Event' => Event,
27
28
  'Batch' => Batch,
28
29
  'Tracker' => Tracker,
29
30
  'PostageLabel' => PostageLabel }
@@ -36,6 +37,7 @@ module EasyPost
36
37
  'shp' => Shipment,
37
38
  'rate' => Rate,
38
39
  'rfnd' => Refund,
40
+ 'evt' => Event,
39
41
  'batch' => Batch,
40
42
  'trk' => Tracker,
41
43
  'pl' => PostageLabel }
@@ -48,8 +50,10 @@ module EasyPost
48
50
  cls = types[cls_name]
49
51
  elsif response[:id] && cls_prefix = response[:id][0..response[:id].index('_')]
50
52
  cls = prefixes[cls_prefix[0..-2]]
53
+ elsif response['id'] && cls_prefix = response['id'][0..response['id'].index('_')]
54
+ cls = prefixes[cls_prefix[0..-2]]
51
55
  end
52
-
56
+
53
57
  cls ||= EasyPostObject
54
58
  return cls.construct_from(response, api_key)
55
59
  else
@@ -4,33 +4,34 @@ describe EasyPost::Shipment do
4
4
 
5
5
  describe '#create' do
6
6
  it 'creates a shipment object' do
7
- from_address = EasyPost::Address.create(
8
- :name => "Benchmark Merchandising",
9
- :street1 => "329 W 18th Street",
10
- :city => "Chicago",
11
- :state => "IL",
12
- :zip => "60616"
13
- )
14
- to_address = EasyPost::Address.create(
15
- :street1 => "902 Broadway 4th Floor",
16
- :city => "New York",
17
- :state => "NY",
18
- :zip => "10010"
19
- )
20
- parcel = EasyPost::Parcel.create(
21
- :weight => 7.2,
22
- :height => 2,
23
- :width => 7.5,
24
- :length => 10.5
7
+ from_address = EasyPost::Address.create(
8
+ :name => "Benchmark Merchandising",
9
+ :street1 => "329 W 18th Street",
10
+ :city => "Chicago",
11
+ :state => "IL",
12
+ :zip => "60616"
25
13
  )
26
-
14
+ to_address = EasyPost::Address.create(
15
+ :street1 => "902 Broadway 4th Floor",
16
+ :city => "New York",
17
+ :state => "NY",
18
+ :zip => "10010"
19
+ )
20
+ parcel = EasyPost::Parcel.create(
21
+ :weight => 7.2,
22
+ :height => 2,
23
+ :width => 7.5,
24
+ :length => 10.5
25
+ )
26
+
27
27
  shipment = EasyPost::Shipment.create(
28
28
  :to_address => to_address,
29
29
  :from_address => from_address,
30
30
  :parcel => parcel
31
31
  )
32
32
  expect(shipment).to be_an_instance_of(EasyPost::Shipment)
33
-
33
+ expect(shipment.from_address).to be_an_instance_of(EasyPost::Address)
34
+
34
35
  end
35
36
  end
36
37
 
@@ -46,7 +47,7 @@ describe EasyPost::Shipment do
46
47
 
47
48
  customs_info = customs_info_poor
48
49
  expect(customs_info).to be_an_instance_of(EasyPost::CustomsInfo)
49
-
50
+
50
51
  shipment = EasyPost::Shipment.create(
51
52
  :to_address => to_address,
52
53
  :from_address => from_address,
@@ -150,7 +151,7 @@ describe EasyPost::Shipment do
150
151
 
151
152
  it 'filters negative services' do
152
153
  rate = @shipment.lowest_rate('USPS', '!MediaMail, !LibraryMail')
153
-
154
+
154
155
  expect(rate.service).to eql('ParcelSelect')
155
156
  end
156
157
  end
@@ -168,4 +169,5 @@ describe EasyPost::Shipment do
168
169
  expect(tracking[:status].length).to be > 0
169
170
  end
170
171
  end
172
+
171
173
  end
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.9
4
+ version: 2.0.10
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-09-19 00:00:00.000000000 Z
12
+ date: 2013-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -88,6 +88,7 @@ files:
88
88
  - lib/easypost/customs_info.rb
89
89
  - lib/easypost/customs_item.rb
90
90
  - lib/easypost/error.rb
91
+ - lib/easypost/event.rb
91
92
  - lib/easypost/object.rb
92
93
  - lib/easypost/parcel.rb
93
94
  - lib/easypost/postage_label.rb