easypost 2.0.13 → 2.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'fedex international' do
4
- before(:all) do
5
- @rates = {}
6
- end
7
-
8
- it 'buys a ground label' do
9
- shipment = EasyPost::Shipment.create(
10
- :to_address => ADDRESS[:canada],
11
- :from_address => ADDRESS[:california],
12
- :parcel => PARCEL[:dimensions],
13
- :customs_info => CUSTOMS_INFO[:shirt]
14
- )
15
- shipment.buy(:rate => shipment.lowest_rate("fedex", "FEDEX_GROUND"))
16
- label = open(shipment.postage_label.label_url)
17
-
18
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
19
- expect(shipment.selected_rate).to be_an_instance_of(EasyPost::Rate)
20
- expect(shipment.selected_rate.service).to eq("FEDEX_GROUND")
21
- expect(shipment.postage_label.label_url).to end_with(".png")
22
- expect(shipment.tracking_code).to start_with("8000")
23
- expect(label.size).to be > 5000
24
-
25
- @rates[:ground] = shipment.selected_rate
26
- end
27
-
28
- it 'buys an air label' do
29
- shipment = EasyPost::Shipment.create(
30
- :to_address => ADDRESS[:canada],
31
- :from_address => ADDRESS[:california],
32
- :parcel => PARCEL[:dimensions],
33
- :customs_info => CUSTOMS_INFO[:shirt]
34
- )
35
- shipment.buy(:rate => shipment.lowest_rate("fedex", "INTERNATIONAL_PRIORITY"))
36
- label = open(shipment.postage_label.label_url)
37
-
38
- expect(shipment.selected_rate.service).to eq("INTERNATIONAL_PRIORITY")
39
- expect(shipment.tracking_code).to start_with("794")
40
- expect(label.size).to be > 20000
41
-
42
- @rates[:air] = shipment.selected_rate
43
- end
44
-
45
- it 'returns no rates for an alcohol shipment', focus: true do
46
- shipment = EasyPost::Shipment.create(
47
- :to_address => ADDRESS[:canada],
48
- :from_address => ADDRESS[:california],
49
- :parcel => PARCEL[:dimensions],
50
- :customs_info => CUSTOMS_INFO[:shirt],
51
- :options => {:alcohol => true}
52
- )
53
-
54
- expect { shipment.lowest_rate("fedex") }.to raise_exception(EasyPost::Error, /No rates found/)
55
- end
56
-
57
- after(:all) do
58
- begin
59
- expect(@rates[:air].rate.to_i).to be > @rates[:ground].rate.to_i
60
- rescue
61
- end
62
- end
63
-
64
- end
@@ -1,79 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'ups domestic' do
4
- before(:all) do
5
- @rates = {}
6
- end
7
-
8
- it 'buys an air label' do
9
- shipment = EasyPost::Shipment.create(
10
- :to_address => ADDRESS[:california],
11
- :from_address => ADDRESS[:missouri],
12
- :parcel => PARCEL[:dimensions]
13
- )
14
- shipment.buy(:rate => shipment.lowest_rate("ups", "NextDayAir"))
15
- label = open(shipment.postage_label.label_url)
16
-
17
-
18
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
19
- expect(shipment.selected_rate).to be_an_instance_of(EasyPost::Rate)
20
- expect(shipment.selected_rate.service).to eq("NextDayAir")
21
- expect(shipment.postage_label.label_url).to end_with(".png")
22
- expect(shipment.tracking_code).to start_with("1Z")
23
- expect(label.size).to be > 5000
24
-
25
- @rates[:next_day_air] = shipment.selected_rate
26
- end
27
-
28
- it 'buys a residential ground label' do
29
- shipment = EasyPost::Shipment.create(
30
- :to_address => ADDRESS[:california],
31
- :from_address => ADDRESS[:missouri],
32
- :parcel => PARCEL[:dimensions],
33
- :options => {:residential_to_address => true}
34
- )
35
- shipment.buy(:rate => shipment.lowest_rate("ups", "Ground"))
36
- label = open(shipment.postage_label.label_url)
37
-
38
- expect(shipment.selected_rate.service).to eq("Ground")
39
- expect(shipment.tracking_code).to start_with("1Z")
40
- expect(label.size).to be > 5000
41
-
42
- @rates[:ground] = shipment.selected_rate
43
- end
44
-
45
- it 'buys a label for an alcoholic shipment and epl2 label' do
46
- shipment = EasyPost::Shipment.create(
47
- :to_address => ADDRESS[:california],
48
- :from_address => ADDRESS[:missouri],
49
- :parcel => PARCEL[:dimensions],
50
- :options => {alcohol: true, label_format: "epl2"}
51
- )
52
- shipment.buy(:rate => shipment.lowest_rate("ups", "Ground"))
53
-
54
- expect(shipment.postage_label.label_url).to end_with(".epl2")
55
- end
56
-
57
- # it 'buys an order with shipment level cod', focus: true do
58
- # order = EasyPost::Order.create(
59
- # to_address: ADDRESS[:california],
60
- # from_address: ADDRESS[:missouri],
61
- # options: {cod_amount: 19.99},
62
- # shipments: [{
63
- # parcel: {length: 8, width: 6, height: 4, weight: 12}
64
- # },{
65
- # parcel: {length: 8, width: 6, height: 4, weight: 12}
66
- # }]
67
- # )
68
- # p order
69
- # # order.buy(carrier: "ups", service: "Ground")
70
- # end
71
-
72
- after(:all) do
73
- begin
74
- expect(@rates[:next_day_air].rate.to_i).to be > @rates[:ground].rate.to_i
75
- rescue
76
- end
77
- end
78
-
79
- end
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'ups international' do
4
- before(:all) do
5
- @rates = {}
6
- end
7
-
8
- it 'buys a UPSStandard label' do
9
- shipment = EasyPost::Shipment.create(
10
- :to_address => ADDRESS[:canada],
11
- :from_address => ADDRESS[:california],
12
- :parcel => PARCEL[:dimensions],
13
- :customs_info => CUSTOMS_INFO[:shirt]
14
- )
15
- shipment.buy(:rate => shipment.lowest_rate("ups", "UPSStandard"))
16
- label = open(shipment.postage_label.label_url)
17
-
18
- expect(shipment).to be_an_instance_of(EasyPost::Shipment)
19
- expect(shipment.selected_rate).to be_an_instance_of(EasyPost::Rate)
20
- expect(shipment.selected_rate.service).to eq("UPSStandard")
21
- expect(shipment.postage_label.label_url).to end_with(".png")
22
- expect(shipment.tracking_code).to start_with("1Z")
23
- expect(label.size).to be > 5000
24
-
25
- @rates[:ground] = shipment.selected_rate
26
- end
27
-
28
- it 'buys an air label' do
29
- shipment = EasyPost::Shipment.create(
30
- :to_address => ADDRESS[:canada],
31
- :from_address => ADDRESS[:california],
32
- :parcel => PARCEL[:dimensions],
33
- :customs_info => CUSTOMS_INFO[:shirt]
34
- )
35
- shipment.buy(:rate => shipment.lowest_rate("ups", "Expedited"))
36
- label = open(shipment.postage_label.label_url)
37
-
38
- expect(shipment.selected_rate.service).to eq("Expedited")
39
- expect(shipment.tracking_code).to start_with("1Z")
40
- expect(label.size).to be > 20000
41
-
42
- @rates[:express] = shipment.selected_rate
43
- end
44
-
45
- it 'returns no rates for an alcohol shipment' do
46
- shipment = EasyPost::Shipment.create(
47
- :to_address => ADDRESS[:canada],
48
- :from_address => ADDRESS[:california],
49
- :parcel => PARCEL[:dimensions],
50
- :customs_info => CUSTOMS_INFO[:shirt],
51
- :options => {:alcohol => true}
52
- )
53
-
54
- expect { shipment.lowest_rate("ups") }.to raise_exception(EasyPost::Error, /No rates found/)
55
- end
56
-
57
- after(:all) do
58
- begin
59
- expect(@rates[:air].rate.to_i).to be > @rates[:ground].rate.to_i
60
- rescue
61
- end
62
- end
63
-
64
- end
@@ -1,66 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'usps domestic' do
4
- before(:all) do
5
- @first = EasyPost::Shipment.create(
6
- :to_address => ADDRESS[:california],
7
- :from_address => ADDRESS[:missouri],
8
- :parcel => PARCEL[:dimensions_light]
9
- )
10
- @first.buy(:rate => @first.lowest_rate("usps", "first"))
11
-
12
- @priority = EasyPost::Shipment.create(
13
- :to_address => ADDRESS[:california],
14
- :from_address => ADDRESS[:missouri],
15
- :parcel => PARCEL[:dimensions]
16
- )
17
- @priority.buy(:rate => @priority.lowest_rate("usps", "priority"))
18
-
19
- @return = EasyPost::Shipment.create(
20
- :to_address => ADDRESS[:california],
21
- :from_address => ADDRESS[:missouri],
22
- :parcel => PARCEL[:dimensions],
23
- :is_return => true
24
- )
25
- @return.buy(:rate => @return.lowest_rate("usps", "priority"))
26
-
27
- end
28
-
29
- it 'buys a first label' do
30
- expect(@first).to be_an_instance_of(EasyPost::Shipment)
31
- expect(@first.selected_rate).to be_an_instance_of(EasyPost::Rate)
32
- expect(@first.selected_rate.service).to eq("First")
33
- expect(@first.postage_label.label_url).to end_with(".png")
34
- expect(@first.tracking_code).to eq("9499907123456123456781")
35
-
36
- label = open(@first.postage_label.label_url)
37
- expect(label.size).to be > 30000
38
- end
39
-
40
- it 'buys a priority label' do
41
- expect(@priority.selected_rate.service).to eq("Priority")
42
- expect(@priority.tracking_code).to eq("9499907123456123456781")
43
-
44
- label = open(@priority.postage_label.label_url)
45
- expect(label.size).to be > 30000
46
- end
47
-
48
- it 'buys a return label' do
49
- expect(@priority.selected_rate.service).to eq("Priority")
50
- expect(@priority.tracking_code).to eq("9499907123456123456781")
51
-
52
- label = open(@priority.postage_label.label_url)
53
- expect(label.size).to be > 30000
54
- end
55
-
56
- it 'omits rates for alcohol shipments' do
57
- shipment = EasyPost::Shipment.create(
58
- :to_address => ADDRESS[:california],
59
- :from_address => ADDRESS[:missouri],
60
- :parcel => PARCEL[:dimensions],
61
- :options => {:alcohol => true}
62
- )
63
- expect { shipment.buy(rate: shipment.lowest_rate('usps')) }.to raise_exception
64
- end
65
-
66
- end
@@ -1,94 +0,0 @@
1
- # require 'spec_helper'
2
-
3
- # describe 'usps electronic merchandise return service' do
4
- # before(:all) do
5
- # @first = EasyPost::Shipment.create(
6
- # :to_address => ADDRESS[:california],
7
- # :from_address => ADDRESS[:missouri],
8
- # :parcel => PARCEL[:dimensions_light],
9
- # :is_return => true
10
- # )
11
- # @first.buy(:rate => @first.lowest_rate("USPSElectronicMerchandiseReturn",
12
- # "First"))
13
-
14
- # @priority = EasyPost::Shipment.create(
15
- # :to_address => ADDRESS[:california],
16
- # :from_address => ADDRESS[:missouri],
17
- # :parcel => PARCEL[:dimensions],
18
- # :is_return => true
19
- # )
20
- # @priority.buy(:rate => @priority.lowest_rate("USPSElectronicMerchandiseReturn",
21
- # "Priority"))
22
-
23
- # @bpm = EasyPost::Shipment.create(
24
- # :to_address => ADDRESS[:california],
25
- # :from_address => ADDRESS[:missouri],
26
- # :parcel => PARCEL[:dimensions_light],
27
- # :is_return => true
28
- # )
29
- # @bpm.buy(:rate => @bpm.lowest_rate("USPSElectronicMerchandiseReturn",
30
- # "BoundPrintedMatter"))
31
-
32
- # @media = EasyPost::Shipment.create(
33
- # :to_address => ADDRESS[:california],
34
- # :from_address => ADDRESS[:missouri],
35
- # :parcel => PARCEL[:dimensions],
36
- # :is_return => true
37
- # )
38
- # @media.buy(:rate => @media.lowest_rate("USPSElectronicMerchandiseReturn",
39
- # "MediaMail"))
40
-
41
- # @library = EasyPost::Shipment.create(
42
- # :to_address => ADDRESS[:california],
43
- # :from_address => ADDRESS[:missouri],
44
- # :parcel => PARCEL[:dimensions],
45
- # :is_return => true
46
- # )
47
- # @library.buy(:rate => @library.lowest_rate("USPSElectronicMerchandiseReturn",
48
- # "LibraryMail"))
49
- # end
50
-
51
- # it 'buys a first label' do
52
- # expect(@first).to be_an_instance_of(EasyPost::Shipment)
53
- # expect(@first.selected_rate).to be_an_instance_of(EasyPost::Rate)
54
- # expect(@first.selected_rate.service).to eq("First")
55
- # expect(@first.postage_label.label_url).to end_with(".png")
56
- # expect(@first.tracking_code).to eq("9499907123456123456781")
57
-
58
- # label = open(@first.postage_label.label_url)
59
- # expect(label.size).to be > 30000
60
- # end
61
-
62
- # it 'buys a priority label' do
63
- # expect(@priority.selected_rate.service).to eq("Priority")
64
- # expect(@priority.tracking_code).to eq("9499907123456123456781")
65
-
66
- # label = open(@priority.postage_label.label_url)
67
- # expect(label.size).to be > 30000
68
- # end
69
-
70
- # it 'buys a bpm label' do
71
- # expect(@bpm.selected_rate.service).to eq("BoundPrintedMatter")
72
- # expect(@bpm.tracking_code).to eq("9499907123456123456781")
73
-
74
- # label = open(@bpm.postage_label.label_url)
75
- # expect(label.size).to be > 30000
76
- # end
77
-
78
- # it 'buys a media mail label' do
79
- # expect(@media.selected_rate.service).to eq("MediaMail")
80
- # expect(@media.tracking_code).to eq("9499907123456123456781")
81
-
82
- # label = open(@media.postage_label.label_url)
83
- # expect(label.size).to be > 30000
84
- # end
85
-
86
- # it 'buys a library mail label' do
87
- # expect(@library.selected_rate.service).to eq("LibraryMail")
88
- # expect(@library.tracking_code).to eq("9499907123456123456781")
89
-
90
- # label = open(@library.postage_label.label_url)
91
- # expect(label.size).to be > 30000
92
- # end
93
-
94
- # end
File without changes