easypost 4.13.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +22 -1
  3. data/.gitignore +9 -11
  4. data/.rubocop.yml +6 -1
  5. data/CHANGELOG.md +21 -0
  6. data/Makefile +1 -1
  7. data/README.md +45 -38
  8. data/UPGRADE_GUIDE.md +119 -0
  9. data/VERSION +1 -1
  10. data/easycop.yml +3 -3
  11. data/easypost.gemspec +12 -10
  12. data/lib/easypost/client.rb +129 -0
  13. data/lib/easypost/connection.rb +2 -4
  14. data/lib/easypost/constants.rb +15 -0
  15. data/lib/easypost/errors/api/api_error.rb +106 -0
  16. data/lib/easypost/errors/api/connection_error.rb +6 -0
  17. data/lib/easypost/errors/api/external_api_error.rb +18 -0
  18. data/lib/easypost/errors/api/forbidden_error.rb +6 -0
  19. data/lib/easypost/errors/api/gateway_timeout_error.rb +6 -0
  20. data/lib/easypost/errors/api/internal_server_error.rb +6 -0
  21. data/lib/easypost/errors/api/invalid_request_error.rb +6 -0
  22. data/lib/easypost/errors/api/method_not_allowed_error.rb +6 -0
  23. data/lib/easypost/errors/api/not_found_error.rb +6 -0
  24. data/lib/easypost/errors/api/payment_error.rb +6 -0
  25. data/lib/easypost/errors/api/proxy_error.rb +6 -0
  26. data/lib/easypost/errors/api/rate_limit_error.rb +6 -0
  27. data/lib/easypost/errors/api/redirect_error.rb +6 -0
  28. data/lib/easypost/errors/api/retry_error.rb +6 -0
  29. data/lib/easypost/errors/api/service_unavailable_error.rb +6 -0
  30. data/lib/easypost/errors/api/ssl_error.rb +6 -0
  31. data/lib/easypost/errors/api/timeout_error.rb +6 -0
  32. data/lib/easypost/errors/api/unauthorized_error.rb +6 -0
  33. data/lib/easypost/errors/api/unknown_api_error.rb +6 -0
  34. data/lib/easypost/errors/easy_post_error.rb +7 -0
  35. data/lib/easypost/errors/end_of_pagination_error.rb +7 -0
  36. data/lib/easypost/errors/filtering_error.rb +4 -0
  37. data/lib/easypost/errors/invalid_object_error.rb +4 -0
  38. data/lib/easypost/errors/invalid_parameter_error.rb +11 -0
  39. data/lib/easypost/errors/missing_parameter_error.rb +9 -0
  40. data/lib/easypost/errors/signature_verification_error.rb +4 -0
  41. data/lib/easypost/errors.rb +31 -0
  42. data/lib/easypost/http_client.rb +62 -0
  43. data/lib/easypost/internal_utilities.rb +66 -0
  44. data/lib/easypost/models/address.rb +5 -0
  45. data/lib/easypost/models/api_key.rb +5 -0
  46. data/lib/easypost/models/base.rb +58 -0
  47. data/lib/easypost/models/batch.rb +5 -0
  48. data/lib/easypost/models/brand.rb +5 -0
  49. data/lib/easypost/{carbon_offset.rb → models/carbon_offset.rb} +1 -1
  50. data/lib/easypost/models/carrier_account.rb +5 -0
  51. data/lib/easypost/models/customs_info.rb +5 -0
  52. data/lib/easypost/models/customs_item.rb +5 -0
  53. data/lib/easypost/models/end_shipper.rb +5 -0
  54. data/lib/easypost/models/error.rb +21 -0
  55. data/lib/easypost/models/event.rb +5 -0
  56. data/lib/easypost/models/insurance.rb +6 -0
  57. data/lib/easypost/models/order.rb +9 -0
  58. data/lib/easypost/models/parcel.rb +5 -0
  59. data/lib/easypost/{payload.rb → models/payload.rb} +1 -1
  60. data/lib/easypost/models/payment_method.rb +5 -0
  61. data/lib/easypost/models/pickup.rb +9 -0
  62. data/lib/easypost/{pickup_rate.rb → models/pickup_rate.rb} +1 -1
  63. data/lib/easypost/{postage_label.rb → models/postage_label.rb} +1 -1
  64. data/lib/easypost/models/rate.rb +5 -0
  65. data/lib/easypost/models/referral.rb +5 -0
  66. data/lib/easypost/models/refund.rb +5 -0
  67. data/lib/easypost/models/report.rb +5 -0
  68. data/lib/easypost/models/scan_form.rb +6 -0
  69. data/lib/easypost/models/shipment.rb +10 -0
  70. data/lib/easypost/{tax_identifier.rb → models/tax_identifier.rb} +1 -1
  71. data/lib/easypost/models/tracker.rb +5 -0
  72. data/lib/easypost/models/user.rb +5 -0
  73. data/lib/easypost/models/webhook.rb +6 -0
  74. data/lib/easypost/models.rb +35 -0
  75. data/lib/easypost/services/address.rb +50 -0
  76. data/lib/easypost/services/api_key.rb +8 -0
  77. data/lib/easypost/services/base.rb +27 -0
  78. data/lib/easypost/services/batch.rb +53 -0
  79. data/lib/easypost/services/beta_rate.rb +12 -0
  80. data/lib/easypost/services/beta_referral_customer.rb +40 -0
  81. data/lib/easypost/services/billing.rb +75 -0
  82. data/lib/easypost/services/carrier_account.rb +44 -0
  83. data/lib/easypost/services/carrier_metadata.rb +22 -0
  84. data/lib/easypost/services/customs_info.rb +15 -0
  85. data/lib/easypost/services/customs_item.rb +15 -0
  86. data/lib/easypost/services/end_shipper.rb +31 -0
  87. data/lib/easypost/services/event.rb +32 -0
  88. data/lib/easypost/services/insurance.rb +26 -0
  89. data/lib/easypost/services/order.rb +30 -0
  90. data/lib/easypost/services/parcel.rb +16 -0
  91. data/lib/easypost/services/pickup.rb +40 -0
  92. data/lib/easypost/services/rate.rb +8 -0
  93. data/lib/easypost/services/referral_customer.rb +103 -0
  94. data/lib/easypost/services/refund.rb +26 -0
  95. data/lib/easypost/services/report.rb +42 -0
  96. data/lib/easypost/services/scan_form.rb +25 -0
  97. data/lib/easypost/services/shipment.rb +106 -0
  98. data/lib/easypost/services/tracker.rb +38 -0
  99. data/lib/easypost/services/user.rb +66 -0
  100. data/lib/easypost/services/webhook.rb +34 -0
  101. data/lib/easypost/services.rb +32 -0
  102. data/lib/easypost/util.rb +80 -187
  103. data/lib/easypost/utilities/constants.rb +5 -0
  104. data/lib/easypost/utilities/json.rb +23 -0
  105. data/lib/easypost/utilities/static_mapper.rb +73 -0
  106. data/lib/easypost/utilities/system.rb +36 -0
  107. data/lib/easypost.rb +12 -138
  108. metadata +147 -64
  109. data/lib/easypost/address.rb +0 -55
  110. data/lib/easypost/api_key.rb +0 -5
  111. data/lib/easypost/batch.rb +0 -52
  112. data/lib/easypost/beta/end_shipper.rb +0 -44
  113. data/lib/easypost/beta/payment_refund.rb +0 -5
  114. data/lib/easypost/beta/rate.rb +0 -14
  115. data/lib/easypost/beta/referral.rb +0 -158
  116. data/lib/easypost/beta.rb +0 -8
  117. data/lib/easypost/billing.rb +0 -72
  118. data/lib/easypost/brand.rb +0 -13
  119. data/lib/easypost/carrier_account.rb +0 -26
  120. data/lib/easypost/carrier_type.rb +0 -5
  121. data/lib/easypost/customs_info.rb +0 -9
  122. data/lib/easypost/customs_item.rb +0 -9
  123. data/lib/easypost/end_shipper.rb +0 -26
  124. data/lib/easypost/error.rb +0 -32
  125. data/lib/easypost/event.rb +0 -38
  126. data/lib/easypost/insurance.rb +0 -20
  127. data/lib/easypost/object.rb +0 -171
  128. data/lib/easypost/order.rb +0 -37
  129. data/lib/easypost/parcel.rb +0 -9
  130. data/lib/easypost/payment_method.rb +0 -12
  131. data/lib/easypost/pickup.rb +0 -47
  132. data/lib/easypost/rate.rb +0 -9
  133. data/lib/easypost/referral.rb +0 -117
  134. data/lib/easypost/refund.rb +0 -19
  135. data/lib/easypost/report.rb +0 -44
  136. data/lib/easypost/resource.rb +0 -124
  137. data/lib/easypost/scan_form.rb +0 -26
  138. data/lib/easypost/shipment.rb +0 -186
  139. data/lib/easypost/tracker.rb +0 -43
  140. data/lib/easypost/user.rb +0 -74
  141. data/lib/easypost/webhook.rb +0 -57
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: 4.13.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - EasyPost Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-04 00:00:00.000000000 Z
11
+ date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brakeman
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '5.4'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '5.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.7.5
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.7.5
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: pry
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +58,14 @@ dependencies:
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '4.0'
61
+ version: '5.1'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '4.0'
68
+ version: '5.1'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -72,70 +86,70 @@ dependencies:
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '6.4'
89
+ version: '6.5'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '6.4'
96
+ version: '6.5'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '3.10'
103
+ version: '3.12'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '3.10'
110
+ version: '3.12'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rubocop
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - '='
115
+ - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '1.27'
117
+ version: '1.49'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - '='
122
+ - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '1.27'
124
+ version: '1.49'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rubocop-rspec
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - '='
116
130
  - !ruby/object:Gem::Version
117
- version: '2.10'
131
+ version: '2.19'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - '='
123
137
  - !ruby/object:Gem::Version
124
- version: '2.10'
138
+ version: '2.19'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: simplecov
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '0.21'
145
+ version: '0.22'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '0.21'
152
+ version: '0.22'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: simplecov-lcov
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -150,34 +164,48 @@ dependencies:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0.8'
167
+ - !ruby/object:Gem::Dependency
168
+ name: typhoeus
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 1.4.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 1.4.0
153
181
  - !ruby/object:Gem::Dependency
154
182
  name: vcr
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
- - - '='
185
+ - - "~>"
158
186
  - !ruby/object:Gem::Version
159
- version: '6.0'
187
+ version: '6.1'
160
188
  type: :development
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
- - - '='
192
+ - - "~>"
165
193
  - !ruby/object:Gem::Version
166
- version: '6.0'
194
+ version: '6.1'
167
195
  - !ruby/object:Gem::Dependency
168
196
  name: webmock
169
197
  requirement: !ruby/object:Gem::Requirement
170
198
  requirements:
171
199
  - - "~>"
172
200
  - !ruby/object:Gem::Version
173
- version: '3.14'
201
+ version: '3.18'
174
202
  type: :development
175
203
  prerelease: false
176
204
  version_requirements: !ruby/object:Gem::Requirement
177
205
  requirements:
178
206
  - - "~>"
179
207
  - !ruby/object:Gem::Version
180
- version: '3.14'
208
+ version: '3.18'
181
209
  description: Client library for accessing the EasyPost shipping API via Ruby.
182
210
  email: oss@easypost.com
183
211
  executables:
@@ -206,47 +234,102 @@ files:
206
234
  - easycop.yml
207
235
  - easypost.gemspec
208
236
  - lib/easypost.rb
209
- - lib/easypost/address.rb
210
- - lib/easypost/api_key.rb
211
- - lib/easypost/batch.rb
212
- - lib/easypost/beta.rb
213
- - lib/easypost/beta/end_shipper.rb
214
- - lib/easypost/beta/payment_refund.rb
215
- - lib/easypost/beta/rate.rb
216
- - lib/easypost/beta/referral.rb
217
- - lib/easypost/billing.rb
218
- - lib/easypost/brand.rb
219
- - lib/easypost/carbon_offset.rb
220
- - lib/easypost/carrier_account.rb
221
- - lib/easypost/carrier_type.rb
237
+ - lib/easypost/client.rb
222
238
  - lib/easypost/connection.rb
223
- - lib/easypost/customs_info.rb
224
- - lib/easypost/customs_item.rb
225
- - lib/easypost/end_shipper.rb
226
- - lib/easypost/error.rb
227
- - lib/easypost/event.rb
228
- - lib/easypost/insurance.rb
229
- - lib/easypost/object.rb
230
- - lib/easypost/order.rb
231
- - lib/easypost/parcel.rb
232
- - lib/easypost/payload.rb
233
- - lib/easypost/payment_method.rb
234
- - lib/easypost/pickup.rb
235
- - lib/easypost/pickup_rate.rb
236
- - lib/easypost/postage_label.rb
237
- - lib/easypost/rate.rb
238
- - lib/easypost/referral.rb
239
- - lib/easypost/refund.rb
240
- - lib/easypost/report.rb
241
- - lib/easypost/resource.rb
242
- - lib/easypost/scan_form.rb
243
- - lib/easypost/shipment.rb
244
- - lib/easypost/tax_identifier.rb
245
- - lib/easypost/tracker.rb
246
- - lib/easypost/user.rb
239
+ - lib/easypost/constants.rb
240
+ - lib/easypost/errors.rb
241
+ - lib/easypost/errors/api/api_error.rb
242
+ - lib/easypost/errors/api/connection_error.rb
243
+ - lib/easypost/errors/api/external_api_error.rb
244
+ - lib/easypost/errors/api/forbidden_error.rb
245
+ - lib/easypost/errors/api/gateway_timeout_error.rb
246
+ - lib/easypost/errors/api/internal_server_error.rb
247
+ - lib/easypost/errors/api/invalid_request_error.rb
248
+ - lib/easypost/errors/api/method_not_allowed_error.rb
249
+ - lib/easypost/errors/api/not_found_error.rb
250
+ - lib/easypost/errors/api/payment_error.rb
251
+ - lib/easypost/errors/api/proxy_error.rb
252
+ - lib/easypost/errors/api/rate_limit_error.rb
253
+ - lib/easypost/errors/api/redirect_error.rb
254
+ - lib/easypost/errors/api/retry_error.rb
255
+ - lib/easypost/errors/api/service_unavailable_error.rb
256
+ - lib/easypost/errors/api/ssl_error.rb
257
+ - lib/easypost/errors/api/timeout_error.rb
258
+ - lib/easypost/errors/api/unauthorized_error.rb
259
+ - lib/easypost/errors/api/unknown_api_error.rb
260
+ - lib/easypost/errors/easy_post_error.rb
261
+ - lib/easypost/errors/end_of_pagination_error.rb
262
+ - lib/easypost/errors/filtering_error.rb
263
+ - lib/easypost/errors/invalid_object_error.rb
264
+ - lib/easypost/errors/invalid_parameter_error.rb
265
+ - lib/easypost/errors/missing_parameter_error.rb
266
+ - lib/easypost/errors/signature_verification_error.rb
267
+ - lib/easypost/http_client.rb
268
+ - lib/easypost/internal_utilities.rb
269
+ - lib/easypost/models.rb
270
+ - lib/easypost/models/address.rb
271
+ - lib/easypost/models/api_key.rb
272
+ - lib/easypost/models/base.rb
273
+ - lib/easypost/models/batch.rb
274
+ - lib/easypost/models/brand.rb
275
+ - lib/easypost/models/carbon_offset.rb
276
+ - lib/easypost/models/carrier_account.rb
277
+ - lib/easypost/models/customs_info.rb
278
+ - lib/easypost/models/customs_item.rb
279
+ - lib/easypost/models/end_shipper.rb
280
+ - lib/easypost/models/error.rb
281
+ - lib/easypost/models/event.rb
282
+ - lib/easypost/models/insurance.rb
283
+ - lib/easypost/models/order.rb
284
+ - lib/easypost/models/parcel.rb
285
+ - lib/easypost/models/payload.rb
286
+ - lib/easypost/models/payment_method.rb
287
+ - lib/easypost/models/pickup.rb
288
+ - lib/easypost/models/pickup_rate.rb
289
+ - lib/easypost/models/postage_label.rb
290
+ - lib/easypost/models/rate.rb
291
+ - lib/easypost/models/referral.rb
292
+ - lib/easypost/models/refund.rb
293
+ - lib/easypost/models/report.rb
294
+ - lib/easypost/models/scan_form.rb
295
+ - lib/easypost/models/shipment.rb
296
+ - lib/easypost/models/tax_identifier.rb
297
+ - lib/easypost/models/tracker.rb
298
+ - lib/easypost/models/user.rb
299
+ - lib/easypost/models/webhook.rb
300
+ - lib/easypost/services.rb
301
+ - lib/easypost/services/address.rb
302
+ - lib/easypost/services/api_key.rb
303
+ - lib/easypost/services/base.rb
304
+ - lib/easypost/services/batch.rb
305
+ - lib/easypost/services/beta_rate.rb
306
+ - lib/easypost/services/beta_referral_customer.rb
307
+ - lib/easypost/services/billing.rb
308
+ - lib/easypost/services/carrier_account.rb
309
+ - lib/easypost/services/carrier_metadata.rb
310
+ - lib/easypost/services/customs_info.rb
311
+ - lib/easypost/services/customs_item.rb
312
+ - lib/easypost/services/end_shipper.rb
313
+ - lib/easypost/services/event.rb
314
+ - lib/easypost/services/insurance.rb
315
+ - lib/easypost/services/order.rb
316
+ - lib/easypost/services/parcel.rb
317
+ - lib/easypost/services/pickup.rb
318
+ - lib/easypost/services/rate.rb
319
+ - lib/easypost/services/referral_customer.rb
320
+ - lib/easypost/services/refund.rb
321
+ - lib/easypost/services/report.rb
322
+ - lib/easypost/services/scan_form.rb
323
+ - lib/easypost/services/shipment.rb
324
+ - lib/easypost/services/tracker.rb
325
+ - lib/easypost/services/user.rb
326
+ - lib/easypost/services/webhook.rb
247
327
  - lib/easypost/util.rb
328
+ - lib/easypost/utilities/constants.rb
329
+ - lib/easypost/utilities/json.rb
330
+ - lib/easypost/utilities/static_mapper.rb
331
+ - lib/easypost/utilities/system.rb
248
332
  - lib/easypost/version.rb
249
- - lib/easypost/webhook.rb
250
333
  homepage: https://www.easypost.com/docs
251
334
  licenses:
252
335
  - MIT
@@ -259,14 +342,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
259
342
  requirements:
260
343
  - - ">="
261
344
  - !ruby/object:Gem::Version
262
- version: '2.5'
345
+ version: '2.6'
263
346
  required_rubygems_version: !ruby/object:Gem::Requirement
264
347
  requirements:
265
348
  - - ">="
266
349
  - !ruby/object:Gem::Version
267
350
  version: '0'
268
351
  requirements: []
269
- rubygems_version: 3.3.26
352
+ rubygems_version: 3.4.10
270
353
  signing_key:
271
354
  specification_version: 4
272
355
  summary: EasyPost Ruby Client Library
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Address objects are used to represent people, places, and organizations in a number of contexts.
4
- class EasyPost::Address < EasyPost::Resource
5
- attr_accessor :message # Backwards compatibility
6
-
7
- # Create an Address.
8
- def self.create(params = {}, api_key = nil)
9
- address = params.reject { |k, _| [:verify, :verify_strict].include?(k) }
10
-
11
- wrapped_params = { address: address }
12
-
13
- if params[:verify]
14
- wrapped_params[:verify] = params[:verify]
15
- end
16
-
17
- if params[:verify_strict]
18
- wrapped_params[:verify_strict] = params[:verify_strict]
19
- end
20
-
21
- response = EasyPost.make_request(:post, url, api_key, wrapped_params)
22
- EasyPost::Util.convert_to_easypost_object(response, api_key)
23
- end
24
-
25
- # Create and verify an Address in one call.
26
- def self.create_and_verify(params = {}, api_key = nil)
27
- wrapped_params = {}
28
- wrapped_params[class_name.to_sym] = params
29
- response = EasyPost.make_request(:post, "#{url}/create_and_verify", api_key, wrapped_params)
30
-
31
- EasyPost::Util.convert_to_easypost_object(response['address'], api_key)
32
- end
33
-
34
- # Verify an Address.
35
- def verify
36
- response = EasyPost.make_request(:get, "#{url}/verify", @api_key)
37
-
38
- EasyPost::Util.convert_to_easypost_object(response['address'], api_key)
39
- end
40
-
41
- # Get the next page of addresses.
42
- def self.get_next_page(collection, page_size = nil)
43
- get_next_page_exec(method(:all), collection, collection.addresses, page_size)
44
- end
45
-
46
- # Build the next page parameters.
47
- def self.build_next_page_params(_collection, current_page_items, page_size = nil)
48
- params = {}
49
- params[:before_id] = current_page_items.last.id
50
- unless page_size.nil?
51
- params[:page_size] = page_size
52
- end
53
- params
54
- end
55
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # An ApiKey allows you to authenticate with the EasyPost API.
4
- class EasyPost::ApiKey < EasyPost::Resource
5
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # The Batch object allows you to perform operations on multiple Shipments at once.
4
- class EasyPost::Batch < EasyPost::Resource
5
- # Create and buy a batch in one call.
6
- def self.create_and_buy(params = {}, api_key = nil)
7
- wrapped_params = {}
8
- wrapped_params[class_name.to_sym] = params
9
- response = EasyPost.make_request(:post, "#{url}/create_and_buy", api_key, wrapped_params)
10
-
11
- EasyPost::Util.convert_to_easypost_object(response, api_key)
12
- end
13
-
14
- # Buy a Batch.
15
- def buy(params = {})
16
- response = EasyPost.make_request(:post, "#{url}/buy", @api_key, params)
17
- refresh_from(response, @api_key)
18
-
19
- self
20
- end
21
-
22
- # Convert the label format of a Batch.
23
- def label(params = {})
24
- response = EasyPost.make_request(:post, "#{url}/label", @api_key, params)
25
- refresh_from(response, @api_key)
26
-
27
- self
28
- end
29
-
30
- # Remove Shipments from a Batch.
31
- def remove_shipments(params = {})
32
- response = EasyPost.make_request(:post, "#{url}/remove_shipments", @api_key, params)
33
- refresh_from(response, @api_key)
34
-
35
- self
36
- end
37
-
38
- # Add Shipments to a Batch.
39
- def add_shipments(params = {})
40
- response = EasyPost.make_request(:post, "#{url}/add_shipments", @api_key, params)
41
- refresh_from(response, @api_key)
42
-
43
- self
44
- end
45
-
46
- # Create a ScanForm for a Batch.
47
- def create_scan_form(params = {})
48
- EasyPost.make_request(:post, "#{url}/scan_form", @api_key, params)
49
- end
50
-
51
- # TODO: Add support getting the next page of batches when the API supports it.
52
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # EndShipper objects are fully-qualified Address objects that require all parameters and get verified upon creation.
4
- class EasyPost::Beta::EndShipper < EasyPost::Resource
5
- # Create an EndShipper object.
6
- # <b>DEPRECATED:</b> Please use <tt>EndShipper</tt> in the main namespace instead.
7
- def self.create(params = {}, api_key = nil)
8
- warn '[DEPRECATION] Please use `EndShipper.create` in the main namespace instead.'
9
- response = EasyPost.make_request(:post, '/beta/end_shippers', api_key, { address: params })
10
- EasyPost::Util.convert_to_easypost_object(response, api_key)
11
- end
12
-
13
- # Retrieves an EndShipper object.
14
- # <b>DEPRECATED:</b> Please use <tt>EndShipper</tt> in the main namespace instead.
15
- def self.retrieve(id, params = {}, api_key = nil)
16
- warn '[DEPRECATION] Please use `EndShipper.retrieve` in the main namespace instead.'
17
- response = EasyPost.make_request(:get, "/beta/end_shippers/#{id}", api_key, params)
18
- EasyPost::Util.convert_to_easypost_object(response, api_key)
19
- end
20
-
21
- # Retrieves a list of EndShipper objects.
22
- # <b>DEPRECATED:</b> Please use <tt>EndShipper</tt> in the main namespace instead.
23
- def self.all(params = {}, api_key = nil)
24
- warn '[DEPRECATION] Please use `EndShipper.all` in the main namespace instead.'
25
- response = EasyPost.make_request(:get, '/beta/end_shippers', api_key, params)
26
- EasyPost::Util.convert_to_easypost_object(response, api_key)
27
- end
28
-
29
- # Updates (saves) an EndShipper object. This requires all parameters to be set.
30
- # <b>DEPRECATED:</b> Please use <tt>EndShipper</tt> in the main namespace instead.
31
- def save
32
- warn '[DEPRECATION] Please use `endShipper.save` in the main namespace instead.'
33
- if @unsaved_values.length.positive?
34
- values = {}
35
- @unsaved_values.each { |k| values[k] = @values[k] }
36
-
37
- wrapped_params = { address: values }
38
-
39
- response = EasyPost.make_request(:put, "/beta/end_shippers/#{id}", @api_key, wrapped_params)
40
- refresh_from(response, api_key)
41
- end
42
- self
43
- end
44
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # PaymentRefund objects represent a refund of a payment.
4
- class EasyPost::Beta::PaymentRefund < EasyPost::Resource
5
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # A Rate object contains all the details about the rate of a Shipment.
4
- class EasyPost::Beta::Rate < EasyPost::Resource
5
- # Retrieve a list of stateless rates.
6
- def self.retrieve_stateless_rates(params = {}, api_key = nil)
7
- wrapped_params = {
8
- shipment: params,
9
- }
10
-
11
- response = EasyPost.make_request(:post, '/beta/rates', api_key, wrapped_params)
12
- EasyPost::Util.convert_to_easypost_object(response['rates'], api_key)
13
- end
14
- end