easypost 4.13.1 → 5.0.1

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 +24 -1
  3. data/.gitignore +11 -11
  4. data/CHANGELOG.md +23 -2
  5. data/Makefile +15 -10
  6. data/README.md +49 -39
  7. data/UPGRADE_GUIDE.md +119 -0
  8. data/VERSION +1 -1
  9. data/easypost.gemspec +12 -10
  10. data/lib/easypost/client.rb +129 -0
  11. data/lib/easypost/connection.rb +2 -4
  12. data/lib/easypost/constants.rb +15 -0
  13. data/lib/easypost/errors/api/api_error.rb +106 -0
  14. data/lib/easypost/errors/api/connection_error.rb +6 -0
  15. data/lib/easypost/errors/api/external_api_error.rb +18 -0
  16. data/lib/easypost/errors/api/forbidden_error.rb +6 -0
  17. data/lib/easypost/errors/api/gateway_timeout_error.rb +6 -0
  18. data/lib/easypost/errors/api/internal_server_error.rb +6 -0
  19. data/lib/easypost/errors/api/invalid_request_error.rb +6 -0
  20. data/lib/easypost/errors/api/method_not_allowed_error.rb +6 -0
  21. data/lib/easypost/errors/api/not_found_error.rb +6 -0
  22. data/lib/easypost/errors/api/payment_error.rb +6 -0
  23. data/lib/easypost/errors/api/proxy_error.rb +6 -0
  24. data/lib/easypost/errors/api/rate_limit_error.rb +6 -0
  25. data/lib/easypost/errors/api/redirect_error.rb +6 -0
  26. data/lib/easypost/errors/api/retry_error.rb +6 -0
  27. data/lib/easypost/errors/api/service_unavailable_error.rb +6 -0
  28. data/lib/easypost/errors/api/ssl_error.rb +6 -0
  29. data/lib/easypost/errors/api/timeout_error.rb +6 -0
  30. data/lib/easypost/errors/api/unauthorized_error.rb +6 -0
  31. data/lib/easypost/errors/api/unknown_api_error.rb +6 -0
  32. data/lib/easypost/errors/easy_post_error.rb +7 -0
  33. data/lib/easypost/errors/end_of_pagination_error.rb +7 -0
  34. data/lib/easypost/errors/filtering_error.rb +4 -0
  35. data/lib/easypost/errors/invalid_object_error.rb +4 -0
  36. data/lib/easypost/errors/invalid_parameter_error.rb +11 -0
  37. data/lib/easypost/errors/missing_parameter_error.rb +9 -0
  38. data/lib/easypost/errors/signature_verification_error.rb +4 -0
  39. data/lib/easypost/errors.rb +31 -0
  40. data/lib/easypost/http_client.rb +65 -0
  41. data/lib/easypost/internal_utilities.rb +66 -0
  42. data/lib/easypost/models/address.rb +5 -0
  43. data/lib/easypost/models/api_key.rb +5 -0
  44. data/lib/easypost/models/base.rb +58 -0
  45. data/lib/easypost/models/batch.rb +5 -0
  46. data/lib/easypost/models/brand.rb +5 -0
  47. data/lib/easypost/{carbon_offset.rb → models/carbon_offset.rb} +1 -1
  48. data/lib/easypost/models/carrier_account.rb +5 -0
  49. data/lib/easypost/models/customs_info.rb +5 -0
  50. data/lib/easypost/models/customs_item.rb +5 -0
  51. data/lib/easypost/models/end_shipper.rb +5 -0
  52. data/lib/easypost/models/error.rb +21 -0
  53. data/lib/easypost/models/event.rb +5 -0
  54. data/lib/easypost/models/insurance.rb +6 -0
  55. data/lib/easypost/models/order.rb +9 -0
  56. data/lib/easypost/models/parcel.rb +5 -0
  57. data/lib/easypost/{payload.rb → models/payload.rb} +1 -1
  58. data/lib/easypost/models/payment_method.rb +5 -0
  59. data/lib/easypost/models/pickup.rb +9 -0
  60. data/lib/easypost/{pickup_rate.rb → models/pickup_rate.rb} +1 -1
  61. data/lib/easypost/{postage_label.rb → models/postage_label.rb} +1 -1
  62. data/lib/easypost/models/rate.rb +5 -0
  63. data/lib/easypost/models/referral.rb +5 -0
  64. data/lib/easypost/models/refund.rb +5 -0
  65. data/lib/easypost/models/report.rb +5 -0
  66. data/lib/easypost/models/scan_form.rb +6 -0
  67. data/lib/easypost/models/shipment.rb +10 -0
  68. data/lib/easypost/{tax_identifier.rb → models/tax_identifier.rb} +1 -1
  69. data/lib/easypost/models/tracker.rb +5 -0
  70. data/lib/easypost/models/user.rb +5 -0
  71. data/lib/easypost/models/webhook.rb +6 -0
  72. data/lib/easypost/models.rb +35 -0
  73. data/lib/easypost/services/address.rb +50 -0
  74. data/lib/easypost/services/api_key.rb +8 -0
  75. data/lib/easypost/services/base.rb +27 -0
  76. data/lib/easypost/services/batch.rb +53 -0
  77. data/lib/easypost/services/beta_rate.rb +12 -0
  78. data/lib/easypost/services/beta_referral_customer.rb +40 -0
  79. data/lib/easypost/services/billing.rb +75 -0
  80. data/lib/easypost/services/carrier_account.rb +44 -0
  81. data/lib/easypost/services/carrier_metadata.rb +22 -0
  82. data/lib/easypost/services/customs_info.rb +17 -0
  83. data/lib/easypost/services/customs_item.rb +15 -0
  84. data/lib/easypost/services/end_shipper.rb +31 -0
  85. data/lib/easypost/services/event.rb +32 -0
  86. data/lib/easypost/services/insurance.rb +26 -0
  87. data/lib/easypost/services/order.rb +30 -0
  88. data/lib/easypost/services/parcel.rb +16 -0
  89. data/lib/easypost/services/pickup.rb +40 -0
  90. data/lib/easypost/services/rate.rb +8 -0
  91. data/lib/easypost/services/referral_customer.rb +103 -0
  92. data/lib/easypost/services/refund.rb +26 -0
  93. data/lib/easypost/services/report.rb +42 -0
  94. data/lib/easypost/services/scan_form.rb +25 -0
  95. data/lib/easypost/services/shipment.rb +106 -0
  96. data/lib/easypost/services/tracker.rb +38 -0
  97. data/lib/easypost/services/user.rb +66 -0
  98. data/lib/easypost/services/webhook.rb +34 -0
  99. data/lib/easypost/services.rb +32 -0
  100. data/lib/easypost/util.rb +80 -187
  101. data/lib/easypost/utilities/constants.rb +5 -0
  102. data/lib/easypost/utilities/json.rb +23 -0
  103. data/lib/easypost/utilities/static_mapper.rb +73 -0
  104. data/lib/easypost/utilities/system.rb +36 -0
  105. data/lib/easypost.rb +12 -138
  106. metadata +147 -66
  107. data/.rubocop.yml +0 -11
  108. data/easycop.yml +0 -180
  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 -46
  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.1
4
+ version: 5.0.1
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-18 00:00:00.000000000 Z
11
+ date: 2023-06-20 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:
@@ -193,7 +221,6 @@ files:
193
221
  - ".github/workflows/ci.yml"
194
222
  - ".gitignore"
195
223
  - ".gitmodules"
196
- - ".rubocop.yml"
197
224
  - CHANGELOG.md
198
225
  - Gemfile
199
226
  - LICENSE
@@ -203,50 +230,104 @@ files:
203
230
  - UPGRADE_GUIDE.md
204
231
  - VERSION
205
232
  - bin/easypost-irb
206
- - easycop.yml
207
233
  - easypost.gemspec
208
234
  - 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
235
+ - lib/easypost/client.rb
222
236
  - 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
237
+ - lib/easypost/constants.rb
238
+ - lib/easypost/errors.rb
239
+ - lib/easypost/errors/api/api_error.rb
240
+ - lib/easypost/errors/api/connection_error.rb
241
+ - lib/easypost/errors/api/external_api_error.rb
242
+ - lib/easypost/errors/api/forbidden_error.rb
243
+ - lib/easypost/errors/api/gateway_timeout_error.rb
244
+ - lib/easypost/errors/api/internal_server_error.rb
245
+ - lib/easypost/errors/api/invalid_request_error.rb
246
+ - lib/easypost/errors/api/method_not_allowed_error.rb
247
+ - lib/easypost/errors/api/not_found_error.rb
248
+ - lib/easypost/errors/api/payment_error.rb
249
+ - lib/easypost/errors/api/proxy_error.rb
250
+ - lib/easypost/errors/api/rate_limit_error.rb
251
+ - lib/easypost/errors/api/redirect_error.rb
252
+ - lib/easypost/errors/api/retry_error.rb
253
+ - lib/easypost/errors/api/service_unavailable_error.rb
254
+ - lib/easypost/errors/api/ssl_error.rb
255
+ - lib/easypost/errors/api/timeout_error.rb
256
+ - lib/easypost/errors/api/unauthorized_error.rb
257
+ - lib/easypost/errors/api/unknown_api_error.rb
258
+ - lib/easypost/errors/easy_post_error.rb
259
+ - lib/easypost/errors/end_of_pagination_error.rb
260
+ - lib/easypost/errors/filtering_error.rb
261
+ - lib/easypost/errors/invalid_object_error.rb
262
+ - lib/easypost/errors/invalid_parameter_error.rb
263
+ - lib/easypost/errors/missing_parameter_error.rb
264
+ - lib/easypost/errors/signature_verification_error.rb
265
+ - lib/easypost/http_client.rb
266
+ - lib/easypost/internal_utilities.rb
267
+ - lib/easypost/models.rb
268
+ - lib/easypost/models/address.rb
269
+ - lib/easypost/models/api_key.rb
270
+ - lib/easypost/models/base.rb
271
+ - lib/easypost/models/batch.rb
272
+ - lib/easypost/models/brand.rb
273
+ - lib/easypost/models/carbon_offset.rb
274
+ - lib/easypost/models/carrier_account.rb
275
+ - lib/easypost/models/customs_info.rb
276
+ - lib/easypost/models/customs_item.rb
277
+ - lib/easypost/models/end_shipper.rb
278
+ - lib/easypost/models/error.rb
279
+ - lib/easypost/models/event.rb
280
+ - lib/easypost/models/insurance.rb
281
+ - lib/easypost/models/order.rb
282
+ - lib/easypost/models/parcel.rb
283
+ - lib/easypost/models/payload.rb
284
+ - lib/easypost/models/payment_method.rb
285
+ - lib/easypost/models/pickup.rb
286
+ - lib/easypost/models/pickup_rate.rb
287
+ - lib/easypost/models/postage_label.rb
288
+ - lib/easypost/models/rate.rb
289
+ - lib/easypost/models/referral.rb
290
+ - lib/easypost/models/refund.rb
291
+ - lib/easypost/models/report.rb
292
+ - lib/easypost/models/scan_form.rb
293
+ - lib/easypost/models/shipment.rb
294
+ - lib/easypost/models/tax_identifier.rb
295
+ - lib/easypost/models/tracker.rb
296
+ - lib/easypost/models/user.rb
297
+ - lib/easypost/models/webhook.rb
298
+ - lib/easypost/services.rb
299
+ - lib/easypost/services/address.rb
300
+ - lib/easypost/services/api_key.rb
301
+ - lib/easypost/services/base.rb
302
+ - lib/easypost/services/batch.rb
303
+ - lib/easypost/services/beta_rate.rb
304
+ - lib/easypost/services/beta_referral_customer.rb
305
+ - lib/easypost/services/billing.rb
306
+ - lib/easypost/services/carrier_account.rb
307
+ - lib/easypost/services/carrier_metadata.rb
308
+ - lib/easypost/services/customs_info.rb
309
+ - lib/easypost/services/customs_item.rb
310
+ - lib/easypost/services/end_shipper.rb
311
+ - lib/easypost/services/event.rb
312
+ - lib/easypost/services/insurance.rb
313
+ - lib/easypost/services/order.rb
314
+ - lib/easypost/services/parcel.rb
315
+ - lib/easypost/services/pickup.rb
316
+ - lib/easypost/services/rate.rb
317
+ - lib/easypost/services/referral_customer.rb
318
+ - lib/easypost/services/refund.rb
319
+ - lib/easypost/services/report.rb
320
+ - lib/easypost/services/scan_form.rb
321
+ - lib/easypost/services/shipment.rb
322
+ - lib/easypost/services/tracker.rb
323
+ - lib/easypost/services/user.rb
324
+ - lib/easypost/services/webhook.rb
247
325
  - lib/easypost/util.rb
326
+ - lib/easypost/utilities/constants.rb
327
+ - lib/easypost/utilities/json.rb
328
+ - lib/easypost/utilities/static_mapper.rb
329
+ - lib/easypost/utilities/system.rb
248
330
  - lib/easypost/version.rb
249
- - lib/easypost/webhook.rb
250
331
  homepage: https://www.easypost.com/docs
251
332
  licenses:
252
333
  - MIT
@@ -259,14 +340,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
259
340
  requirements:
260
341
  - - ">="
261
342
  - !ruby/object:Gem::Version
262
- version: '2.5'
343
+ version: '2.6'
263
344
  required_rubygems_version: !ruby/object:Gem::Requirement
264
345
  requirements:
265
346
  - - ">="
266
347
  - !ruby/object:Gem::Version
267
348
  version: '0'
268
349
  requirements: []
269
- rubygems_version: 3.3.26
350
+ rubygems_version: 3.4.10
270
351
  signing_key:
271
352
  specification_version: 4
272
353
  summary: EasyPost Ruby Client Library
data/.rubocop.yml DELETED
@@ -1,11 +0,0 @@
1
- inherit_from: easycop.yml
2
-
3
- AllCops:
4
- SuggestExtensions: false
5
- # We are ignoring RSpec/FilePath because Simplecov doesn't play nice with nested spec files
6
- RSpec/FilePath:
7
- Enabled: false
8
- # TODO: Remove this once we start using keyword arguments
9
- Style/OptionalBooleanParameter:
10
- Exclude:
11
- - 'lib/easypost/shipment.rb'
data/easycop.yml DELETED
@@ -1,180 +0,0 @@
1
- # This file was generated by
2
- # `rake easycop:init`
3
- # on 2019-12-16 19:20:52 +0000 using EasyCop version 0.1.
4
- ---
5
- require:
6
- - rubocop-rspec
7
- AllCops:
8
- TargetRubyVersion: 2.5
9
- NewCops: disable
10
- Layout/BlockAlignment:
11
- Enabled: true
12
- EnforcedStyleAlignWith: start_of_block
13
- Layout/DotPosition:
14
- Enabled: true
15
- AutoCorrect: true
16
- EnforcedStyle: leading
17
- Layout/EmptyLineAfterGuardClause:
18
- Enabled: true
19
- AutoCorrect: true
20
- Layout/EmptyLinesAroundArguments:
21
- Enabled: true
22
- AutoCorrect: true
23
- Layout/EmptyLinesAroundExceptionHandlingKeywords:
24
- Enabled: true
25
- AutoCorrect: true
26
- Layout/EndAlignment:
27
- Enabled: true
28
- EnforcedStyleAlignWith: keyword
29
- AutoCorrect: true
30
- Layout/MultilineMethodCallBraceLayout:
31
- EnforcedStyle: new_line
32
- Layout/MultilineHashBraceLayout:
33
- EnforcedStyle: new_line
34
- Layout/MultilineArrayBraceLayout:
35
- EnforcedStyle: new_line
36
- Layout/FirstArrayElementLineBreak:
37
- Enabled: true
38
- Layout/FirstHashElementLineBreak:
39
- Enabled: true
40
- Layout/FirstMethodArgumentLineBreak:
41
- Enabled: true
42
- Layout/LineLength:
43
- Max: 120
44
- IgnoredPatterns: # deprecated in 1.28
45
- - "(\\A|\\s)#"
46
- Layout/LineEndStringConcatenationIndentation: # new in 1.18
47
- Enabled: true
48
- Layout/SpaceBeforeBrackets: # new in 1.7
49
- Enabled: true
50
- RSpec/SharedExamples:
51
- Enabled: false
52
- RSpec/NestedGroups:
53
- Enabled: false
54
- RSpec/ExampleLength:
55
- Enabled: false
56
- RSpec/ImplicitSubject:
57
- Enabled: false
58
- RSpec/MultipleExpectations:
59
- Enabled: false
60
- RSpec/MultipleMemoizedHelpers:
61
- Enabled: false
62
- RSpec/IdenticalEqualityAssertion: # new in 2.4
63
- Enabled: true
64
- Style/BlockDelimiters:
65
- Enabled: true
66
- EnforcedStyle: braces_for_chaining
67
- Style/ClassAndModuleChildren:
68
- Enabled: true
69
- EnforcedStyle: compact
70
- Style/Documentation:
71
- Enabled: false
72
- Style/MethodCalledOnDoEndBlock:
73
- Severity: warning
74
- Enabled: true
75
- Style/RaiseArgs:
76
- Enabled: false
77
- Style/RescueStandardError:
78
- Enabled: true
79
- Style/MultilineBlockChain:
80
- Enabled: false
81
- Style/TrailingCommaInHashLiteral:
82
- EnforcedStyleForMultiline: consistent_comma
83
- Style/TrailingCommaInArguments:
84
- EnforcedStyleForMultiline: consistent_comma
85
- Style/TrailingCommaInArrayLiteral:
86
- EnforcedStyleForMultiline: consistent_comma
87
- Style/SymbolArray:
88
- Enabled: false
89
- Style/IfUnlessModifier:
90
- Enabled: false
91
- Metrics/BlockLength:
92
- Enabled: false
93
- Metrics/ClassLength:
94
- Enabled: false
95
- Metrics/CyclomaticComplexity:
96
- Enabled: false
97
- Metrics/PerceivedComplexity:
98
- Enabled: false
99
- Metrics/ModuleLength:
100
- Enabled: false
101
- Metrics/MethodLength:
102
- Enabled: false
103
- Metrics/ParameterLists:
104
- Enabled: false
105
- Metrics/AbcSize:
106
- Enabled: false
107
- Gemspec/DateAssignment: # new in 1.10
108
- Enabled: true
109
- Lint/AmbiguousAssignment: # new in 1.7
110
- Enabled: true
111
- Lint/AmbiguousRange: # new in 1.19
112
- Enabled: true
113
- Lint/DeprecatedConstants: # new in 1.8
114
- Enabled: true
115
- Lint/DuplicateBranch: # new in 1.3
116
- Enabled: true
117
- Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
118
- Enabled: true
119
- Lint/EmptyBlock: # new in 1.1
120
- Enabled: true
121
- Lint/EmptyClass: # new in 1.3
122
- Enabled: true
123
- Lint/EmptyInPattern: # new in 1.16
124
- Enabled: true
125
- Lint/LambdaWithoutLiteralBlock: # new in 1.8
126
- Enabled: true
127
- Lint/NoReturnInBeginEndBlocks: # new in 1.2
128
- Enabled: true
129
- Lint/NumberedParameterAssignment: # new in 1.9
130
- Enabled: true
131
- Lint/OrAssignmentToConstant: # new in 1.9
132
- Enabled: true
133
- Lint/RedundantDirGlobSort: # new in 1.8
134
- Enabled: true
135
- Lint/SymbolConversion: # new in 1.9
136
- Enabled: true
137
- Lint/ToEnumArguments: # new in 1.1
138
- Enabled: true
139
- Lint/TripleQuotes: # new in 1.9
140
- Enabled: true
141
- Lint/UnexpectedBlockArity: # new in 1.5
142
- Enabled: true
143
- Lint/UnmodifiedReduceAccumulator: # new in 1.1
144
- Enabled: true
145
- Naming/InclusiveLanguage: # new in 1.18
146
- Enabled: true
147
- Style/ArgumentsForwarding: # new in 1.1
148
- Enabled: true
149
- Style/CollectionCompact: # new in 1.2
150
- Enabled: true
151
- Style/DocumentDynamicEvalDefinition: # new in 1.1
152
- Enabled: true
153
- Style/EndlessMethod: # new in 1.8
154
- Enabled: true
155
- Style/HashConversion: # new in 1.10
156
- Enabled: true
157
- Style/HashExcept: # new in 1.7
158
- Enabled: true
159
- Style/IfWithBooleanLiteralBranches: # new in 1.9
160
- Enabled: true
161
- Style/InPatternThen: # new in 1.16
162
- Enabled: true
163
- Style/MultilineInPatternThen: # new in 1.16
164
- Enabled: true
165
- Style/NegatedIfElseCondition: # new in 1.2
166
- Enabled: true
167
- Style/NilLambda: # new in 1.3
168
- Enabled: true
169
- Style/QuotedSymbols: # new in 1.16
170
- Enabled: true
171
- Style/RedundantArgument: # new in 1.4
172
- Enabled: true
173
- Style/RedundantSelfAssignmentBranch: # new in 1.19
174
- Enabled: true
175
- Style/StringChars: # new in 1.12
176
- Enabled: true
177
- Style/SwapValues: # new in 1.1
178
- Enabled: true
179
- RSpec/Rails/AvoidSetupHook: # new in 2.4
180
- Enabled: true
@@ -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