easypost 3.5.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +9 -0
  3. data/.github/CODEOWNERS +2 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.yml +81 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.yml +37 -0
  6. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  7. data/.github/workflows/ci.yml +54 -5
  8. data/.gitignore +27 -17
  9. data/.gitmodules +3 -0
  10. data/CHANGELOG.md +295 -119
  11. data/Gemfile +2 -0
  12. data/Makefile +70 -0
  13. data/README.md +184 -72
  14. data/Rakefile +2 -1
  15. data/UPGRADE_GUIDE.md +181 -0
  16. data/VERSION +1 -1
  17. data/bin/easypost-irb +5 -3
  18. data/easypost.gemspec +27 -20
  19. data/lib/easypost/client.rb +179 -0
  20. data/lib/easypost/connection.rb +64 -0
  21. data/lib/easypost/constants.rb +15 -0
  22. data/lib/easypost/errors/api/api_error.rb +108 -0
  23. data/lib/easypost/errors/api/bad_request_error.rb +6 -0
  24. data/lib/easypost/errors/api/connection_error.rb +6 -0
  25. data/lib/easypost/errors/api/external_api_error.rb +18 -0
  26. data/lib/easypost/errors/api/forbidden_error.rb +6 -0
  27. data/lib/easypost/errors/api/gateway_timeout_error.rb +6 -0
  28. data/lib/easypost/errors/api/internal_server_error.rb +6 -0
  29. data/lib/easypost/errors/api/invalid_request_error.rb +6 -0
  30. data/lib/easypost/errors/api/method_not_allowed_error.rb +6 -0
  31. data/lib/easypost/errors/api/not_found_error.rb +6 -0
  32. data/lib/easypost/errors/api/payment_error.rb +6 -0
  33. data/lib/easypost/errors/api/proxy_error.rb +6 -0
  34. data/lib/easypost/errors/api/rate_limit_error.rb +6 -0
  35. data/lib/easypost/errors/api/redirect_error.rb +6 -0
  36. data/lib/easypost/errors/api/retry_error.rb +6 -0
  37. data/lib/easypost/errors/api/service_unavailable_error.rb +6 -0
  38. data/lib/easypost/errors/api/ssl_error.rb +6 -0
  39. data/lib/easypost/errors/api/timeout_error.rb +6 -0
  40. data/lib/easypost/errors/api/unauthorized_error.rb +6 -0
  41. data/lib/easypost/errors/api/unknown_api_error.rb +6 -0
  42. data/lib/easypost/errors/easy_post_error.rb +7 -0
  43. data/lib/easypost/errors/end_of_pagination_error.rb +7 -0
  44. data/lib/easypost/errors/filtering_error.rb +4 -0
  45. data/lib/easypost/errors/invalid_object_error.rb +4 -0
  46. data/lib/easypost/errors/invalid_parameter_error.rb +11 -0
  47. data/lib/easypost/errors/missing_parameter_error.rb +9 -0
  48. data/lib/easypost/errors/signature_verification_error.rb +4 -0
  49. data/lib/easypost/errors.rb +32 -0
  50. data/lib/easypost/hooks/request_context.rb +16 -0
  51. data/lib/easypost/hooks/response_context.rb +23 -0
  52. data/lib/easypost/hooks.rb +34 -0
  53. data/lib/easypost/http_client.rb +117 -0
  54. data/lib/easypost/internal_utilities.rb +66 -0
  55. data/lib/easypost/models/address.rb +5 -0
  56. data/lib/easypost/models/api_key.rb +5 -0
  57. data/lib/easypost/models/base.rb +58 -0
  58. data/lib/easypost/models/batch.rb +5 -0
  59. data/lib/easypost/models/brand.rb +5 -0
  60. data/lib/easypost/models/carbon_offset.rb +5 -0
  61. data/lib/easypost/models/carrier_account.rb +5 -0
  62. data/lib/easypost/models/carrier_type.rb +5 -0
  63. data/lib/easypost/models/customs_info.rb +5 -0
  64. data/lib/easypost/models/customs_item.rb +5 -0
  65. data/lib/easypost/models/end_shipper.rb +5 -0
  66. data/lib/easypost/models/error.rb +21 -0
  67. data/lib/easypost/models/event.rb +5 -0
  68. data/lib/easypost/models/insurance.rb +6 -0
  69. data/lib/easypost/models/order.rb +9 -0
  70. data/lib/easypost/models/parcel.rb +5 -0
  71. data/lib/easypost/models/payload.rb +5 -0
  72. data/lib/easypost/models/payment_method.rb +5 -0
  73. data/lib/easypost/models/pickup.rb +9 -0
  74. data/lib/easypost/models/pickup_rate.rb +5 -0
  75. data/lib/easypost/models/postage_label.rb +5 -0
  76. data/lib/easypost/models/rate.rb +5 -0
  77. data/lib/easypost/models/referral.rb +5 -0
  78. data/lib/easypost/models/refund.rb +5 -0
  79. data/lib/easypost/models/report.rb +5 -0
  80. data/lib/easypost/models/scan_form.rb +6 -0
  81. data/lib/easypost/models/shipment.rb +10 -0
  82. data/lib/easypost/models/tax_identifier.rb +6 -0
  83. data/lib/easypost/models/tracker.rb +5 -0
  84. data/lib/easypost/models/user.rb +5 -0
  85. data/lib/easypost/models/webhook.rb +6 -0
  86. data/lib/easypost/models.rb +36 -0
  87. data/lib/easypost/services/address.rb +50 -0
  88. data/lib/easypost/services/api_key.rb +8 -0
  89. data/lib/easypost/services/base.rb +27 -0
  90. data/lib/easypost/services/batch.rb +53 -0
  91. data/lib/easypost/services/beta_rate.rb +12 -0
  92. data/lib/easypost/services/beta_referral_customer.rb +40 -0
  93. data/lib/easypost/services/billing.rb +75 -0
  94. data/lib/easypost/services/carrier_account.rb +44 -0
  95. data/lib/easypost/services/carrier_metadata.rb +22 -0
  96. data/lib/easypost/services/carrier_type.rb +10 -0
  97. data/lib/easypost/services/customs_info.rb +17 -0
  98. data/lib/easypost/services/customs_item.rb +15 -0
  99. data/lib/easypost/services/end_shipper.rb +31 -0
  100. data/lib/easypost/services/event.rb +32 -0
  101. data/lib/easypost/services/insurance.rb +26 -0
  102. data/lib/easypost/services/order.rb +30 -0
  103. data/lib/easypost/services/parcel.rb +16 -0
  104. data/lib/easypost/services/pickup.rb +40 -0
  105. data/lib/easypost/services/rate.rb +8 -0
  106. data/lib/easypost/services/referral_customer.rb +103 -0
  107. data/lib/easypost/services/refund.rb +26 -0
  108. data/lib/easypost/services/report.rb +42 -0
  109. data/lib/easypost/services/scan_form.rb +25 -0
  110. data/lib/easypost/services/shipment.rb +106 -0
  111. data/lib/easypost/services/tracker.rb +38 -0
  112. data/lib/easypost/services/user.rb +66 -0
  113. data/lib/easypost/services/webhook.rb +34 -0
  114. data/lib/easypost/services.rb +33 -0
  115. data/lib/easypost/util.rb +160 -116
  116. data/lib/easypost/utilities/constants.rb +5 -0
  117. data/lib/easypost/utilities/json.rb +23 -0
  118. data/lib/easypost/utilities/static_mapper.rb +73 -0
  119. data/lib/easypost/utilities/system.rb +36 -0
  120. data/lib/easypost/version.rb +3 -1
  121. data/lib/easypost.rb +20 -143
  122. metadata +249 -46
  123. data/lib/easypost/address.rb +0 -58
  124. data/lib/easypost/api_key.rb +0 -2
  125. data/lib/easypost/batch.rb +0 -49
  126. data/lib/easypost/brand.rb +0 -9
  127. data/lib/easypost/carrier_account.rb +0 -5
  128. data/lib/easypost/carrier_type.rb +0 -2
  129. data/lib/easypost/customs_info.rb +0 -5
  130. data/lib/easypost/customs_item.rb +0 -5
  131. data/lib/easypost/error.rb +0 -31
  132. data/lib/easypost/event.rb +0 -7
  133. data/lib/easypost/insurance.rb +0 -2
  134. data/lib/easypost/object.rb +0 -151
  135. data/lib/easypost/order.rb +0 -28
  136. data/lib/easypost/parcel.rb +0 -2
  137. data/lib/easypost/pickup.rb +0 -26
  138. data/lib/easypost/pickup_rate.rb +0 -3
  139. data/lib/easypost/postage_label.rb +0 -2
  140. data/lib/easypost/print_job.rb +0 -2
  141. data/lib/easypost/printer.rb +0 -24
  142. data/lib/easypost/rate.rb +0 -2
  143. data/lib/easypost/refund.rb +0 -2
  144. data/lib/easypost/report.rb +0 -29
  145. data/lib/easypost/resource.rb +0 -75
  146. data/lib/easypost/scan_form.rb +0 -6
  147. data/lib/easypost/shipment.rb +0 -129
  148. data/lib/easypost/tax_identifier.rb +0 -2
  149. data/lib/easypost/tracker.rb +0 -7
  150. data/lib/easypost/user.rb +0 -56
  151. data/lib/easypost/webhook.rb +0 -29
data/CHANGELOG.md CHANGED
@@ -1,210 +1,386 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 3.5.1 2022-07-01
3
+ ## v5.2.0 (2023-09-14)
4
4
 
5
- * Backports newer user-agent header
5
+ - Add `carrier_type` service + `carrier_type.all` method
6
6
 
7
- ## 3.5.0 2021-12-06
7
+ ## v5.1.1 (2023-09-05)
8
8
 
9
- * Adds the `update_brand` method to the user object (closes #122)
9
+ - Fix endpoint for creating a FedEx Smartpost carrier account
10
10
 
11
- ## 3.4.0 2021-07-13
11
+ ## v5.1.0 (2023-07-28)
12
12
 
13
- * Removed deprecated `Item` object
14
- * Sorted EasyPost Resources list
15
- * Remove 2015-vintage experimental `all_updated` method on Tracker
16
- * Fixes API key retrieval (#120, thanks @andychongyz)
17
- * Adds `regenerate_rates` method for new rerate API
18
- * Adds `deconstruct_keys` method to allow for pattern matching on EasyPost objects
13
+ - Adds hooks to introspect the request and response of API calls (see `HTTP Hooks` section in the README for more details)
14
+ - Maps 400 status code responses to the new `BadRequestError` class
19
15
 
20
- ## 3.3.0 2021-06-10
16
+ ## v5.0.1 (2023-06-20)
21
17
 
22
- * Adds `SmartRate` functionality to the `Shipments` object (available by calling `get_smartrates` on a shipment)
23
- * Fix bug where `EasyPost::CarrierAccount.types` was hitting the wrong endpoint
18
+ - Fixes a bug where the params of a `customs_info` on create weren't wrapped properly which led to an empty set of `customs_items`
24
19
 
25
- ## 3.2.0 2021-01-14
20
+ ## v5.0.0 (2023-06-06)
26
21
 
27
- * Replace Travis CI with Github Actions
28
- * Add Ruby 3.0 to supported platforms (#110; thanks @maxwell)
22
+ See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-4x-to-50) for more details.
29
23
 
30
- ## 3.1.5 2020-12-16
24
+ - Library is now thread-safe. Closes GitHub Issue ([#183](https://github.com/EasyPost/easypost-ruby/issues/183))
25
+ - Initialize a `Client` object with an API key. Optionally set open and read timeout params
26
+ - Previous classes have been diverted into `Services` and `Models`
27
+ - All methods (i.e. `create`, `retrieve`, `all`) exist in services, accessed via property of the client (eg: `client.shipment.create()`)
28
+ - E.g. `bought_shipment = client.shipment.buy(shipment_id, rate)`
29
+ - Beta namespace changed from `easypost.beta.x` to `client.beta_x`
30
+ - References to `Referral` are now `ReferralCustomer` and `referral_customer` to match the API and docs
31
+ - References to `smartrate` are now `SmartRate` and `smart_rate` to match the API and docs
32
+ - Rename function `get_smartrates` to `get_smart_rates`
33
+ - Rename function `get_lowest_smartrate` to `get_lowest_smart_rate`
34
+ - Empty API response functions for `delete` return `true` instead of empty object
35
+ - Drops support for Ruby 2.5
36
+ - Bumps all dev dependencies
37
+ - Improves Error Deserialization to dynamically handle edge cases that have a bad format
38
+ - Adds `retrieve_estimated_delivery_date` function in Shipment
39
+ - Removes deprecated `endshipper` beta class, please use the GA one `EasyPost::Services::EndShipper`
31
40
 
32
- * Fix attribute lookup when manually constructing objects (#105; thanks @drewtempelmeyer)
33
- * Flatten class names and clean up some other style issues
34
- * Fix `EasyPost::Address.create_and_verify`, broken since 3.1.0 (#108; thanks @rajbirverma)
41
+ ## v4.13.0 (2023-04-04)
35
42
 
36
- ## 3.1.4 2020-09-29
43
+ - Adds `get_next_page` function to each object which retrieves the next page of a collection when the `has_more` key is present in the response
37
44
 
38
- * Don't modify params passed into Address#create (#78; thanks @TheRusskiy)
39
- * Don't modify `carriers` and `services` parameters to `Shipment.lowest_rate` (#71 / #103, thanks @vladvinnikov and @jurisgalang)
40
- * When constructing an easypost object, convert the key to a string (#102; thanks @Geesu)
41
- * Expose the raw HTTP response as `#http_body` on `EasyPost::Error` objects (#101; thanks @Geesu)
45
+ ## v4.12.0 (2023-02-21)
42
46
 
43
- ## 3.1.3 2020-06-26
47
+ - Adds beta `retrieve_stateless_rates` function
48
+ - Adds `get_lowest_stateless_rate` utility
44
49
 
45
- * Fix bug causing Authorization header to be included in User-Agent header. All users must upgrade.
50
+ ## v4.11.0 (2023-01-18)
46
51
 
47
- ## 3.1.2 2020-06-24
52
+ - Added function to retrieve all pickups, accessible via `EasyPost::Pickup.all`
53
+ - Added payload functions `retrieve_all_payloads` and `retrieve_payload` to retrieve all payloads or a specific payload for an event.
48
54
 
49
- * Bad gem push. New version required.
55
+ ## v4.10.0 (2023-01-11)
50
56
 
51
- ## 3.1.1 2020-06-23
57
+ - Added new beta billing functionality for referral customer users, accessible via `EasyPost::Beta::Referral`
58
+ - `add_payment_method` to add an existing Stripe bank account or credit card to your EasyPost account
59
+ - `refund_by_amount` refunds you wallet balance by a specified amount
60
+ - `refund_by_payment_log` refunds you wallet balance by a specified payment log
61
+ - Fix bug where bank account and credit card payment methods were not deserializing to the `EasyPost::PaymentMethod` class
52
62
 
53
- * Fix bug where EasyPost.http_config was invalid when not explicitly initialized.
63
+ ## v4.9.0 (2022-12-07)
54
64
 
55
- ## 3.1.0 2020-06-23
65
+ - Routes requests for creating a carrier account with a custom workflow (eg: FedEx, UPS) to the correct endpoint when using the `create` function
56
66
 
57
- * Add Shipment Invoice and Refund Report
58
- * Remove dependencies on `RestClient` and `MultiJson`
59
- * Remove some deprecated endpoints
67
+ ## v4.8.1 (2022-10-24)
60
68
 
61
- ## 3.0.1 2018-05-17
69
+ - Concatenates `error.message` if it incorrectly comes back from the API as an array
70
+ - Treats any HTTP status outside the `2xx` range as an error. Impact expected is minimal as this change only affects `1xx` and `3xx` HTTP status codes
62
71
 
63
- * Enforce TLS certificate validity by default
72
+ ## v4.8.0 (2022-09-21)
64
73
 
65
- ## 3.0.0 2018-02-15
74
+ - Adds support to buy a shipment by passing in `end_shipper_id`
75
+ - `with_carbon_offset` can now alternatively be passed in the `params` parameter of the `shipment.buy` function
76
+ - Migrates Partner White Label (Referrals) to general library namespace and deprecates beta functions
66
77
 
67
- * Require use of ruby ~> 2.0 and TLSv1.2
78
+ ## v4.7.1 (2022-09-06)
68
79
 
69
- ## 2.7.3 2018-02-05
80
+ - Makes not implemented `all` calls match the `EasyPost::Resource` interface so that one can call `.to_json` on them and receive the proper error
70
81
 
71
- * Fix bug with introduced around certain JSON objects with IDs (thanks vladvinnikov!)
82
+ ## v4.7.0 (2022-08-25)
72
83
 
73
- ## 2.7.2 2018-02-01
84
+ - Moves EndShipper out of beta to the general library namespace
85
+ - Ensure the Easypost object will respond to `.id` when it has one in `@values`
74
86
 
75
- * Removed unused and unsupported code paths for Container model
76
- * Removed unused and unsupported code path for Stamp and Barcode methods on the Shipment model
77
- * Fixed a bug with non-model JSON object with an "id" key being treated as models and raising errors
87
+ ## v4.6.0 (2022-08-02)
78
88
 
79
- ## 2.7.1 2017-05-25
89
+ - Adds Carbon Offset support
90
+ - Adds ability to create a shipment with carbon_offset
91
+ - Adds ability to buy a shipment with carbon_offset
92
+ - Adds ability to one-call-buy a shipment with carbon_offset
93
+ - Adds ability to rerate a shipment with carbon_offset
94
+ - Adds `validate_webhook` function that returns your webhook or raises an error if there is a `webhook_secret` mismatch
95
+ - Deprecated `PaymentMethod` class, please use `Billing` class for retrieve all payment method function
80
96
 
81
- * Allow reports to be retrieved without passing a type
97
+ ## v4.5.0 (2022-07-18)
82
98
 
83
- ## 2.7.0 2017-04-04
99
+ - Adds ability to generate shipment forms via `generate_form` function
84
100
 
85
- * Changed Report CRUD signatures. requires report type to be passed
101
+ ## v4.4.0 (2022-07-11)
86
102
 
87
- ## 2.6.2 2017-02-14
103
+ - Adds `Billing.retrieve_payment_methods()`, `Billing.fund_wallet()`, and `Billing.delete_payment_method()` functions
104
+ - Captures OS information in the user-agent header for easier debugging
105
+ - Update functions now use `patch` instead of `put` under the hood to better match API behavior and documentation. The behavior of these functions should remain the same
88
106
 
89
- * Added get_rates method for Orders
107
+ ## v4.3.0 (2022-05-19)
90
108
 
91
- ## 2.6.1 2017-01-19
109
+ - Adds the `EndShipper` Beta class with `create`, `retrieve`, `all`, and `save` functions
110
+ - Requests will now fail fast with an error if an API key is not provided instead of making a live API call with no key
111
+ - Fixes a bug where the library could not properly parse the response of deleting a child user
112
+ - Fixes a bug where you could not update a webhook due to a `wrong number of arguments` error
92
113
 
93
- * Updated create method for ScanForms
114
+ ## v4.2.1 (2022-05-11)
94
115
 
95
- ## 2.6.0 2017-01-17
116
+ - Corrects the `Beta` namespace for the new Referral class
96
117
 
97
- * Add basic CRUD methods for Webhooks
118
+ ## v4.2.0 (2022-05-09)
98
119
 
99
- ## 2.5.0 2016-12-19
120
+ - Adds a `lowest_rate()` function to Orders and Pickups
121
+ - Adds a `Shipment.get_lowest_smartrate()` function and a `shipment.lowest_smartrate()` function
122
+ - Removes the unusable `carrier` param from `Address.create_and_verify` along with the dead `message` conditional check
123
+ - Add beta Referral class for White Label API with these new functions: `create()`, `update_email()`, `all()`, and `add_credit_card()`
100
124
 
101
- * Add prefixes to report in utils
125
+ ## v4.1.2 (2022-03-16)
102
126
 
103
- ## 2.4.0 2016-12-08
127
+ - Rolls back the original connection behavior of establishing a new connection for every request (restores previous expectations for multithreaded implementations)
104
128
 
105
- * Add report resource to ruby client
129
+ ## v4.1.1 (2022-03-14)
106
130
 
107
- ## 2.3.0 2016-11-25
131
+ - Fixes a bug that prematurely closed connections when using multithreading by wrapping requests in a mutex (closes #148)
108
132
 
109
- * Updated dependencies to allow rest-client 2.0.0 and above
133
+ ## v4.1.0 (2022-03-09)
110
134
 
111
- ## 2.2.0 2016-07-26
135
+ - Adds support for custom client connections (#142)
136
+ - Reduces memory usage by reusing connections
137
+ - Extends all objects with `Enumerable` allowing for iterator patterns (#143)
112
138
 
113
- * Added standalone Insurance model
139
+ ## v4.0.0 (2022-02-25)
114
140
 
115
- ## 2.1.11 2016-02-04
141
+ - Bumps minimum Ruby version from `2.2` to `2.5`
142
+ - Bumps dev dependencies
143
+ - Documents each interface of the project in code
144
+ - Overhauls the test suite with full coverage
145
+ - Introduces `Rubocop` and lints the entire project
146
+ - Removes the unusable `Print` and `PrintJob` objects
147
+ - Removes deprecated and unusable `stamp_and_barcode_by_reference` method on the Batch object
148
+ - Explicitly returns an error of "not implemented" for `Rate.all` and `Parcel.all`
149
+ - Removes the `Shipment.get_rates` function as shipments already contain rates. If you need to get new rates for a shipment, use the `Shipment.regenerate_rates` function instead
150
+ - Removes the parameters from `Address.verify` as they are unusable
151
+ - Removes the deprecated `http_status` property of the `EasyPost::Error` object as it was replaced with `status`
152
+ - Fixes a bug that would append an extra `id` field to each retrieved object
153
+ - Various other small improvements and bug fixes
116
154
 
117
- * Allowed user creation for top-level users
155
+ ## v3.5.0 (2021-12-06)
118
156
 
119
- ## 2.1.10 2015-12-23
157
+ - Adds the `update_brand` method to the user object (closes #122)
120
158
 
121
- * Added verify and verify_strict params to Address.create
122
- * Added Tracker.create_list and Tracker.all_updated for working with large
123
- numbers of Trackers.
159
+ ## v3.4.0 (2021-07-13)
124
160
 
125
- ## 2.1.9 2015-11-04
161
+ - Removed deprecated `Item` object
162
+ - Sorted EasyPost Resources list
163
+ - Remove 2015-vintage experimental `all_updated` method on Tracker
164
+ - Fixes API key retrieval (#120, thanks @andychongyz)
165
+ - Adds `regenerate_rates` method for new rerate API
166
+ - Adds `deconstruct_keys` method to allow for pattern matching on EasyPost objects
126
167
 
127
- * Added new tests for Tracker.all
128
- * Updated some old examples
168
+ ## v3.3.0 (2021-06-10)
129
169
 
130
- ## 2.1.8 2015-10-21
170
+ - Adds `SmartRate` functionality to the `Shipments` object (available by calling `get_smartrates` on a shipment)
171
+ - Fix bug where `EasyPost::CarrierAccount.types` was hitting the wrong endpoint
131
172
 
132
- * Added Cancel method for Pickups (thanks Ramie Blatt!)
173
+ ## v3.2.0 (2021-01-14)
133
174
 
134
- ## 2.1.7 2015-10-05
175
+ - Replace Travis CI with Github Actions
176
+ - Add Ruby 3.0 to supported platforms (#110; thanks @maxwell)
135
177
 
136
- * Fixed Address.create_and_verify and changed how errors are raised (thanks Dimitri Roche!)
137
- * Require newer version of the multi_json package
178
+ ## v3.1.5 (2020-12-16)
138
179
 
139
- ## 2.1.6 2015-06-10
180
+ - Fix attribute lookup when manually constructing objects (#105; thanks @drewtempelmeyer)
181
+ - Flatten class names and clean up some other style issues
182
+ - Fix `EasyPost::Address.create_and_verify`, broken since 3.1.0 (#108; thanks @rajbirverma)
140
183
 
141
- * Added Address message accessor for backwards compatability
184
+ ## v3.1.4 (2020-09-29)
142
185
 
143
- ## 2.1.5 2015-06-10
186
+ - Don't modify params passed into Address#create (#78; thanks @TheRusskiy)
187
+ - Don't modify `carriers` and `services` parameters to `Shipment.lowest_rate` (#71 / #103, thanks @vladvinnikov and @jurisgalang)
188
+ - When constructing an easypost object, convert the key to a string (#102; thanks @Geesu)
189
+ - Expose the raw HTTP response as `#http_body` on `EasyPost::Error` objects (#101; thanks @Geesu)
144
190
 
145
- * Removed Address.message
191
+ ## v3.1.3 (2020-06-26)
146
192
 
147
- ## 2.1.4 2015-06-03
193
+ - Fix bug causing Authorization header to be included in User-Agent header. All users must upgrade.
148
194
 
149
- * Add Printer and PrintJob resources.
195
+ ## v3.1.2 (2020-06-24)
150
196
 
151
- ## 2.1.3 2015-04-30
197
+ - Bad gem push. New version required.
152
198
 
153
- * Bux fix, EasyPost::Errors no longer break with a nil json body.
199
+ ## v3.1.1 (2020-06-23)
154
200
 
155
- ## 2.1.2 2015-04-29
201
+ - Fix bug where EasyPost.http_config was invalid when not explicitly initialized.
156
202
 
157
- * EasyPost::Errors now correctly parse field errors and error codes.
203
+ ## v3.1.0 (2020-06-23)
158
204
 
159
- ## 2.1.1 2015-04-15
205
+ - Add Shipment Invoice and Refund Report
206
+ - Remove dependencies on `RestClient` and `MultiJson`
207
+ - Remove some deprecated endpoints
160
208
 
161
- * CarrierAccount will now correctly save in-place modifications to credentials
162
- * Nested variables should now be saved correctly across all models
163
- * Fixed version numbering confusion (the previous version was 2.0.15, not 2.1.0)
209
+ ## v3.0.1 (2018-05-17)
164
210
 
165
- ## 2.0.15 2015-04-15
211
+ - Enforce TLS certificate validity by default
166
212
 
167
- * Added tracker to shipment buy response
168
- * Updated tracker tests
213
+ ## v3.0.0 (2018-02-15)
169
214
 
170
- ## 2.0.14 2015-04-15
215
+ - Require use of ruby ~> 2.0 and TLSv1.2
171
216
 
172
- * Added User and CarrierAccount models with CRUD functionality
217
+ ## v2.7.3 (2018-02-05)
173
218
 
174
- ## 2.0.13 2014-10-30
219
+ - Fix bug with introduced around certain JSON objects with IDs (thanks vladvinnikov!)
175
220
 
176
- * Added Pickup, PickupRate resources.
177
- * Added ability to pass api_key to a few resources that were missing it.
221
+ ## v2.7.2 (2018-02-01)
178
222
 
179
- ## 2.0.12 2014-07-07
223
+ - Removed unused and unsupported code paths for Container model
224
+ - Removed unused and unsupported code path for Stamp and Barcode methods on the Shipment model
225
+ - Fixed a bug with non-model JSON object with an "id" key being treated as models and raising errors
180
226
 
181
- * Added Item, Container, and Order resources.
182
- * Fixed and added a lot of tests.
227
+ ## v2.7.1 (2017-05-25)
183
228
 
184
- ## 2.0.11 2013-12-16
229
+ - Allow reports to be retrieved without passing a type
185
230
 
186
- * Added Event.receive method for parsing events sent by webhook.
187
- * Fixed tests to account for the tracking code returning and array of details instead of a Hash
231
+ ## v2.7.0 (2017-04-04)
188
232
 
189
- ## 2.0.10 2013-10-03
233
+ - Changed Report CRUD signatures. requires report type to be passed
190
234
 
191
- * API Addition: Event resource added for webhook consumption.
235
+ ## v2.6.2 (2017-02-14)
192
236
 
193
- ## 2.0.9 2013-09-19
237
+ - Added get_rates method for Orders
194
238
 
195
- * Interface Change: Changed batch.scan_form to batch.create_scan_form to support the ability to refer to scan forms associated to batches.
239
+ ## v2.6.1 (2017-01-19)
196
240
 
197
- ## 2.0.3 2013-07-31
241
+ - Updated create method for ScanForms
198
242
 
199
- * API Addition: Tracker resource added. Trackers can be used to register any tracking code with EasyPost webhooks.
243
+ ## v2.6.0 (2017-01-17)
200
244
 
201
- ## 2.0.2 2013-07-23
245
+ - Add basic CRUD methods for Webhooks
202
246
 
203
- * API Addition: Shipment.track_with_code returns tracking details for any tracking code.
247
+ ## v2.5.0 (2016-12-19)
204
248
 
205
- ## 2.0.1 2013-07-07
249
+ - Add prefixes to report in utils
206
250
 
207
- * API Addition: Address.create_and_verify returns a verified address in one step.
208
- * API Addition: Shipment.label forces the creation of additional label formats (pdf, epl2, zpl).
209
- * API Addition: Shipment.insure purchases insurance for a shipment.
210
- * Library Update: Added the ability to negatively filter carriers and services with Shipment.lowest_rate (e.g. '!usps').
251
+ ## v2.4.0 (2016-12-08)
252
+
253
+ - Add report resource to ruby client
254
+
255
+ ## v2.3.0 (2016-11-25)
256
+
257
+ - Updated dependencies to allow rest-client 2.0.0 and above
258
+
259
+ ## v2.2.0 (2016-07-260
260
+
261
+ - Added standalone Insurance model
262
+
263
+ ## v2.1.11 (2016-02-04)
264
+
265
+ - Allowed user creation for top-level users
266
+
267
+ ## v2.1.10 (2015-12-23)
268
+
269
+ - Added verify and verify_strict params to Address.create
270
+ - Added Tracker.create_list and Tracker.all_updated for working with large
271
+ numbers of Trackers.
272
+
273
+ ## v2.1.9 (2015-11-04)
274
+
275
+ - Added new tests for Tracker.all
276
+ - Updated some old examples
277
+
278
+ ## v2.1.8 (2015-10-21)
279
+
280
+ - Added Cancel method for Pickups (thanks Ramie Blatt!)
281
+
282
+ ## v2.1.7 (2015-10-05)
283
+
284
+ - Fixed Address.create_and_verify and changed how errors are raised (thanks Dimitri Roche!)
285
+ - Require newer version of the multi_json package
286
+
287
+ ## v2.1.6 (2015-06-10)
288
+
289
+ - Added Address message accessor for backwards compatability
290
+
291
+ ## v2.1.5 (2015-06-10)
292
+
293
+ - Removed Address.message
294
+
295
+ ## v2.1.4 (2015-06-03)
296
+
297
+ - Add Printer and PrintJob resources.
298
+
299
+ ## v2.1.3 (2015-04-30)
300
+
301
+ - Bux fix, EasyPost::Errors no longer break with a nil json body.
302
+
303
+ ## v2.1.2 (2015-04-29)
304
+
305
+ - EasyPost::Errors now correctly parse field errors and error codes.
306
+
307
+ ## v2.1.1 (2015-04-15)
308
+
309
+ - CarrierAccount will now correctly save in-place modifications to credentials
310
+ - Nested variables should now be saved correctly across all models
311
+ - Fixed version numbering confusion (the previous version was 2.0.15, not 2.1.0)
312
+
313
+ ## v2.0.15 (2015-04-15)
314
+
315
+ - Added tracker to shipment buy response
316
+ - Updated tracker tests
317
+
318
+ ## v2.0.14 (2015-04-15)
319
+
320
+ - Added User and CarrierAccount models with CRUD functionality
321
+
322
+ ## v2.0.13 (2014-10-30)
323
+
324
+ - Added Pickup, PickupRate resources.
325
+ - Added ability to pass api_key to a few resources that were missing it.
326
+
327
+ ## v2.0.12 (2014-07-07)
328
+
329
+ - Added Item, Container, and Order resources.
330
+ - Fixed and added a lot of tests.
331
+
332
+ ## v2.0.11 (2013-12-16)
333
+
334
+ - Added Event.receive method for parsing events sent by webhook.
335
+ - Fixed tests to account for the tracking code returning and array of details instead of a Hash
336
+
337
+ ## v2.0.10 (2013-10-03)
338
+
339
+ - API Addition: Event resource added for webhook consumption.
340
+
341
+ ## v2.0.9 (2013-09-19)
342
+
343
+ - Interface Change: Changed batch.scan_form to batch.create_scan_form to support the ability to refer to scan forms associated to batches.
344
+
345
+ ## v2.0.3 (2013-07-31)
346
+
347
+ - API Addition: Tracker resource added. Trackers can be used to register any tracking code with EasyPost webhooks.
348
+
349
+ ## v2.0.2 (2013-07-23)
350
+
351
+ - API Addition: Shipment.track_with_code returns tracking details for any tracking code.
352
+
353
+ ## v2.0.1 (2013-07-07)
354
+
355
+ - API Addition: Address.create_and_verify returns a verified address in one step.
356
+ - API Addition: Shipment.label forces the creation of additional label formats (pdf, epl2, zpl).
357
+ - API Addition: Shipment.insure purchases insurance for a shipment.
358
+ - Library Update: Added the ability to negatively filter carriers and services with Shipment.lowest_rate (e.g. '!usps').
359
+
360
+ ## v2.0.0 (2013-06-25)
361
+
362
+ ## v1.1.3 (2013-06-05)
363
+
364
+ ## v1.1.2 (2013-06-05)
365
+
366
+ ## v1.1.1 (2013-02-12)
367
+
368
+ ## v1.1.0 (2013-01-29)
369
+
370
+ ## v1.0.8 (2012-11-19)
371
+
372
+ ## v1.0.7 (2012-11-19)
373
+
374
+ ## v1.0.6 (2012-11-19)
375
+
376
+ ## v1.0.5 (2012-11-19)
377
+
378
+ ## v1.0.4 (2012-11-14)
379
+
380
+ ## v1.0.3 (2012-11-13)
381
+
382
+ ## v1.0.2 (2012-11-13)
383
+
384
+ ## v1.0.1 (2012-11-13)
385
+
386
+ ## v1.0.0 (2012-11-02)
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
  gemspec
data/Makefile ADDED
@@ -0,0 +1,70 @@
1
+ ## help - Display help about make targets for this Makefile
2
+ help:
3
+ @cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t
4
+
5
+ ## build - Builds the project
6
+ build:
7
+ gem build easypost.gemspec --strict
8
+ mkdir -p dist
9
+ mv *.gem dist/
10
+
11
+ ## clean - Cleans the project
12
+ clean:
13
+ rm -rf coverage doc *.gem dist
14
+
15
+ ## coverage - Generate a test coverage report
16
+ coverage:
17
+ make test
18
+
19
+ ## docs - Generate documentation for the library
20
+ docs:
21
+ bundle exec rdoc lib -o docs --title "EasyPost Ruby Docs"
22
+
23
+ ## install-styleguide - Import the style guides (Unix only)
24
+ install-styleguide: | update-examples-submodule
25
+ sh examples/symlink_directory_files.sh examples/style_guides/ruby .
26
+
27
+ ## install - Install globally from source
28
+ install: | update-examples-submodule
29
+ bundle install
30
+
31
+ ## lint - Lint the project
32
+ lint: rubocop scan
33
+
34
+ ## lint-fix - Fix Rubocop errors
35
+ lint-fix: rubocop-fix
36
+
37
+ ## publish - Publishes the built gem to Rubygems
38
+ publish:
39
+ gem push dist/*.gem
40
+
41
+ ## release - Cuts a release for the project on GitHub (requires GitHub CLI)
42
+ # tag = The associated tag title of the release
43
+ release:
44
+ gh release create ${tag} dist/*
45
+
46
+ ## rubocop - lints the project with rubocop
47
+ rubocop:
48
+ bundle exec rubocop
49
+
50
+ ## rubocop-fix - fix rubocop errors
51
+ rubocop-fix:
52
+ bundle exec rubocop -a
53
+
54
+ ## scan - Runs security analysis on the project with Brakeman
55
+ scan:
56
+ bundle exec brakeman lib --force
57
+
58
+ ## test - Test the project (and ignore warnings for test output)
59
+ test:
60
+ bundle exec rspec
61
+
62
+ ## update - Updates dependencies
63
+ update: | update-examples-submodule
64
+
65
+ ## update-examples-submodule - Update the examples submodule
66
+ update-examples-submodule:
67
+ git submodule init
68
+ git submodule update --remote
69
+
70
+ .PHONY: help build clean coverage docs install install-styleguide lint lint-fix publish release rubocop rubocop-fix scan test update update-examples-submodule