easypost 2.6.0 → 2.6.1

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: 1b360f6133e438fbd6da1c82a6d3fd896fc6e5c0
4
- data.tar.gz: 0a428545bec4b22c37612d1880b7b9ece706136d
3
+ metadata.gz: 61161e60bf6a4791174a84913e9fc529070d5fb9
4
+ data.tar.gz: d4f2ead98f93b0c7bade87d44dd1ee51975da916
5
5
  SHA512:
6
- metadata.gz: 154082e65747ede8cb1fbb9d06c99ae0ad4d336c7b52fecd8a3c51ab35bfab6dbde9d7a3e04e603e7eb4689b2e7f4419b51be37667ffdd8db6ddbcf695f2528d
7
- data.tar.gz: 8d62d3abafc9f1df1a67199b8653a2ca772ef371c60b3a45f615b663b4d4fbee7c8080743fdc0da3c9a00e9272fa18e513fb69f1da3d58bc6ad031af8a79bd4f
6
+ metadata.gz: 3aa0be9844f2fc9d50e24de2303e75508168308337ac80d9955b7d1fb1ce1d081587b910680ffcf04222c7b399212c737f5c50720e42d4f1477d95212a7df3d9
7
+ data.tar.gz: dbf4390fd05a6b9ba7f5c28934804fead30a595570fffff4ac933df344d2a20899f7153a085f7d0d216533eae9a70e911f5b7d12f3b007e9355f6e708e80a6f3
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 2.6.1 2017-01-19
2
+
3
+ * Updated create method for ScanForms
4
+
1
5
  === 2.6.0 2017-01-17
2
6
 
3
7
  * Add basic CRUD methods for Webhooks
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.6.0
1
+ 2.6.1
@@ -1,4 +1,8 @@
1
1
  module EasyPost
2
2
  class ScanForm < Resource
3
+ def self.create(params={}, api_key=nil)
4
+ response, api_key = EasyPost.request(:post, self.url, api_key, params)
5
+ return Util.convert_to_easypost_object(response, api_key)
6
+ end
3
7
  end
4
8
  end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe EasyPost::ScanForm do
4
+ let(:shipment) do
5
+ shipment = EasyPost::Shipment.create(
6
+ to_address: ADDRESS[:canada],
7
+ from_address: ADDRESS[:california],
8
+ parcel: PARCEL[:dimensions],
9
+ customs_info: CUSTOMS_INFO[:shirt]
10
+ )
11
+
12
+ shipment.buy(
13
+ rate: shipment.lowest_rate("usps")
14
+ )
15
+ end
16
+
17
+ describe '#create' do
18
+ it 'purchases postage for an international shipment' do
19
+ scan_form = EasyPost::ScanForm.create(shipments: [shipment])
20
+
21
+ expect(scan_form.id).not_to be_nil
22
+ expect(scan_form.tracking_codes.first).to eq(shipment.tracking_code)
23
+ end
24
+ end
25
+
26
+ describe '#retrieve' do
27
+ let(:scan_form) { EasyPost::ScanForm.create(shipments: [shipment]) }
28
+
29
+ it 'retrieves the same scan_form' do
30
+ scan_form2 = EasyPost::ScanForm.retrieve(scan_form.id)
31
+
32
+ expect(scan_form2.id).to eq(scan_form.id)
33
+ end
34
+ end
35
+
36
+ describe '#all' do
37
+ let!(:scan_form) { EasyPost::ScanForm.create(shipments: [shipment]) }
38
+
39
+ it 'indexes the scan_forms' do
40
+ params = {page_size: 2}
41
+ scan_forms = EasyPost::ScanForm.all(params)
42
+
43
+ expect(scan_forms["scan_forms"].first.id).to eq(scan_form.id)
44
+ end
45
+ end
46
+ end
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.0
4
+ version: 2.6.1
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-17 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -136,6 +136,7 @@ files:
136
136
  - spec/order_spec.rb
137
137
  - spec/pickup_spec.rb
138
138
  - spec/report_spec.rb
139
+ - spec/scan_form_spec.rb
139
140
  - spec/shipment_spec.rb
140
141
  - spec/spec_helper.rb
141
142
  - spec/support/constant.rb
@@ -175,6 +176,7 @@ test_files:
175
176
  - spec/order_spec.rb
176
177
  - spec/pickup_spec.rb
177
178
  - spec/report_spec.rb
179
+ - spec/scan_form_spec.rb
178
180
  - spec/shipment_spec.rb
179
181
  - spec/spec_helper.rb
180
182
  - spec/support/constant.rb