easypost 3.5.1 → 5.2.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 (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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c893399d43b9432c0b6812c5649ab48ad2ad1c04b6373e7999cc8c1fdf22d82b
4
- data.tar.gz: f98230c21010af6117011b0ddee1a1bda574a821fc5ae470a85e4961e72954ef
3
+ metadata.gz: 043543a947c3d50354a25d984eded8e68e37d9af9d7e2c6158176201426cafa1
4
+ data.tar.gz: 15ebc3486ec63ac23b0dfa6de82001537a72697863e1587fd9a1d909cde33a9a
5
5
  SHA512:
6
- metadata.gz: 1822930673f844b99cc6f53ea4c5564b54342590383433ee359f4c3420d56ddbd3cc166d4d2e1975b52a848c95d6854b1b0e79245e3a9b9660ee309a795f5b99
7
- data.tar.gz: b7fa805a9b6cc8a65b3076828f9bd5740709475b4d63824d34dc4981c9ea779af1c9eff273d546e59c7e79d0b7002f9dbbd3353d5faad2911e6615495cbec6cc
6
+ metadata.gz: 8a004acaa7797b54fd7226e4321a47e9aaa11aa055ee39dd886456d547f3e9ec847046c77f2f548a3f510c9d992842c4896fcb5beb6ee060280098e87ee2ae40
7
+ data.tar.gz: 7b4f5377749b4d65278f744befef446cfcfe7372f171e64a6b42996b9c0c988b0a6370f949d2986698fc5484f66d4bc3cb879b0f714b04a25e9216c196d960ee
data/.gitattributes ADDED
@@ -0,0 +1,9 @@
1
+ * text=auto
2
+
3
+ # Cassettes
4
+ spec/cassettes/**/* -diff
5
+ spec/cassettes/**/* linguist-generated
6
+
7
+ # Docs
8
+ docs/**/* -diff
9
+ docs/**/* linguist-generated
@@ -0,0 +1,2 @@
1
+ # Ping the DevEx team for reviews on every PR
2
+ * @EasyPost/devex
@@ -0,0 +1,81 @@
1
+ name: Bug Report
2
+ description: File a bug report
3
+ title: "[Bug]: "
4
+ labels: [ "triage" ]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for taking the time to report an issue in this repository. Please fill out the form below.
10
+ - type: input
11
+ id: software-version
12
+ attributes:
13
+ label: Software Version
14
+ # change this description for the specific repo
15
+ description: |
16
+ What version of our software are you running?
17
+ TIP: [Available versions](https://github.com/EasyPost/easypost-ruby/releases)
18
+ validations:
19
+ required: true
20
+ - type: input
21
+ id: language-version
22
+ attributes:
23
+ label: Language Version
24
+ # change this description for the specific language of the repo
25
+ description: |
26
+ What language version and/or framework are you using?
27
+ TIP: [How to find your Ruby version](https://blog.arkency.com/which-ruby-version-am-i-using-how-to-check/)
28
+ validations:
29
+ required: true
30
+ - type: input
31
+ id: os
32
+ attributes:
33
+ label: Operating System
34
+ description: What operating system are you running the software on?
35
+ validations:
36
+ required: true
37
+ - type: textarea
38
+ id: behavior
39
+ attributes:
40
+ label: What happened?
41
+ description: |
42
+ Please describe what happened in reproducible steps.
43
+ Include how often you see this issue, and any relevant links (i.e. GitHub issue, Stack Overflow, etc.).
44
+ value: |
45
+ 1.
46
+ 2.
47
+ 3.
48
+ ...
49
+ validations:
50
+ required: true
51
+ - type: textarea
52
+ id: expected-behavior
53
+ attributes:
54
+ label: What was expected?
55
+ description: Please describe what was expected to happen instead.
56
+ validations:
57
+ required: true
58
+ - type: textarea
59
+ id: sample-code
60
+ attributes:
61
+ label: Sample Code
62
+ description: |
63
+ Please provide any sample code that demonstrates the behavior.
64
+ This will be automatically formatted into the appropriate language, so no need for backticks.
65
+ **Do not include any private information such as API keys or passwords.**
66
+ # change this render to the appropriate language: https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
67
+ render: rb
68
+ validations:
69
+ required: false
70
+ - type: textarea
71
+ id: logs
72
+ attributes:
73
+ label: Relevant logs
74
+ description: |
75
+ Please copy and paste any relevant log output.
76
+ This will be automatically formatted into shell output, so no need for backticks.
77
+ If you have screenshots instead, please paste them below.
78
+ **Do not include any private information such as API keys or passwords.**
79
+ render: sh
80
+ validations:
81
+ required: false
@@ -0,0 +1,37 @@
1
+ name: Feature Request
2
+ description: Request a new feature
3
+ title: "[Feat]: "
4
+ labels: [ "triage" ]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for taking the time to request a new feature.
10
+ Please note, all feature requests are subject to review and approval.
11
+ We welcome all suggestions and ideas, but we cannot guarantee when or if we will implement them.
12
+
13
+ We also welcome pull requests, if you would like to implement the feature yourself.
14
+ Doing so will likely accelerate the process of implementing the requested feature.
15
+ - type: checkboxes
16
+ id: searched
17
+ attributes:
18
+ label: Feature Request Is New
19
+ # change issue link below for the specific repo
20
+ description: |
21
+ Before we begin, please confirm that the requested feature does not already exist or has not [already been requested](https://github.com/EasyPost/easypost-ruby/issues).
22
+ options:
23
+ - label: I have verified that the requested feature does not already exist or has not already been requested.
24
+ required: true
25
+ - type: textarea
26
+ id: description
27
+ attributes:
28
+ label: Description of the feature
29
+ description: |
30
+ Please provide a detailed description of the feature, including:
31
+ - What the feature is
32
+ - What value it adds to the application
33
+ - How it should be implemented (i.e. pseudo-code, or a high-level description of the user experience)
34
+ - Any other relevant information
35
+ validations:
36
+ required: true
37
+
@@ -0,0 +1,22 @@
1
+ # Description
2
+
3
+ <!-- Please provide a general summary of your PR changes and link any related issues or other pull requests. -->
4
+
5
+ # Testing
6
+
7
+ <!--
8
+ Please provide details on how you tested this code. See below.
9
+
10
+ - All pull requests must be tested (unit tests where possible with accompanying cassettes, or provide a screenshot of end-to-end testing when unit tests are not possible)
11
+ - New features must get a new unit test
12
+ - Bug fixes/refactors must re-record existing cassettes
13
+ -->
14
+
15
+ # Pull Request Type
16
+
17
+ Please select the option(s) that are relevant to this PR.
18
+
19
+ - [ ] Bug fix (non-breaking change which fixes an issue)
20
+ - [ ] New feature (non-breaking change which adds functionality)
21
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
22
+ - [ ] Improvement (fixing a typo, updating readme, renaming a variable name, etc)
@@ -2,21 +2,70 @@ name: 'CI'
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ master ]
5
+ branches: [master]
6
6
  pull_request: ~
7
+ workflow_dispatch: ~
7
8
 
8
9
  jobs:
9
10
  run-tests:
10
11
  runs-on: ubuntu-latest
11
12
  strategy:
12
13
  matrix:
13
- rubyversion: ['2.4', '2.5', '2.6', '2.7', '3.0']
14
+ rubyversion: ['2.6', '2.7', '3.0', '3.1', '3.2']
14
15
  steps:
15
- - uses: actions/checkout@v2
16
- - name: set up ruby
16
+ - name: Checkout Repository
17
+ uses: actions/checkout@v3
18
+ - name: Set up Ruby
17
19
  uses: ruby/setup-ruby@v1
18
20
  with:
19
21
  ruby-version: ${{ matrix.rubyversion }}
22
+ rubygems: '3.0.0'
20
23
  bundler-cache: true
24
+ - name: Install Dependencies
25
+ run: make install
21
26
  - name: run tests
22
- run: bundle exec rspec
27
+ run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test
28
+ - name: Coveralls
29
+ if: github.ref == 'refs/heads/master'
30
+ uses: coverallsapp/github-action@master
31
+ with:
32
+ github-token: ${{ secrets.GITHUB_TOKEN }}
33
+ path-to-lcov: './coverage/lcov/easypost-ruby.lcov'
34
+ lint:
35
+ runs-on: ubuntu-latest
36
+ steps:
37
+ - name: Checkout Repository
38
+ uses: actions/checkout@v3
39
+ - name: Set up Ruby
40
+ uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: '3.2'
43
+ rubygems: '3.0.0'
44
+ bundler-cache: true
45
+ - name: Install Dependencies
46
+ run: make install
47
+ - name: Install style guides
48
+ run: make install-styleguide
49
+ - name: Lint Project
50
+ run: make lint
51
+ docs:
52
+ if: github.ref == 'refs/heads/master'
53
+ runs-on: ubuntu-latest
54
+ steps:
55
+ - name: Checkout Repository
56
+ uses: actions/checkout@v3
57
+ - name: Set up Ruby
58
+ uses: ruby/setup-ruby@v1
59
+ with:
60
+ ruby-version: '3.2'
61
+ rubygems: '3.0.0'
62
+ bundler-cache: true
63
+ - name: Install Dependencies
64
+ run: make install
65
+ - name: Generate Docs
66
+ run: make docs
67
+ - name: Deploy docs
68
+ uses: peaceiris/actions-gh-pages@v3
69
+ with:
70
+ github_token: ${{ secrets.GITHUB_TOKEN }}
71
+ publish_dir: docs
data/.gitignore CHANGED
@@ -1,9 +1,20 @@
1
- *.gem
2
- *.rbc
1
+ ._*
2
+ .AppleDouble
3
3
  .bundle
4
4
  .config
5
- Gemfile.lock
5
+ .DS_Store
6
+ .env
7
+ .idea/
8
+ .LSOverride
9
+ .Spotlight-V100
10
+ .Trashes
11
+ *.gem
12
+ *.rbc
6
13
  coverage
14
+ dist
15
+ docs
16
+ Gemfile.lock
17
+ Icon
7
18
  InstalledFiles
8
19
  lib/bundler/man
9
20
  pkg
@@ -12,18 +23,17 @@ spec/reports
12
23
  test/tmp
13
24
  test/version_tmp
14
25
  tmp
15
-
16
- # YARD artifacts
17
- .yardoc
18
- _yardoc
19
- doc/
20
-
21
- # iOS
22
- .DS_Store
23
- .AppleDouble
24
- .LSOverride
25
- Icon
26
- ._*
27
- .Spotlight-V100
28
- .Trashes
29
26
  vendor/
27
+ /easycop.yml
28
+ /.rubocop.yml
29
+ [._]*.s[a-v][a-z]
30
+ [._]*.sw[a-p]
31
+ [._]s[a-rt-v][a-z]
32
+ [._]ss[a-gi-z]
33
+ [._]sw[a-p]
34
+ Session.vim
35
+ Sessionx.vim
36
+ .netrwhist
37
+ *~
38
+ tags
39
+ [._]*.un~
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "examples"]
2
+ path = examples
3
+ url = https://github.com/EasyPost/examples