solidus_easypost 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +6 -0
  3. data/.github/stale.yml +4 -4
  4. data/.github_changelog_generator +2 -0
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +3 -0
  7. data/.rubocop_todo.yml +12 -47
  8. data/CHANGELOG.md +113 -0
  9. data/LICENSE +1 -1
  10. data/README.md +111 -21
  11. data/app/controllers/spree/admin/postage_labels_controller.rb +20 -0
  12. data/app/decorators/models/solidus_easypost/spree/carton_decorator.rb +38 -0
  13. data/app/decorators/models/solidus_easypost/spree/shipment_decorator.rb +18 -23
  14. data/app/models/solidus_easypost/parcel_dimension.rb +34 -0
  15. data/app/models/solidus_easypost/return_authorization.rb +2 -13
  16. data/app/overrides/spree/admin/orders/_shipment/add_postage_label.html.erb.deface +10 -0
  17. data/bin/rails +0 -1
  18. data/bin/rails-engine +0 -2
  19. data/bin/rails-sandbox +1 -2
  20. data/bin/sandbox +2 -0
  21. data/config/initializers/webhooks.rb +7 -0
  22. data/config/locales/en.yml +7 -4
  23. data/config/routes.rb +5 -1
  24. data/db/migrate/20201025110912_add_tracker_id_to_cartons.rb +6 -0
  25. data/lib/generators/solidus_easypost/install/install_generator.rb +7 -1
  26. data/lib/generators/solidus_easypost/install/templates/initializer.rb +26 -0
  27. data/lib/solidus_easypost/address_builder.rb +45 -0
  28. data/lib/solidus_easypost/calculator/base_dimension_calculator.rb +28 -0
  29. data/lib/solidus_easypost/calculator/weight_dimension_calculator.rb +22 -0
  30. data/lib/solidus_easypost/configuration.rb +25 -2
  31. data/lib/solidus_easypost/errors/unknown_partial_resource_error.rb +11 -0
  32. data/lib/solidus_easypost/estimator.rb +37 -0
  33. data/lib/solidus_easypost/parcel_builder.rb +27 -0
  34. data/lib/solidus_easypost/shipment_builder.rb +32 -0
  35. data/lib/solidus_easypost/shipping_method_selector.rb +17 -0
  36. data/lib/solidus_easypost/shipping_rate_calculator.rb +9 -0
  37. data/lib/solidus_easypost/testing_support/factories/address_factory.rb +10 -0
  38. data/lib/solidus_easypost/testing_support/factories/product_factory.rb +7 -0
  39. data/lib/solidus_easypost/testing_support/factories/shipment_factory.rb +30 -0
  40. data/lib/solidus_easypost/testing_support/factories/shipping_method_factory.rb +8 -0
  41. data/lib/solidus_easypost/testing_support/factories/stock_location_factory.rb +10 -0
  42. data/lib/solidus_easypost/testing_support/factories/variant_factory.rb +7 -0
  43. data/lib/solidus_easypost/testing_support/factories.rb +3 -0
  44. data/lib/solidus_easypost/tracker_webhook_handler.rb +14 -0
  45. data/lib/solidus_easypost/version.rb +1 -1
  46. data/lib/solidus_easypost.rb +11 -0
  47. data/solidus_easypost.gemspec +8 -5
  48. data/spec/cassettes/{Spree_Address/_easypost_address/is_an_EasyPost_Address_object.yml → address_builder/from_address.yml} +19 -23
  49. data/spec/cassettes/{Spree_StockLocation/_easypost_address/is_an_EasyPost_Address_object.yml → address_builder/from_stock_location.yml} +19 -23
  50. data/spec/cassettes/{Spree_Stock_Estimator/_shipping_rates/when_rates_are_found/when_shipping_methods_exist/when_shipping_methods_are_front_end_visible/has_the_correct_costs.yml → estimator.yml} +0 -0
  51. data/spec/cassettes/integration/checkout.yml +377 -0
  52. data/spec/cassettes/integration/order_shipping/with_purchase_labels.yml +373 -0
  53. data/spec/cassettes/integration/order_shipping/without_purchase_labels.yml +251 -0
  54. data/spec/cassettes/{Spree_Stock_Package/_easypost_parcel/is_an_EasyPost_Parcel_object.yml → parcel_builder/from_package.yml} +17 -22
  55. data/spec/cassettes/{Spree_Stock_Package/_easypost_parcel/has_the_correct_attributes.yml → parcel_builder/from_return_authorization.yml} +17 -22
  56. data/spec/cassettes/postage_labels/show.yml +72 -0
  57. data/spec/cassettes/return_authorization.yml +310 -0
  58. data/spec/cassettes/{Spree_Stock_Package/_easypost_shipment/is_an_EasyPost_Shipment_object.yml → shipment_builder/from_package.yml} +74 -92
  59. data/spec/cassettes/{Spree_Stock_Estimator/_shipping_rates/when_rates_are_found/when_shipping_methods_exist/create_no_new_shipping_methods.yml → shipment_builder/from_return_authorization.yml} +77 -95
  60. data/spec/cassettes/shipment_builder/from_shipment.yml +250 -0
  61. data/spec/controllers/spree/admin/postage_labels_controller_spec.rb +18 -0
  62. data/spec/features/admin/postage_labels_spec.rb +18 -0
  63. data/spec/integration/checkout_spec.rb +45 -0
  64. data/spec/integration/order_shipping_spec.rb +33 -0
  65. data/spec/models/solidus_easypost/parcel_dimension_spec.rb +80 -0
  66. data/spec/models/solidus_easypost/return_authorization_spec.rb +7 -40
  67. data/spec/models/spree/carton_spec.rb +57 -0
  68. data/spec/models/spree/shipment_spec.rb +48 -59
  69. data/spec/models/spree/shipping_rate_spec.rb +14 -7
  70. data/spec/solidus_easypost/address_builder_spec.rb +17 -0
  71. data/spec/solidus_easypost/calculator/weight_dimension_calculator_spec.rb +39 -0
  72. data/spec/solidus_easypost/estimator_spec.rb +52 -0
  73. data/spec/solidus_easypost/parcel_builder_spec.rb +113 -0
  74. data/spec/solidus_easypost/shipment_builder_spec.rb +28 -0
  75. data/spec/solidus_easypost/shipping_method_selector_spec.rb +33 -0
  76. data/spec/solidus_easypost/shipping_rate_calculator_spec.rb +12 -0
  77. data/spec/solidus_easypost/tracker_webhook_handler_spec.rb +58 -0
  78. data/spec/spec_helper.rb +11 -7
  79. data/spec/support/easypost.rb +3 -1
  80. data/spec/support/helpers/api_stubs.rb +40 -0
  81. data/spec/support/helpers/configuration.rb +28 -0
  82. data/spec/support/helpers/shipping_methods.rb +26 -0
  83. data/spec/support/solidus.rb +1 -0
  84. data/spec/support/vcr.rb +1 -0
  85. metadata +118 -85
  86. data/app/decorators/models/solidus_easypost/spree/address_decorator.rb +0 -30
  87. data/app/decorators/models/solidus_easypost/spree/stock/estimator_decorator.rb +0 -15
  88. data/app/decorators/models/solidus_easypost/spree/stock/package_decorator.rb +0 -27
  89. data/app/decorators/models/solidus_easypost/spree/stock_location_decorator.rb +0 -26
  90. data/app/models/solidus_easypost/estimator.rb +0 -51
  91. data/lib/solidus_easypost/factories.rb +0 -24
  92. data/spec/cassettes/SolidusEasypost_ReturnAuthorization/_easypost_shipment/is_an_EasyPost_Shipment_object.yml +0 -271
  93. data/spec/cassettes/SolidusEasypost_ReturnAuthorization/_return_label/has_the_correct_fields.yml +0 -336
  94. data/spec/cassettes/SolidusEasypost_ReturnAuthorization/_return_label/is_an_EasyPost_PackageLabel_object.yml +0 -336
  95. data/spec/cassettes/Spree_Address/_easypost_address/has_the_correct_attributes.yml +0 -69
  96. data/spec/cassettes/Spree_Order/_refresh_shipment_rates/can_get_rates_from_easy_post.yml +0 -271
  97. data/spec/cassettes/Spree_Order/_refresh_shipment_rates/create_shipping_methods_for_the_rates.yml +0 -269
  98. data/spec/cassettes/Spree_Shipment/_buys_a_shipping_rate_after_transitioning_to_ship.yml +0 -403
  99. data/spec/cassettes/Spree_Shipment/_easypost_shipment/when_it_is_a_new_shipment/behaves_like_an_easypost_shipment/is_an_EasyPost_Shipment_object.yml +0 -271
  100. data/spec/cassettes/Spree_Shipment/_easypost_shipment/when_it_is_a_new_shipment/calls_the_api.yml +0 -200
  101. data/spec/cassettes/Spree_Shipment/_easypost_shipment/when_it_is_an_existing_shipment/behaves_like_an_easypost_shipment/is_an_EasyPost_Shipment_object.yml +0 -334
  102. data/spec/cassettes/Spree_Shipment/_easypost_shipment/when_it_is_an_existing_shipment/loads_the_existing_shipment.yml +0 -271
  103. data/spec/cassettes/Spree_StockLocation/_easypost_address/has_the_correct_attributes.yml +0 -69
  104. data/spec/cassettes/Spree_Stock_Estimator/_shipping_rates/when_rates_are_found/when_shipping_methods_dont_exist/creates_new_shipping_methods.yml +0 -269
  105. data/spec/cassettes/Spree_Stock_Estimator/_shipping_rates/when_rates_are_found/when_shipping_methods_dont_exist/is_empty.yml +0 -269
  106. data/spec/cassettes/Spree_Stock_Estimator/_shipping_rates/when_rates_are_found/when_shipping_methods_exist/when_shipping_methods_are_front_end_visible/has_the_correct_names.yml +0 -269
  107. data/spec/cassettes/Spree_Stock_Estimator/_shipping_rates/when_rates_are_found/when_shipping_methods_exist/when_shipping_methods_are_not_front_end_visible/is_empty.yml +0 -269
  108. data/spec/cassettes/Spree_Stock_Package/_easypost_shipment/calls_the_api.yml +0 -200
  109. data/spec/factories/spree_modification.rb +0 -25
  110. data/spec/models/spree/address_spec.rb +0 -31
  111. data/spec/models/spree/order_spec.rb +0 -31
  112. data/spec/models/spree/stock/estimator_spec.rb +0 -80
  113. data/spec/models/spree/stock/package_spec.rb +0 -35
  114. data/spec/models/spree/stock_location_spec.rb +0 -31
  115. data/spec/support/shipping_method_helpers.rb +0 -43
@@ -0,0 +1,310 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.easypost.com/v2/addresses
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"address":{"street1":"131 S 8th Ave","city":"Manville","zip":"08835","phone":"(202)
9
+ 456-1111","name":"NY Warehouse","company":"NY Warehouse","state":"NJ","country":"US"}}'
10
+ headers:
11
+ Accept-Encoding:
12
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
13
+ Accept:
14
+ - "*/*"
15
+ User-Agent:
16
+ - EasyPost/v2 RubyClient/3.1.3 Ruby/2.7.1-p83
17
+ Content-Type:
18
+ - application/json
19
+ Authorization:
20
+ - Basic Q3Z6WXR1ZGE2S1JJOUpqRzdTQUhiQTo=
21
+ response:
22
+ status:
23
+ code: 201
24
+ message: Created
25
+ headers:
26
+ X-Frame-Options:
27
+ - SAMEORIGIN
28
+ X-Xss-Protection:
29
+ - 1; mode=block
30
+ X-Content-Type-Options:
31
+ - nosniff
32
+ X-Ep-Request-Uuid:
33
+ - 3682484b5f6b4b7fee6f1ae4000191be
34
+ Cache-Control:
35
+ - no-cache, no-store, must-revalidate, private
36
+ Pragma:
37
+ - no-cache
38
+ Expires:
39
+ - '0'
40
+ Location:
41
+ - "/api/v2/addresses/adr_ad1bdf209da74b5c888cf690125be7bd"
42
+ Content-Type:
43
+ - application/json; charset=utf-8
44
+ X-Runtime:
45
+ - '0.057388'
46
+ Transfer-Encoding:
47
+ - chunked
48
+ X-Node:
49
+ - bigweb3sj
50
+ X-Version-Label:
51
+ - easypost-202009222104-7ce76ac125-master
52
+ X-Backend:
53
+ - easypost
54
+ X-Proxied:
55
+ - extlb2sj a561deb64e
56
+ - intlb2sj 8df81f0396
57
+ Strict-Transport-Security:
58
+ - max-age=15768000; includeSubDomains; preload
59
+ body:
60
+ encoding: ASCII-8BIT
61
+ string: '{"id":"adr_ad1bdf209da74b5c888cf690125be7bd","object":"Address","created_at":"2020-09-23T13:19:59Z","updated_at":"2020-09-23T13:19:59Z","name":"NY
62
+ Warehouse","company":"NY Warehouse","street1":"131 S 8th Ave","street2":null,"city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"2024561111","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{}}'
63
+ recorded_at: Wed, 23 Sep 2020 13:19:59 GMT
64
+ - request:
65
+ method: post
66
+ uri: https://api.easypost.com/v2/addresses
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"address":{"street1":"A Different Road","street2":"Northwest","city":"Manville","zip":"08835","phone":"555-555-0199","company":"Company","name":"John
70
+ Doe","state":"NJ","country":"US"}}'
71
+ headers:
72
+ Accept-Encoding:
73
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
74
+ Accept:
75
+ - "*/*"
76
+ User-Agent:
77
+ - EasyPost/v2 RubyClient/3.1.3 Ruby/2.7.1-p83
78
+ Content-Type:
79
+ - application/json
80
+ Authorization:
81
+ - Basic Q3Z6WXR1ZGE2S1JJOUpqRzdTQUhiQTo=
82
+ response:
83
+ status:
84
+ code: 201
85
+ message: Created
86
+ headers:
87
+ X-Frame-Options:
88
+ - SAMEORIGIN
89
+ X-Xss-Protection:
90
+ - 1; mode=block
91
+ X-Content-Type-Options:
92
+ - nosniff
93
+ X-Ep-Request-Uuid:
94
+ - 368248505f6b4b7fee725d10000191e0
95
+ Cache-Control:
96
+ - no-cache, no-store, must-revalidate, private
97
+ Pragma:
98
+ - no-cache
99
+ Expires:
100
+ - '0'
101
+ Location:
102
+ - "/api/v2/addresses/adr_df3c1494d8c343f3847eef1dbed24890"
103
+ Content-Type:
104
+ - application/json; charset=utf-8
105
+ X-Runtime:
106
+ - '0.063727'
107
+ Transfer-Encoding:
108
+ - chunked
109
+ X-Node:
110
+ - bigweb3sj
111
+ X-Version-Label:
112
+ - easypost-202009222104-7ce76ac125-master
113
+ X-Backend:
114
+ - easypost
115
+ X-Proxied:
116
+ - extlb2sj a561deb64e
117
+ - intlb2sj 8df81f0396
118
+ Strict-Transport-Security:
119
+ - max-age=15768000; includeSubDomains; preload
120
+ body:
121
+ encoding: ASCII-8BIT
122
+ string: '{"id":"adr_df3c1494d8c343f3847eef1dbed24890","object":"Address","created_at":"2020-09-23T13:20:00Z","updated_at":"2020-09-23T13:20:00Z","name":"John
123
+ Doe","company":"Company","street1":"A Different Road","street2":"Northwest","city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"5555550199","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{}}'
124
+ recorded_at: Wed, 23 Sep 2020 13:20:00 GMT
125
+ - request:
126
+ method: post
127
+ uri: https://api.easypost.com/v2/parcels
128
+ body:
129
+ encoding: UTF-8
130
+ string: '{"parcel":{"weight":10}}'
131
+ headers:
132
+ Accept-Encoding:
133
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
134
+ Accept:
135
+ - "*/*"
136
+ User-Agent:
137
+ - EasyPost/v2 RubyClient/3.1.3 Ruby/2.7.1-p83
138
+ Content-Type:
139
+ - application/json
140
+ Authorization:
141
+ - Basic Q3Z6WXR1ZGE2S1JJOUpqRzdTQUhiQTo=
142
+ response:
143
+ status:
144
+ code: 201
145
+ message: Created
146
+ headers:
147
+ X-Frame-Options:
148
+ - SAMEORIGIN
149
+ X-Xss-Protection:
150
+ - 1; mode=block
151
+ X-Content-Type-Options:
152
+ - nosniff
153
+ X-Ep-Request-Uuid:
154
+ - a371cbc05f6b4b80ee81376100024eef
155
+ Cache-Control:
156
+ - no-cache, no-store, must-revalidate, private
157
+ Pragma:
158
+ - no-cache
159
+ Expires:
160
+ - '0'
161
+ Location:
162
+ - "/api/v2/parcels/prcl_bfd38d1d1c1e4dccb548a3a9fc5147cc"
163
+ Content-Type:
164
+ - application/json; charset=utf-8
165
+ X-Runtime:
166
+ - '0.031429'
167
+ Transfer-Encoding:
168
+ - chunked
169
+ X-Node:
170
+ - bigweb3sj
171
+ X-Version-Label:
172
+ - easypost-202009222104-7ce76ac125-master
173
+ X-Backend:
174
+ - easypost
175
+ X-Proxied:
176
+ - extlb2wdc a561deb64e
177
+ - intlb1wdc 8df81f0396
178
+ - intlb2sj 8df81f0396
179
+ Strict-Transport-Security:
180
+ - max-age=15768000; includeSubDomains; preload
181
+ body:
182
+ encoding: ASCII-8BIT
183
+ string: '{"id":"prcl_bfd38d1d1c1e4dccb548a3a9fc5147cc","object":"Parcel","created_at":"2020-09-23T13:20:00Z","updated_at":"2020-09-23T13:20:00Z","length":null,"width":null,"height":null,"predefined_package":null,"weight":10.0,"mode":"test"}'
184
+ recorded_at: Wed, 23 Sep 2020 13:20:01 GMT
185
+ - request:
186
+ method: post
187
+ uri: https://api.easypost.com/v2/shipments
188
+ body:
189
+ encoding: UTF-8
190
+ string: '{"shipment":{"from_address":{"id":"adr_ad1bdf209da74b5c888cf690125be7bd"},"to_address":{"id":"adr_df3c1494d8c343f3847eef1dbed24890"},"parcel":{"id":"prcl_bfd38d1d1c1e4dccb548a3a9fc5147cc"},"is_return":true}}'
191
+ headers:
192
+ Accept-Encoding:
193
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
194
+ Accept:
195
+ - "*/*"
196
+ User-Agent:
197
+ - EasyPost/v2 RubyClient/3.1.3 Ruby/2.7.1-p83
198
+ Content-Type:
199
+ - application/json
200
+ Authorization:
201
+ - Basic Q3Z6WXR1ZGE2S1JJOUpqRzdTQUhiQTo=
202
+ response:
203
+ status:
204
+ code: 201
205
+ message: Created
206
+ headers:
207
+ X-Frame-Options:
208
+ - SAMEORIGIN
209
+ X-Xss-Protection:
210
+ - 1; mode=block
211
+ X-Content-Type-Options:
212
+ - nosniff
213
+ X-Ep-Request-Uuid:
214
+ - a371cbc25f6b4b81ee72610e00024f0a
215
+ Cache-Control:
216
+ - no-cache, no-store, must-revalidate, private
217
+ Pragma:
218
+ - no-cache
219
+ Expires:
220
+ - '0'
221
+ Location:
222
+ - "/api/v2/shipments/shp_22c2c9a436e94a959898f8d16fc900ea"
223
+ Content-Type:
224
+ - application/json; charset=utf-8
225
+ X-Runtime:
226
+ - '0.190211'
227
+ Transfer-Encoding:
228
+ - chunked
229
+ X-Node:
230
+ - bigweb10sj
231
+ X-Version-Label:
232
+ - easypost-202009222104-7ce76ac125-master
233
+ X-Backend:
234
+ - easypost
235
+ X-Proxied:
236
+ - extlb2wdc a561deb64e
237
+ - intlb1sj 8df81f0396
238
+ - intlb1wdc 8df81f0396
239
+ Strict-Transport-Security:
240
+ - max-age=15768000; includeSubDomains; preload
241
+ body:
242
+ encoding: ASCII-8BIT
243
+ string: '{"created_at":"2020-09-23T13:20:01Z","is_return":true,"messages":[],"mode":"test","options":{"currency":"USD","payment":{"type":"SENDER"},"date_advance":0},"reference":null,"status":"unknown","tracking_code":null,"updated_at":"2020-09-23T13:20:01Z","batch_id":null,"batch_status":null,"batch_message":null,"customs_info":null,"from_address":{"id":"adr_ad1bdf209da74b5c888cf690125be7bd","object":"Address","created_at":"2020-09-23T13:19:59Z","updated_at":"2020-09-23T13:19:59Z","name":"NY
244
+ Warehouse","company":"NY Warehouse","street1":"131 S 8th Ave","street2":null,"city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"2024561111","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{}},"insurance":null,"order_id":null,"parcel":{"id":"prcl_bfd38d1d1c1e4dccb548a3a9fc5147cc","object":"Parcel","created_at":"2020-09-23T13:20:00Z","updated_at":"2020-09-23T13:20:00Z","length":null,"width":null,"height":null,"predefined_package":null,"weight":10.0,"mode":"test"},"postage_label":null,"rates":[{"id":"rate_99aa02b3e0044c2fadf6b633a8d23bea","object":"Rate","created_at":"2020-09-23T13:20:01Z","updated_at":"2020-09-23T13:20:01Z","mode":"test","service":"Priority","carrier":"USPS","rate":"7.02","currency":"USD","retail_rate":"7.50","retail_currency":"USD","list_rate":"7.02","list_currency":"USD","delivery_days":1,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":1,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"},{"id":"rate_8d6e60c2ecb545bb95e36002fd0340c0","object":"Rate","created_at":"2020-09-23T13:20:01Z","updated_at":"2020-09-23T13:20:01Z","mode":"test","service":"First","carrier":"USPS","rate":"3.93","currency":"USD","retail_rate":"5.30","retail_currency":"USD","list_rate":"3.93","list_currency":"USD","delivery_days":2,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":2,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"},{"id":"rate_782dcb056adf448897a23499ffc02432","object":"Rate","created_at":"2020-09-23T13:20:01Z","updated_at":"2020-09-23T13:20:01Z","mode":"test","service":"Express","carrier":"USPS","rate":"23.00","currency":"USD","retail_rate":"26.75","retail_currency":"USD","list_rate":"23.00","list_currency":"USD","delivery_days":null,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":null,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"},{"id":"rate_a96bee8bdf604e538c229436e8d9258b","object":"Rate","created_at":"2020-09-23T13:20:01Z","updated_at":"2020-09-23T13:20:01Z","mode":"test","service":"ParcelSelect","carrier":"USPS","rate":"6.92","currency":"USD","retail_rate":"6.92","retail_currency":"USD","list_rate":"6.92","list_currency":"USD","delivery_days":2,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":2,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"}],"refund_status":null,"scan_form":null,"selected_rate":null,"tracker":null,"to_address":{"id":"adr_df3c1494d8c343f3847eef1dbed24890","object":"Address","created_at":"2020-09-23T13:20:00Z","updated_at":"2020-09-23T13:20:00Z","name":"John
245
+ Doe","company":"Company","street1":"A Different Road","street2":"Northwest","city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"5555550199","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{}},"usps_zone":1,"return_address":{"id":"adr_ad1bdf209da74b5c888cf690125be7bd","object":"Address","created_at":"2020-09-23T13:19:59Z","updated_at":"2020-09-23T13:19:59Z","name":"NY
246
+ Warehouse","company":"NY Warehouse","street1":"131 S 8th Ave","street2":null,"city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"2024561111","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{}},"buyer_address":{"id":"adr_df3c1494d8c343f3847eef1dbed24890","object":"Address","created_at":"2020-09-23T13:20:00Z","updated_at":"2020-09-23T13:20:00Z","name":"John
247
+ Doe","company":"Company","street1":"A Different Road","street2":"Northwest","city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"5555550199","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{}},"forms":[],"fees":[],"id":"shp_22c2c9a436e94a959898f8d16fc900ea","object":"Shipment"}'
248
+ recorded_at: Wed, 23 Sep 2020 13:20:01 GMT
249
+ - request:
250
+ method: post
251
+ uri: https://api.easypost.com/v2/shipments/shp_22c2c9a436e94a959898f8d16fc900ea/buy
252
+ body:
253
+ encoding: UTF-8
254
+ string: '{"rate":{"id":"rate_99aa02b3e0044c2fadf6b633a8d23bea"}}'
255
+ headers:
256
+ Accept-Encoding:
257
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
258
+ Accept:
259
+ - "*/*"
260
+ User-Agent:
261
+ - EasyPost/v2 RubyClient/3.1.3 Ruby/2.7.1-p83
262
+ Content-Type:
263
+ - application/json
264
+ Authorization:
265
+ - Basic Q3Z6WXR1ZGE2S1JJOUpqRzdTQUhiQTo=
266
+ response:
267
+ status:
268
+ code: 200
269
+ message: OK
270
+ headers:
271
+ X-Frame-Options:
272
+ - SAMEORIGIN
273
+ X-Xss-Protection:
274
+ - 1; mode=block
275
+ X-Content-Type-Options:
276
+ - nosniff
277
+ X-Ep-Request-Uuid:
278
+ - 4c4cd68e5f6b4b82ee738b5100018511
279
+ Cache-Control:
280
+ - no-cache, no-store, must-revalidate, private
281
+ Pragma:
282
+ - no-cache
283
+ Expires:
284
+ - '0'
285
+ Content-Type:
286
+ - application/json; charset=utf-8
287
+ X-Runtime:
288
+ - '0.894278'
289
+ Transfer-Encoding:
290
+ - chunked
291
+ X-Node:
292
+ - bigweb6sj
293
+ X-Version-Label:
294
+ - easypost-202009222104-7ce76ac125-master
295
+ X-Backend:
296
+ - easypost
297
+ X-Proxied:
298
+ - extlb1sj a561deb64e
299
+ - intlb1sj 8df81f0396
300
+ Strict-Transport-Security:
301
+ - max-age=15768000; includeSubDomains; preload
302
+ body:
303
+ encoding: ASCII-8BIT
304
+ string: '{"created_at":"2020-09-23T13:20:01Z","is_return":true,"messages":[],"mode":"test","options":{"currency":"USD","payment":{"type":"SENDER"},"date_advance":0},"reference":null,"status":"unknown","tracking_code":"9405500897846050154389","updated_at":"2020-09-23T13:20:03Z","batch_id":null,"batch_status":null,"batch_message":null,"customs_info":null,"from_address":{"id":"adr_ad1bdf209da74b5c888cf690125be7bd","object":"Address","created_at":"2020-09-23T13:19:59Z","updated_at":"2020-09-23T13:19:59Z","name":"NY
305
+ Warehouse","company":"NY Warehouse","street1":"131 S 8th Ave","street2":null,"city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"2024561111","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{"zip4":{"success":true,"errors":[],"details":null},"delivery":{"success":true,"errors":[],"details":{"latitude":40.53993,"longitude":-74.59254,"time_zone":"America/New_York"}}}},"insurance":null,"order_id":null,"parcel":{"id":"prcl_bfd38d1d1c1e4dccb548a3a9fc5147cc","object":"Parcel","created_at":"2020-09-23T13:20:00Z","updated_at":"2020-09-23T13:20:00Z","length":null,"width":null,"height":null,"predefined_package":null,"weight":10.0,"mode":"test"},"postage_label":{"object":"PostageLabel","id":"pl_93efc30222344ea19b905e903259c4b9","created_at":"2020-09-23T13:20:03Z","updated_at":"2020-09-23T13:20:03Z","date_advance":0,"integrated_form":"none","label_date":"2020-09-23T13:20:03Z","label_resolution":300,"label_size":"4x6","label_type":"default","label_file_type":"image/png","label_url":"https://easypost-files.s3-us-west-2.amazonaws.com/files/postage_label/20200923/4b7e369aad50405289fbcbc3a30bbaea.png","label_pdf_url":null,"label_zpl_url":null,"label_epl2_url":null,"label_file":null},"rates":[{"id":"rate_99aa02b3e0044c2fadf6b633a8d23bea","object":"Rate","created_at":"2020-09-23T13:20:01Z","updated_at":"2020-09-23T13:20:01Z","mode":"test","service":"Priority","carrier":"USPS","rate":"7.02","currency":"USD","retail_rate":"7.50","retail_currency":"USD","list_rate":"7.02","list_currency":"USD","delivery_days":1,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":1,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"},{"id":"rate_8d6e60c2ecb545bb95e36002fd0340c0","object":"Rate","created_at":"2020-09-23T13:20:01Z","updated_at":"2020-09-23T13:20:01Z","mode":"test","service":"First","carrier":"USPS","rate":"3.93","currency":"USD","retail_rate":"5.30","retail_currency":"USD","list_rate":"3.93","list_currency":"USD","delivery_days":2,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":2,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"},{"id":"rate_782dcb056adf448897a23499ffc02432","object":"Rate","created_at":"2020-09-23T13:20:01Z","updated_at":"2020-09-23T13:20:01Z","mode":"test","service":"Express","carrier":"USPS","rate":"23.00","currency":"USD","retail_rate":"26.75","retail_currency":"USD","list_rate":"23.00","list_currency":"USD","delivery_days":null,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":null,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"},{"id":"rate_a96bee8bdf604e538c229436e8d9258b","object":"Rate","created_at":"2020-09-23T13:20:01Z","updated_at":"2020-09-23T13:20:01Z","mode":"test","service":"ParcelSelect","carrier":"USPS","rate":"6.92","currency":"USD","retail_rate":"6.92","retail_currency":"USD","list_rate":"6.92","list_currency":"USD","delivery_days":2,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":2,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"}],"refund_status":null,"scan_form":null,"selected_rate":{"id":"rate_99aa02b3e0044c2fadf6b633a8d23bea","object":"Rate","created_at":"2020-09-23T13:20:03Z","updated_at":"2020-09-23T13:20:03Z","mode":"test","service":"Priority","carrier":"USPS","rate":"7.02","currency":"USD","retail_rate":"7.50","retail_currency":"USD","list_rate":"7.02","list_currency":"USD","delivery_days":1,"delivery_date":null,"delivery_date_guaranteed":false,"est_delivery_days":1,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier_account_id":"ca_mtb51Ve0"},"tracker":{"id":"trk_3a9a913d27994308b5aee51606a75e2a","object":"Tracker","mode":"test","tracking_code":"9405500897846050154389","status":"unknown","status_detail":"unknown","created_at":"2020-09-23T13:20:03Z","updated_at":"2020-09-23T13:20:03Z","signed_by":null,"weight":null,"est_delivery_date":null,"shipment_id":"shp_22c2c9a436e94a959898f8d16fc900ea","carrier":"USPS","tracking_details":[],"fees":[],"carrier_detail":null,"public_url":"https://track.easypost.com/djE6dHJrXzNhOWE5MTNkMjc5OTQzMDhiNWFlZTUxNjA2YTc1ZTJh"},"to_address":{"id":"adr_df3c1494d8c343f3847eef1dbed24890","object":"Address","created_at":"2020-09-23T13:20:00Z","updated_at":"2020-09-23T13:20:00Z","name":"John
306
+ Doe","company":"Company","street1":"A Different Road","street2":"Northwest","city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"5555550199","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{}},"usps_zone":1,"return_address":{"id":"adr_ad1bdf209da74b5c888cf690125be7bd","object":"Address","created_at":"2020-09-23T13:19:59Z","updated_at":"2020-09-23T13:19:59Z","name":"NY
307
+ Warehouse","company":"NY Warehouse","street1":"131 S 8th Ave","street2":null,"city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"2024561111","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{"zip4":{"success":true,"errors":[],"details":null},"delivery":{"success":true,"errors":[],"details":{"latitude":40.53993,"longitude":-74.59254,"time_zone":"America/New_York"}}}},"buyer_address":{"id":"adr_df3c1494d8c343f3847eef1dbed24890","object":"Address","created_at":"2020-09-23T13:20:00Z","updated_at":"2020-09-23T13:20:00Z","name":"John
308
+ Doe","company":"Company","street1":"A Different Road","street2":"Northwest","city":"Manville","state":"NJ","zip":"08835","country":"US","phone":"5555550199","email":null,"mode":"test","carrier_facility":null,"residential":null,"federal_tax_id":null,"state_tax_id":null,"verifications":{}},"forms":[],"fees":[{"object":"Fee","type":"LabelFee","amount":"0.01000","charged":true,"refunded":false},{"object":"Fee","type":"PostageFee","amount":"7.02000","charged":true,"refunded":false}],"id":"shp_22c2c9a436e94a959898f8d16fc900ea","object":"Shipment"}'
309
+ recorded_at: Wed, 23 Sep 2020 13:20:03 GMT
310
+ recorded_with: VCR 6.0.0