easypost 4.8.1 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +5 -0
  3. data/.github/workflows/ci.yml +8 -0
  4. data/.gitignore +10 -14
  5. data/CHANGELOG.md +4 -0
  6. data/Makefile +10 -2
  7. data/README.md +5 -1
  8. data/VERSION +1 -1
  9. data/docs/EasyPost/Address.html +222 -0
  10. data/docs/EasyPost/ApiKey.html +99 -0
  11. data/docs/EasyPost/Batch.html +269 -0
  12. data/docs/EasyPost/Beta/EndShipper.html +225 -0
  13. data/docs/EasyPost/Beta/Referral.html +338 -0
  14. data/docs/EasyPost/Beta.html +91 -0
  15. data/docs/EasyPost/Billing.html +253 -0
  16. data/docs/EasyPost/Brand.html +140 -0
  17. data/docs/EasyPost/CarbonOffset.html +99 -0
  18. data/docs/EasyPost/CarrierAccount.html +136 -0
  19. data/docs/EasyPost/CarrierType.html +99 -0
  20. data/docs/EasyPost/CustomsInfo.html +136 -0
  21. data/docs/EasyPost/CustomsItem.html +136 -0
  22. data/docs/EasyPost/EasyPostObject.html +662 -0
  23. data/docs/EasyPost/EndShipper.html +175 -0
  24. data/docs/EasyPost/Error.html +258 -0
  25. data/docs/EasyPost/Event.html +136 -0
  26. data/docs/EasyPost/Insurance.html +99 -0
  27. data/docs/EasyPost/Order.html +222 -0
  28. data/docs/EasyPost/Parcel.html +136 -0
  29. data/docs/EasyPost/PaymentMethod.html +137 -0
  30. data/docs/EasyPost/Pickup.html +222 -0
  31. data/docs/EasyPost/PickupRate.html +99 -0
  32. data/docs/EasyPost/PostageLabel.html +99 -0
  33. data/docs/EasyPost/Rate.html +136 -0
  34. data/docs/EasyPost/Referral.html +334 -0
  35. data/docs/EasyPost/Refund.html +99 -0
  36. data/docs/EasyPost/Report.html +167 -0
  37. data/docs/EasyPost/Resource.html +399 -0
  38. data/docs/EasyPost/ScanForm.html +137 -0
  39. data/docs/EasyPost/Shipment.html +456 -0
  40. data/docs/EasyPost/TaxIdentifier.html +99 -0
  41. data/docs/EasyPost/Tracker.html +139 -0
  42. data/docs/EasyPost/User.html +307 -0
  43. data/docs/EasyPost/Util.html +462 -0
  44. data/docs/EasyPost/Webhook.html +221 -0
  45. data/docs/EasyPost.html +440 -0
  46. data/docs/created.rid +40 -0
  47. data/docs/css/fonts.css +167 -0
  48. data/docs/css/rdoc.css +639 -0
  49. data/docs/fonts/Lato-Light.ttf +0 -0
  50. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  51. data/docs/fonts/Lato-Regular.ttf +0 -0
  52. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  53. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  54. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  55. data/docs/images/add.png +0 -0
  56. data/docs/images/arrow_up.png +0 -0
  57. data/docs/images/brick.png +0 -0
  58. data/docs/images/brick_link.png +0 -0
  59. data/docs/images/bug.png +0 -0
  60. data/docs/images/bullet_black.png +0 -0
  61. data/docs/images/bullet_toggle_minus.png +0 -0
  62. data/docs/images/bullet_toggle_plus.png +0 -0
  63. data/docs/images/date.png +0 -0
  64. data/docs/images/delete.png +0 -0
  65. data/docs/images/find.png +0 -0
  66. data/docs/images/loadingAnimation.gif +0 -0
  67. data/docs/images/macFFBgHack.png +0 -0
  68. data/docs/images/package.png +0 -0
  69. data/docs/images/page_green.png +0 -0
  70. data/docs/images/page_white_text.png +0 -0
  71. data/docs/images/page_white_width.png +0 -0
  72. data/docs/images/plugin.png +0 -0
  73. data/docs/images/ruby.png +0 -0
  74. data/docs/images/tag_blue.png +0 -0
  75. data/docs/images/tag_green.png +0 -0
  76. data/docs/images/transparent.png +0 -0
  77. data/docs/images/wrench.png +0 -0
  78. data/docs/images/wrench_orange.png +0 -0
  79. data/docs/images/zoom.png +0 -0
  80. data/docs/index.html +117 -0
  81. data/docs/js/darkfish.js +84 -0
  82. data/docs/js/navigation.js +105 -0
  83. data/docs/js/navigation.js.gz +0 -0
  84. data/docs/js/search.js +110 -0
  85. data/docs/js/search_index.js +1 -0
  86. data/docs/js/search_index.js.gz +0 -0
  87. data/docs/js/searcher.js +229 -0
  88. data/docs/js/searcher.js.gz +0 -0
  89. data/docs/table_of_contents.html +785 -0
  90. data/easypost.gemspec +3 -1
  91. data/lib/easypost/carrier_account.rb +17 -0
  92. data/lib/easypost/shipment.rb +1 -1
  93. data/lib/easypost/user.rb +5 -2
  94. data/lib/easypost/util.rb +2 -0
  95. metadata +115 -6
data/easypost.gemspec CHANGED
@@ -23,10 +23,12 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency 'brakeman', '~> 5.2'
25
25
  spec.add_development_dependency 'pry', '~> 0.14'
26
+ spec.add_development_dependency 'psych', '~> 4.0' # TODO: pinned because rdoc has an optimistic pin of this dep and 5.0 breaks on CI
26
27
  spec.add_development_dependency 'rake', '~> 13.0'
28
+ spec.add_development_dependency 'rdoc', '~> 6.4'
27
29
  spec.add_development_dependency 'rspec', '~> 3.10'
28
30
  spec.add_development_dependency 'rubocop', '= 1.27' # rubocop 1.28 requires Ruby 2.6+
29
- spec.add_development_dependency 'rubocop-rspec', '~> 2.7'
31
+ spec.add_development_dependency 'rubocop-rspec', '= 2.10' # rubocop-rspec 2.11 requires Ruby 2.6+
30
32
  spec.add_development_dependency 'simplecov', '~> 0.21'
31
33
  spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
32
34
  spec.add_development_dependency 'vcr', '= 6.0' # VCR 6.1 requires Ruby 2.6+
@@ -2,8 +2,25 @@
2
2
 
3
3
  # A CarrierAccount encapsulates your credentials with the carrier.
4
4
  class EasyPost::CarrierAccount < EasyPost::Resource
5
+ CUSTOM_WORKFLOW_CARRIER_TYPES = %w[UpsAccount FedexAccount].freeze
6
+
5
7
  # Retrieve a list of available CarrierAccount types for the authenticated User.
6
8
  def self.types
7
9
  EasyPost::CarrierType.all
8
10
  end
11
+
12
+ def self.create(params = {}, api_key = nil)
13
+ wrapped_params = {}
14
+ wrapped_params[class_name.to_sym] = params
15
+
16
+ # For Ups and Fedex the endpoint is different
17
+ create_url = if CUSTOM_WORKFLOW_CARRIER_TYPES.include?(params[:type])
18
+ "#{url}/register"
19
+ else
20
+ url
21
+ end
22
+
23
+ response = EasyPost.make_request(:post, create_url, api_key, wrapped_params)
24
+ EasyPost::Util.convert_to_easypost_object(response, api_key)
25
+ end
9
26
  end
@@ -75,7 +75,7 @@ class EasyPost::Shipment < EasyPost::Resource
75
75
 
76
76
  # Refund a Shipment.
77
77
  def refund(params = {})
78
- response = EasyPost.make_request(:get, "#{url}/refund", @api_key, params)
78
+ response = EasyPost.make_request(:post, "#{url}/refund", @api_key, params)
79
79
  refresh_from(response, @api_key)
80
80
 
81
81
  self
data/lib/easypost/user.rb CHANGED
@@ -33,18 +33,21 @@ class EasyPost::User < EasyPost::Resource
33
33
  all
34
34
  end
35
35
 
36
- # Retrieve a list of ApiKey objects.
36
+ # Retrieve a list of all ApiKey objects.
37
37
  def self.all_api_keys
38
38
  EasyPost::ApiKey.all
39
39
  end
40
40
 
41
- # Retrieve a list of ApiKey objects of a child User.
41
+ # Retrieve a list of ApiKey objects (works for the authenticated user or a child user).
42
42
  def api_keys
43
43
  api_keys = EasyPost::User.all_api_keys
44
44
 
45
45
  if api_keys.id == id
46
+ # This function was called on the authenticated user
46
47
  my_api_keys = api_keys.keys
47
48
  else
49
+ # This function was called on a child user (authenticated as parent, only return this child user's details).
50
+ my_api_keys = []
48
51
  api_keys.children.each do |child|
49
52
  if child.id == id
50
53
  my_api_keys = child.keys
data/lib/easypost/util.rb CHANGED
@@ -5,6 +5,7 @@ module EasyPost::Util
5
5
  attr_accessor :os_name, :os_version, :os_arch
6
6
 
7
7
  BY_PREFIX = {
8
+ 'ak' => EasyPost::ApiKey,
8
9
  'adr' => EasyPost::Address,
9
10
  'batch' => EasyPost::Batch,
10
11
  'brd' => EasyPost::Brand,
@@ -35,6 +36,7 @@ module EasyPost::Util
35
36
 
36
37
  BY_TYPE = {
37
38
  'Address' => EasyPost::Address,
39
+ 'ApiKey' => EasyPost::ApiKey,
38
40
  'Batch' => EasyPost::Batch,
39
41
  'Brand' => EasyPost::Brand,
40
42
  'CarbonOffset' => EasyPost::CarbonOffset,
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.8.1
4
+ version: 4.9.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: 2022-10-24 00:00:00.000000000 Z
11
+ date: 2022-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brakeman
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: psych
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
68
  version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '6.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '6.4'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rspec
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +112,16 @@ dependencies:
84
112
  name: rubocop-rspec
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - "~>"
115
+ - - '='
88
116
  - !ruby/object:Gem::Version
89
- version: '2.7'
117
+ version: '2.10'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - "~>"
122
+ - - '='
95
123
  - !ruby/object:Gem::Version
96
- version: '2.7'
124
+ version: '2.10'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: simplecov
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -179,6 +207,87 @@ files:
179
207
  - UPGRADE_GUIDE.md
180
208
  - VERSION
181
209
  - bin/easypost-irb
210
+ - docs/EasyPost.html
211
+ - docs/EasyPost/Address.html
212
+ - docs/EasyPost/ApiKey.html
213
+ - docs/EasyPost/Batch.html
214
+ - docs/EasyPost/Beta.html
215
+ - docs/EasyPost/Beta/EndShipper.html
216
+ - docs/EasyPost/Beta/Referral.html
217
+ - docs/EasyPost/Billing.html
218
+ - docs/EasyPost/Brand.html
219
+ - docs/EasyPost/CarbonOffset.html
220
+ - docs/EasyPost/CarrierAccount.html
221
+ - docs/EasyPost/CarrierType.html
222
+ - docs/EasyPost/CustomsInfo.html
223
+ - docs/EasyPost/CustomsItem.html
224
+ - docs/EasyPost/EasyPostObject.html
225
+ - docs/EasyPost/EndShipper.html
226
+ - docs/EasyPost/Error.html
227
+ - docs/EasyPost/Event.html
228
+ - docs/EasyPost/Insurance.html
229
+ - docs/EasyPost/Order.html
230
+ - docs/EasyPost/Parcel.html
231
+ - docs/EasyPost/PaymentMethod.html
232
+ - docs/EasyPost/Pickup.html
233
+ - docs/EasyPost/PickupRate.html
234
+ - docs/EasyPost/PostageLabel.html
235
+ - docs/EasyPost/Rate.html
236
+ - docs/EasyPost/Referral.html
237
+ - docs/EasyPost/Refund.html
238
+ - docs/EasyPost/Report.html
239
+ - docs/EasyPost/Resource.html
240
+ - docs/EasyPost/ScanForm.html
241
+ - docs/EasyPost/Shipment.html
242
+ - docs/EasyPost/TaxIdentifier.html
243
+ - docs/EasyPost/Tracker.html
244
+ - docs/EasyPost/User.html
245
+ - docs/EasyPost/Util.html
246
+ - docs/EasyPost/Webhook.html
247
+ - docs/created.rid
248
+ - docs/css/fonts.css
249
+ - docs/css/rdoc.css
250
+ - docs/fonts/Lato-Light.ttf
251
+ - docs/fonts/Lato-LightItalic.ttf
252
+ - docs/fonts/Lato-Regular.ttf
253
+ - docs/fonts/Lato-RegularItalic.ttf
254
+ - docs/fonts/SourceCodePro-Bold.ttf
255
+ - docs/fonts/SourceCodePro-Regular.ttf
256
+ - docs/images/add.png
257
+ - docs/images/arrow_up.png
258
+ - docs/images/brick.png
259
+ - docs/images/brick_link.png
260
+ - docs/images/bug.png
261
+ - docs/images/bullet_black.png
262
+ - docs/images/bullet_toggle_minus.png
263
+ - docs/images/bullet_toggle_plus.png
264
+ - docs/images/date.png
265
+ - docs/images/delete.png
266
+ - docs/images/find.png
267
+ - docs/images/loadingAnimation.gif
268
+ - docs/images/macFFBgHack.png
269
+ - docs/images/package.png
270
+ - docs/images/page_green.png
271
+ - docs/images/page_white_text.png
272
+ - docs/images/page_white_width.png
273
+ - docs/images/plugin.png
274
+ - docs/images/ruby.png
275
+ - docs/images/tag_blue.png
276
+ - docs/images/tag_green.png
277
+ - docs/images/transparent.png
278
+ - docs/images/wrench.png
279
+ - docs/images/wrench_orange.png
280
+ - docs/images/zoom.png
281
+ - docs/index.html
282
+ - docs/js/darkfish.js
283
+ - docs/js/navigation.js
284
+ - docs/js/navigation.js.gz
285
+ - docs/js/search.js
286
+ - docs/js/search_index.js
287
+ - docs/js/search_index.js.gz
288
+ - docs/js/searcher.js
289
+ - docs/js/searcher.js.gz
290
+ - docs/table_of_contents.html
182
291
  - easycop.yml
183
292
  - easypost.gemspec
184
293
  - lib/easypost.rb