easypost 3.0.0 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,121 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe EasyPost::CarrierAccount do
4
- before do
5
- EasyPost.api_key = "PRODUCTION API KEY"
6
- end
7
-
8
- # it 'performs retrieve on a carrier account' do
9
- # id = 'ca_r8hLl9jS'
10
- # ca = EasyPost::CarrierAccount.retrieve(id)
11
- #
12
- # expect(ca.id).to eq(id)
13
- # end
14
- #
15
- # context 'perform CRUD functions' do
16
- # it 'performs all basic CRUD actions on a CarrierAccount' do
17
- # original_num_cas = EasyPost::CarrierAccount.all.count
18
- #
19
- # description = "A test Ups Account"
20
- # reference = "RubyClientUpsTestAccount"
21
- #
22
- # created_ca = EasyPost::CarrierAccount.create(
23
- # type: "UpsAccount",
24
- # description: description,
25
- # reference: reference,
26
- # credentials: {
27
- # account_number: "A1A1A1",
28
- # user_id: "UPSDOTCOM_USERNAME",
29
- # password: "UPSDOTCOM_PASSWORD",
30
- # access_license_number: "UPS_ACCESS_LICENSE_NUMBER"
31
- # }
32
- # )
33
- #
34
- # id = created_ca["id"]
35
- #
36
- # interm_num_cas = EasyPost::CarrierAccount.all.count
37
- # expect(interm_num_cas).to eq(original_num_cas + 1)
38
- #
39
- # retrieved_ca = EasyPost::CarrierAccount.retrieve(id)
40
- #
41
- # expect(retrieved_ca["id"]).to eq(created_ca["id"])
42
- # expect(retrieved_ca["description"]).to eq(description)
43
- # expect(retrieved_ca["reference"]).to eq(reference)
44
- #
45
- # updated_description = "An updated description for a test Ups Account"
46
- # updated_account_number = "B2B2B2B2"
47
- # retrieved_ca.description = updated_description
48
- # retrieved_ca.credentials = {
49
- # account_number: updated_account_number,
50
- # user_id: "UPSDOTCOM_USERNAME",
51
- # password: "UPSDOTCOM_PASSWORD",
52
- # access_license_number: "UPS_ACCESS_LICENSE_NUMBER"
53
- # }
54
- # retrieved_ca.save
55
- #
56
- # updated_ca = EasyPost::CarrierAccount.retrieve(id)
57
- # expect(updated_ca["id"]).to eq(created_ca["id"])
58
- # expect(updated_ca["description"]).to eq(updated_description)
59
- # expect(updated_ca["credentials"]["account_number"]).to eq(updated_account_number)
60
- #
61
- # reupdated_account_number = "C3C3C3C3C3"
62
- # updated_user_id = "A_NEW_UPS_USERNAME"
63
- # updated_ca.credentials[:account_number] = reupdated_account_number
64
- # updated_ca.credentials[:user_id] = updated_user_id
65
- # updated_ca.save
66
- #
67
- # reupdated_ca = EasyPost::CarrierAccount.retrieve(id)
68
- # expect(reupdated_ca["id"]).to eq(created_ca["id"])
69
- # expect(reupdated_ca["credentials"]["account_number"]).to eq(reupdated_account_number)
70
- # expect(reupdated_ca["credentials"]["user_id"]).to eq(updated_user_id)
71
- #
72
- # final_ca = reupdated_ca.save
73
- # expect(final_ca["id"]).to eq(created_ca["id"])
74
- # expect(final_ca["credentials"]["account_number"]).to eq(reupdated_account_number)
75
- # expect(final_ca["credentials"]["user_id"]).to eq(updated_user_id)
76
- #
77
- # final_ca.delete
78
- #
79
- # final_num_cas = EasyPost::CarrierAccount.all.count
80
- # expect(final_num_cas).to eq(original_num_cas)
81
- # end
82
- # end
83
- #
84
- # describe '#types' do
85
- # let(:carrier_account_types) { [
86
- # "AsendiaAccount",
87
- # "AustraliaPostAccount",
88
- # "CanadaPostAccount",
89
- # "CanparAccount",
90
- # "ColisPriveAccount",
91
- # "DhlExpressAccount",
92
- # "DhlGlobalMailAccount",
93
- # "FastwayAccount",
94
- # "FedexAccount",
95
- # "FedexSmartpostAccount",
96
- # "GsoAccount",
97
- # "LasershipAccount",
98
- # "LsoAccount",
99
- # "NorcoAccount",
100
- # "NzpostAccount",
101
- # "OntracAccount",
102
- # "PurolatorAccount",
103
- # "RoyalMailAccount",
104
- # "SpeedeeAccount",
105
- # "TntExpressAccount",
106
- # "UpsAccount",
107
- # "UpsMailInnovationsAccount",
108
- # "UpsSurepostAccount"
109
- # ] }
110
- #
111
- # it 'returns the expected list of types' do
112
- # types = EasyPost::CarrierAccount.types
113
- # account_types = types.map(&:type)
114
- #
115
- # for account_type in carrier_account_types
116
- # expect(account_types).to include(account_type)
117
- # end
118
- # end
119
- # end
120
- end
121
-
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe EasyPost::Insurance do
4
- let(:tracking_code) { 'EZ2000000002' }
5
- let(:carrier) { 'usps' }
6
- let(:amount) { 101.00 }
7
-
8
- describe '#create' do
9
- it 'creates an insurance object' do
10
- insurance = EasyPost::Insurance.create(
11
- to_address: ADDRESS[:california],
12
- from_address: ADDRESS[:missouri],
13
- amount: amount,
14
- tracking_code: tracking_code,
15
- carrier: carrier
16
- )
17
-
18
- expect(insurance).to be_a(EasyPost::Insurance)
19
- expect(insurance.id).not_to be_nil
20
- expect(insurance.amount).to eq("101.00000")
21
- expect(insurance.tracking_code).to eq(tracking_code)
22
- expect(insurance.tracker).to be_a(EasyPost::Tracker)
23
- end
24
- end
25
-
26
- describe '#retrieve' do
27
- it 'creates an insurance object' do
28
- id = EasyPost::Insurance.create(
29
- to_address: ADDRESS[:california],
30
- from_address: ADDRESS[:missouri],
31
- amount: amount,
32
- tracking_code: tracking_code,
33
- carrier: carrier
34
- ).id
35
-
36
- insurance = EasyPost::Insurance.retrieve(id)
37
-
38
- expect(insurance).to be_a(EasyPost::Insurance)
39
- expect(insurance.id).to eq(id)
40
- expect(insurance.amount).to eq("101.00000")
41
- expect(insurance.tracking_code).to eq(tracking_code)
42
- expect(insurance.tracker).to be_a(EasyPost::Tracker)
43
- end
44
- end
45
-
46
-
47
- describe '#index' do
48
- it 'retrieves a full page of insurances' do
49
- insurances = EasyPost::Insurance.all(page_size: 5)
50
-
51
- expect(insurances["insurances"].count).to eq(5)
52
- expect(insurances["has_more"]).to eq(true)
53
- end
54
-
55
- it 'retrieves all insurances with given tracking code, up to a page' do
56
- insurances = EasyPost::Insurance.all(tracking_code: tracking_code, page_size: 5)
57
-
58
- expect(insurances["insurances"].count).to eq(5)
59
- expect(insurances["has_more"]).to eq(true)
60
- end
61
-
62
- it 'retrieves all insurances with given tracking code and carrier, up to a page' do
63
- insurances = EasyPost::Insurance.all(tracking_code: tracking_code, carrier: carrier, page_size: 5)
64
-
65
- expect(insurances["insurances"].count).to eq(5)
66
- expect(insurances["has_more"]).to eq(true)
67
- end
68
- end
69
- end
data/spec/item_spec.rb DELETED
@@ -1,105 +0,0 @@
1
- # TODO: fix this
2
- #
3
- #require 'spec_helper'
4
- #
5
- #describe EasyPost::Item do
6
- #
7
- # describe '#create' do
8
- # it 'creates an item object', focus: true do
9
- # item = EasyPost::Item.create(
10
- # name: "Spec Item",
11
- # description: "Spec item description",
12
- # harmonized_code: "66.77.90.10",
13
- # country_of_origin: "US",
14
- # length: 6.0,
15
- # width: 11.8,
16
- # height: 12.5,
17
- # weight: 10.55,
18
- # warehouse_location: "SECTION A",
19
- # value: 96.00,
20
- # sku: "V4C3D5R2Z6",
21
- # upc: "UPCYEAHYOUKNOWME"
22
- # )
23
- # expect(item).to be_an_instance_of(EasyPost::Item)
24
- # expect(item.weight).to eq(10.55)
25
- # expect(item.harmonized_code).to eq("66.77.90.10")
26
- # expect(item.sku).to eq("V4C3D5R2Z6")
27
- # end
28
- #
29
- # it 'fails to create an item object' do
30
- # expect { EasyPost::Item.create(
31
- # length: 6,
32
- # width: 12,
33
- # height: 13,
34
- # weight: 40
35
- # ) }.to raise_exception(EasyPost::Error, /Invalid request, 'name' is required./)
36
- # end
37
- #
38
- # it 'creates an item object with default values' do
39
- # item = EasyPost::Item.create(
40
- # name: "Default Item",
41
- # length: 6.0,
42
- # width: 8.0,
43
- # height: 10,
44
- # weight: 13,
45
- # value: 19.99
46
- # )
47
- # expect(item.description).to be_nil
48
- # end
49
- # end
50
- #
51
- # describe '#retrieve' do
52
- # it 'retrieves an item by id' do
53
- # item = EasyPost::Item.create(
54
- # name: "Test Item",
55
- # sku: "28374662838",
56
- # length: 6.0,
57
- # width: 8.0,
58
- # height: 10,
59
- # weight: 13,
60
- # value: 13.00
61
- # )
62
- # id = item.id
63
- # item = nil
64
- # item = EasyPost::Item.retrieve(id)
65
- #
66
- # expect(item).to be_an_instance_of(EasyPost::Item)
67
- # expect(item.value).to eq("13.00")
68
- # expect(item.sku).to eq("28374662838")
69
- # end
70
- #
71
- # it 'retrieves an item by reference' do
72
- # item_1 = EasyPost::Item.create(
73
- # name: "Test Item",
74
- # reference: "81993736515",
75
- # length: 6.0,
76
- # width: 8.0,
77
- # height: 10,
78
- # weight: 13,
79
- # value: 13.00
80
- # )
81
- # item_2 = EasyPost::Item.retrieve(item_1.reference)
82
- #
83
- # expect(item_2).to be_an_instance_of(EasyPost::Item)
84
- # expect(item_2.reference).to eq(item_1.reference)
85
- # end
86
- #
87
- # it 'retrieves an item by custom reference' do
88
- # item_1 = EasyPost::Item.create(
89
- # name: "Test Item",
90
- # sku: "928273646",
91
- # length: 6.0,
92
- # width: 8.0,
93
- # height: 10,
94
- # weight: 13,
95
- # value: 17.38
96
- # )
97
- # item_2 = EasyPost::Item.retrieve_reference(sku: "928273646")
98
- #
99
- # expect(item_2).to be_an_instance_of(EasyPost::Item)
100
- # expect(item_2.value).to eq("17.38")
101
- # end
102
- # end
103
- #
104
- #end
105
-
data/spec/order_spec.rb DELETED
@@ -1,58 +0,0 @@
1
- require 'spec_helper'
2
-
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
-
28
- describe '#create' do
29
- it 'creates an order out of a single shipment' do
30
- order = EasyPost::Order.create(
31
- to_address: ADDRESS[:california],
32
- from_address: ADDRESS[:missouri],
33
- shipments: [{
34
- parcel: {length: 8, width: 6, height: 4, weight: 12}
35
- }]
36
- )
37
-
38
- expect(order).to be_an_instance_of(EasyPost::Order)
39
- expect(order.shipments.first).to be_an_instance_of(EasyPost::Shipment)
40
- end
41
-
42
- it 'creates an order out of two shipments' do
43
- order = EasyPost::Order.create(
44
- to_address: ADDRESS[:california],
45
- from_address: ADDRESS[:missouri],
46
- carrier_accounts: [{id: "ca_12345678"}],
47
- shipments: [{
48
- parcel: {length: 8, width: 6, height: 4, weight: 12}
49
- },{
50
- parcel: {length: 8, width: 6, height: 4, weight: 12}
51
- }]
52
- )
53
-
54
- expect(order).to be_an_instance_of(EasyPost::Order)
55
- expect(order.shipments.first).to be_an_instance_of(EasyPost::Shipment)
56
- end
57
- end
58
- end
data/spec/pickup_spec.rb DELETED
@@ -1,83 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe EasyPost::Pickup do
4
- before { EasyPost.api_key = "cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi" }
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
-
14
- describe '#create' do
15
- it 'creates a pickup and returns rates' do
16
- shipment.buy(rate: shipment.lowest_rate("ups", "NextDayAirEarlyAM"))
17
- pickup = EasyPost::Pickup.create(
18
- address: ADDRESS[:missouri],
19
- reference: "12345678",
20
- min_datetime: DateTime.now(),
21
- max_datetime: DateTime.now() + 14400,
22
- is_account_address: false,
23
- instructions: "",
24
- shipment: shipment
25
- )
26
-
27
- expect(pickup).to be_an_instance_of(EasyPost::Pickup)
28
- expect(pickup.pickup_rates.first).to be_an_instance_of(EasyPost::PickupRate)
29
- end
30
-
31
- it 'fails to create a pickup' do
32
- shipment.buy(rate: shipment.lowest_rate("ups", "NextDayAirEarlyAM"))
33
- expect { pickup = EasyPost::Pickup.create(
34
- address: ADDRESS[:california],
35
- reference: "12345678",
36
- max_datetime: DateTime.now() + 14400,
37
- is_account_address: false,
38
- instructions: "",
39
- shipment: shipment
40
- ) }.to raise_exception(EasyPost::Error, /Invalid request, 'min_datetime' is required./)
41
- end
42
- end
43
-
44
- describe '#buy' do
45
- it 'buys a pickup rate' do
46
- shipment.buy(rate: shipment.lowest_rate("ups", "NextDayAirEarlyAM"))
47
- pickup = EasyPost::Pickup.create(
48
- address: ADDRESS[:california],
49
- reference: "buy12345678",
50
- min_datetime: DateTime.now(),
51
- max_datetime: DateTime.now() + 14400,
52
- is_account_address: false,
53
- instructions: "",
54
- shipment: shipment
55
- )
56
- pickup.buy(pickup.pickup_rates.first)
57
-
58
- expect(pickup.confirmation).not_to be_empty
59
- end
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
83
- end
data/spec/report_spec.rb DELETED
@@ -1,59 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe EasyPost::Report do
4
- TYPE = 'shipment'
5
- describe '#create' do
6
- it 'creates a report object' do
7
- report = EasyPost::Report.create(
8
- start_date: Date.today - 30,
9
- end_date: Date.today,
10
- type: TYPE
11
- )
12
- expect(report.object).to eq 'ShipmentReport'
13
- expect(['available', 'new']).to include(report.status)
14
- end
15
- end
16
-
17
- describe '#retrieve' do
18
- it 'retrieves a user created report by public_id as a hash' do
19
- report_1 = EasyPost::Report.create(
20
- start_date: Date.today - 30,
21
- end_date: Date.today,
22
- type: TYPE
23
- )
24
- report_2 = EasyPost::Report.retrieve(id: report_1.id)
25
-
26
- expect(report_2.id).to eq(report_1.id)
27
- end
28
-
29
- it 'retrieves a user created report by public_id as a string' do
30
- report_1 = EasyPost::Report.create(
31
- start_date: Date.today - 30,
32
- end_date: Date.today,
33
- type: TYPE
34
- )
35
- report_2 = EasyPost::Report.retrieve(report_1.id)
36
-
37
- expect(report_2.id).to eq(report_1.id)
38
- end
39
- end
40
-
41
- describe '#all' do
42
- it 'retrieves all user created reports' do
43
- report_1 = EasyPost::Report.create(
44
- start_date: Date.today - 25,
45
- end_date: Date.today,
46
- type: TYPE
47
- )
48
-
49
- report_2 = EasyPost::Report.create(
50
- start_date: Date.today - 29,
51
- end_date: Date.today,
52
- type: TYPE
53
- )
54
- reports = EasyPost::Report.all(type: TYPE)
55
-
56
- expect(reports.count).to eq 2
57
- end
58
- end
59
- end
@@ -1,46 +0,0 @@
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
@@ -1,144 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe EasyPost::Shipment do
4
- describe '#create' do
5
- it 'creates a shipment object' do
6
-
7
- shipment = EasyPost::Shipment.create(
8
- to_address: ADDRESS[:california],
9
- from_address: EasyPost::Address.create(ADDRESS[:missouri]),
10
- parcel: EasyPost::Parcel.create(PARCEL[:dimensions])
11
- )
12
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
13
- expect(shipment.from_address).to be_an_instance_of(EasyPost::Address)
14
-
15
- end
16
-
17
- it 'creates a shipment object when options hash contains id' do
18
-
19
- shipment = EasyPost::Shipment.create(
20
- to_address: ADDRESS[:california],
21
- from_address: EasyPost::Address.create(ADDRESS[:missouri]),
22
- parcel: EasyPost::Parcel.create(PARCEL[:dimensions]),
23
- options: OPTIONS[:mws]
24
- )
25
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
26
- expect(shipment.options.fulfiller_order_items.first).to be_an_instance_of(EasyPost::EasyPostObject)
27
-
28
- end
29
- end
30
-
31
- describe '#buy' do
32
- it 'purchases postage for an international shipment' do
33
-
34
- shipment = EasyPost::Shipment.create(
35
- to_address: EasyPost::Address.create(ADDRESS[:canada]),
36
- from_address: ADDRESS[:california],
37
- parcel: EasyPost::Parcel.create(PARCEL[:dimensions]),
38
- customs_info: EasyPost::CustomsInfo.create(CUSTOMS_INFO[:shirt])
39
- )
40
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
41
-
42
- shipment.buy(
43
- rate: shipment.lowest_rate("usps")
44
- )
45
- expect(shipment.postage_label.label_url.length).to be > 0
46
- end
47
-
48
- it 'purchases postage for a domestic shipment' do
49
- shipment = EasyPost::Shipment.create(
50
- to_address: EasyPost::Address.create(ADDRESS[:missouri]),
51
- from_address: ADDRESS[:california],
52
- parcel: EasyPost::Parcel.create(PARCEL[:dimensions])
53
- )
54
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
55
-
56
- shipment.buy(
57
- rate: shipment.lowest_rate("usps")
58
- )
59
- expect(shipment.postage_label.label_url.length).to be > 0
60
- end
61
-
62
- it 'creates and returns a tracker with shipment purchase' do
63
- shipment = EasyPost::Shipment.create(
64
- :to_address => ADDRESS[:missouri],
65
- :from_address => ADDRESS[:california],
66
- :parcel => PARCEL[:dimensions]
67
- )
68
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
69
-
70
- shipment.buy(
71
- :rate => shipment.lowest_rate("usps")
72
- )
73
-
74
- tracker = shipment.tracker
75
- expect(tracker.shipment_id).to eq(shipment.id)
76
- end
77
-
78
- it 'purchases postage when only a rate id is provided' do
79
- shipment = EasyPost::Shipment.create(
80
- :to_address => ADDRESS[:missouri],
81
- :from_address => ADDRESS[:california],
82
- :parcel => PARCEL[:dimensions]
83
- )
84
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
85
-
86
- rate = shipment.rates.first
87
- rate_hash = {id: rate.id}
88
-
89
- shipment.buy(
90
- :rate => rate_hash
91
- )
92
-
93
- expect(shipment.postage_label.label_url.length).to be > 0
94
- tracker = shipment.tracker
95
- expect(tracker.shipment_id).to eq(shipment.id)
96
- end
97
- end
98
-
99
- describe '#insure' do
100
- it 'buys and insures a shipments' do
101
- shipment = EasyPost::Shipment.create(
102
- :to_address => ADDRESS[:missouri],
103
- :from_address => ADDRESS[:california],
104
- :parcel => PARCEL[:dimensions]
105
- )
106
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
107
-
108
- shipment.buy(
109
- :rate => shipment.lowest_rate("usps")
110
- )
111
-
112
- shipment.insure(amount: 100)
113
-
114
- expect(shipment.insurance).to eq("100.00")
115
- end
116
- end
117
-
118
- describe '#lowest_rate' do
119
- context 'domestic shipment' do
120
- before :all do
121
- @shipment = EasyPost::Shipment.create(
122
- to_address: EasyPost::Address.create(ADDRESS[:missouri]),
123
- from_address: ADDRESS[:california],
124
- parcel: EasyPost::Parcel.create(PARCEL[:dimensions])
125
- )
126
- end
127
-
128
- it 'filters negative services' do
129
- rate = @shipment.lowest_rate('USPS', '!MediaMail, !LibraryMail')
130
-
131
- expect(rate.service).to eql('ParcelSelect')
132
- end
133
- end
134
- end
135
-
136
- describe '#retrieve' do
137
- it 'retrieves shipment by tracking_code and correctly sets ID field (this was a bug in python)' do
138
- tracking_code = "LN123456789US"
139
- shipment = EasyPost::Shipment.retrieve(tracking_code)
140
-
141
- expect(shipment.id).not_to eq(tracking_code)
142
- end
143
- end
144
- end
data/spec/spec_helper.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'open-uri'
2
- require 'easypost'
3
-
4
- Dir["./spec/support/**/*.rb"].each { |f| require f }
5
-
6
- RSpec.configure do |config|
7
- config.before(:each) do
8
- EasyPost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
9
- end
10
- end