speedy-bg 0.1.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 (148) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/CODE_OF_CONDUCT.md +134 -0
  4. data/CONTRIBUTING.md +67 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +150 -0
  7. data/SECURITY.md +29 -0
  8. data/docs/API.md +740 -0
  9. data/docs/RESPONSE_CONTRACTS.md +55 -0
  10. data/docs/VCR.md +161 -0
  11. data/docs/schema-notes.md +38 -0
  12. data/lib/speedy/camel_case_middleware.rb +71 -0
  13. data/lib/speedy/client.rb +100 -0
  14. data/lib/speedy/client_resources.rb +776 -0
  15. data/lib/speedy/collection.rb +58 -0
  16. data/lib/speedy/error.rb +29 -0
  17. data/lib/speedy/model.rb +92 -0
  18. data/lib/speedy/models/calculation/address_location.rb +16 -0
  19. data/lib/speedy/models/calculation/calculation_content.rb +15 -0
  20. data/lib/speedy/models/calculation/calculation_recipient.rb +15 -0
  21. data/lib/speedy/models/calculation/calculation_result.rb +19 -0
  22. data/lib/speedy/models/calculation/calculation_sender.rb +16 -0
  23. data/lib/speedy/models/calculation/calculation_service.rb +16 -0
  24. data/lib/speedy/models/clients/client.rb +21 -0
  25. data/lib/speedy/models/clients/cod_contract_info.rb +16 -0
  26. data/lib/speedy/models/clients/cod_international_annex.rb +12 -0
  27. data/lib/speedy/models/clients/contract_info.rb +16 -0
  28. data/lib/speedy/models/clients/requirement.rb +12 -0
  29. data/lib/speedy/models/clients/special_delivery_requirements.rb +12 -0
  30. data/lib/speedy/models/common/address.rb +36 -0
  31. data/lib/speedy/models/error.rb +37 -0
  32. data/lib/speedy/models/location/address_nomenclature_type.rb +12 -0
  33. data/lib/speedy/models/location/block.rb +15 -0
  34. data/lib/speedy/models/location/complex.rb +23 -0
  35. data/lib/speedy/models/location/country.rb +25 -0
  36. data/lib/speedy/models/location/find_office_response.rb +12 -0
  37. data/lib/speedy/models/location/find_site_response.rb +12 -0
  38. data/lib/speedy/models/location/get_office_response.rb +12 -0
  39. data/lib/speedy/models/location/get_site_response.rb +12 -0
  40. data/lib/speedy/models/location/office.rb +41 -0
  41. data/lib/speedy/models/location/office_result.rb +13 -0
  42. data/lib/speedy/models/location/office_working_time_schedule.rb +15 -0
  43. data/lib/speedy/models/location/point_of_interest.rb +22 -0
  44. data/lib/speedy/models/location/postcode.rb +12 -0
  45. data/lib/speedy/models/location/routing_information.rb +14 -0
  46. data/lib/speedy/models/location/site.rb +30 -0
  47. data/lib/speedy/models/location/state.rb +17 -0
  48. data/lib/speedy/models/location/street.rb +23 -0
  49. data/lib/speedy/models/location/tour.rb +14 -0
  50. data/lib/speedy/models/payments/payout.rb +20 -0
  51. data/lib/speedy/models/payments/payout_details.rb +23 -0
  52. data/lib/speedy/models/pickup/pickup_order.rb +16 -0
  53. data/lib/speedy/models/pickup/terms_response.rb +12 -0
  54. data/lib/speedy/models/print/extended_print_response.rb +13 -0
  55. data/lib/speedy/models/print/label_info.rb +19 -0
  56. data/lib/speedy/models/print/label_info_response.rb +12 -0
  57. data/lib/speedy/models/print/parcel_to_print_additional_barcode.rb +14 -0
  58. data/lib/speedy/models/print/print_response.rb +12 -0
  59. data/lib/speedy/models/response.rb +13 -0
  60. data/lib/speedy/models/services/additional_courier_service.rb +11 -0
  61. data/lib/speedy/models/services/additional_courier_services.rb +21 -0
  62. data/lib/speedy/models/services/courier_service.rb +19 -0
  63. data/lib/speedy/models/services/extended_courier_service.rb +13 -0
  64. data/lib/speedy/models/shipments/bank_account.rb +12 -0
  65. data/lib/speedy/models/shipments/barcode_information.rb +20 -0
  66. data/lib/speedy/models/shipments/cod_payment.rb +12 -0
  67. data/lib/speedy/models/shipments/content.rb +20 -0
  68. data/lib/speedy/models/shipments/create_shipment_response.rb +16 -0
  69. data/lib/speedy/models/shipments/created_shipment_parcel.rb +14 -0
  70. data/lib/speedy/models/shipments/external_carrier_parcel_number.rb +12 -0
  71. data/lib/speedy/models/shipments/goods_item.rb +16 -0
  72. data/lib/speedy/models/shipments/money_transfer_premium.rb +13 -0
  73. data/lib/speedy/models/shipments/parcel.rb +22 -0
  74. data/lib/speedy/models/shipments/payment.rb +16 -0
  75. data/lib/speedy/models/shipments/primary_shipment.rb +12 -0
  76. data/lib/speedy/models/shipments/recipient.rb +21 -0
  77. data/lib/speedy/models/shipments/return_amounts.rb +11 -0
  78. data/lib/speedy/models/shipments/secondary_shipment.rb +18 -0
  79. data/lib/speedy/models/shipments/sender.rb +21 -0
  80. data/lib/speedy/models/shipments/shipment.rb +28 -0
  81. data/lib/speedy/models/shipments/shipment_additional_services.rb +17 -0
  82. data/lib/speedy/models/shipments/shipment_address.rb +10 -0
  83. data/lib/speedy/models/shipments/shipment_cod_additional_service.rb +20 -0
  84. data/lib/speedy/models/shipments/shipment_cod_fiscal_receipt_item.rb +14 -0
  85. data/lib/speedy/models/shipments/shipment_content.rb +24 -0
  86. data/lib/speedy/models/shipments/shipment_declared_value_additional_service.rb +13 -0
  87. data/lib/speedy/models/shipments/shipment_delivery.rb +14 -0
  88. data/lib/speedy/models/shipments/shipment_discount_card_id.rb +12 -0
  89. data/lib/speedy/models/shipments/shipment_electronic_return_receipt_additional_service.rb +14 -0
  90. data/lib/speedy/models/shipments/shipment_obpd.rb +13 -0
  91. data/lib/speedy/models/shipments/shipment_parcel.rb +23 -0
  92. data/lib/speedy/models/shipments/shipment_parcel_number.rb +12 -0
  93. data/lib/speedy/models/shipments/shipment_parcel_ref.rb +13 -0
  94. data/lib/speedy/models/shipments/shipment_parcel_size.rb +13 -0
  95. data/lib/speedy/models/shipments/shipment_payment.rb +17 -0
  96. data/lib/speedy/models/shipments/shipment_phone_number.rb +12 -0
  97. data/lib/speedy/models/shipments/shipment_price.rb +23 -0
  98. data/lib/speedy/models/shipments/shipment_price_amount.rb +13 -0
  99. data/lib/speedy/models/shipments/shipment_recipient.rb +14 -0
  100. data/lib/speedy/models/shipments/shipment_return_additional_services.rb +20 -0
  101. data/lib/speedy/models/shipments/shipment_return_receipt_additional_service.rb +14 -0
  102. data/lib/speedy/models/shipments/shipment_return_voucher_additional_service.rb +14 -0
  103. data/lib/speedy/models/shipments/shipment_rod_additional_service.rb +15 -0
  104. data/lib/speedy/models/shipments/shipment_rop_additional_service.rb +12 -0
  105. data/lib/speedy/models/shipments/shipment_rop_additional_service_line.rb +12 -0
  106. data/lib/speedy/models/shipments/shipment_sender.rb +23 -0
  107. data/lib/speedy/models/shipments/shipment_service.rb +17 -0
  108. data/lib/speedy/models/shipments/shipment_swap_additional_service.rb +17 -0
  109. data/lib/speedy/models/shipments/update_shipment_response.rb +10 -0
  110. data/lib/speedy/models/tracking/bulk_tracking_data_file.rb +14 -0
  111. data/lib/speedy/models/tracking/external_carrier_parcel_number_details.rb +13 -0
  112. data/lib/speedy/models/tracking/tracked_parcel.rb +21 -0
  113. data/lib/speedy/models/tracking/tracked_parcel_operation.rb +22 -0
  114. data/lib/speedy/models/tracking/tracked_parcel_operation_additional_info.rb +17 -0
  115. data/lib/speedy/models/tracking/tracked_parcel_operation_additional_info_predict.rb +14 -0
  116. data/lib/speedy/models/tracking/tracked_parcel_operation_additional_info_recipient.rb +14 -0
  117. data/lib/speedy/models/validation/validation_response.rb +14 -0
  118. data/lib/speedy/resource_attributes.rb +87 -0
  119. data/lib/speedy/service_resource.rb +94 -0
  120. data/lib/speedy/services/calculation.rb +22 -0
  121. data/lib/speedy/services/clients.rb +40 -0
  122. data/lib/speedy/services/courier_services.rb +25 -0
  123. data/lib/speedy/services/location/block.rb +32 -0
  124. data/lib/speedy/services/location/complex.rb +39 -0
  125. data/lib/speedy/services/location/country.rb +70 -0
  126. data/lib/speedy/services/location/office.rb +50 -0
  127. data/lib/speedy/services/location/point_of_interest.rb +39 -0
  128. data/lib/speedy/services/location/postcode.rb +25 -0
  129. data/lib/speedy/services/location/site.rb +77 -0
  130. data/lib/speedy/services/location/state.rb +46 -0
  131. data/lib/speedy/services/location/street.rb +39 -0
  132. data/lib/speedy/services/location.rb +11 -0
  133. data/lib/speedy/services/payments.rb +19 -0
  134. data/lib/speedy/services/pickup.rb +38 -0
  135. data/lib/speedy/services/print.rb +58 -0
  136. data/lib/speedy/services/shipments/shipment.rb +120 -0
  137. data/lib/speedy/services/shipments.rb +11 -0
  138. data/lib/speedy/services/tracking.rb +26 -0
  139. data/lib/speedy/services/validation/address.rb +26 -0
  140. data/lib/speedy/services/validation/general.rb +37 -0
  141. data/lib/speedy/services/validation.rb +11 -0
  142. data/lib/speedy/transport_error.rb +17 -0
  143. data/lib/speedy/util.rb +67 -0
  144. data/lib/speedy/version.rb +5 -0
  145. data/lib/speedy-bg.rb +6 -0
  146. data/lib/speedy.rb +203 -0
  147. data/sig/speedy.rbs +374 -0
  148. metadata +227 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e50b937c817d5bb0981e3770b754f29284563afc4a1fb03a8075d58aa5b35457
4
+ data.tar.gz: 26124b19bcf347557b8984339f233888c3fc184d84cec9b76286c8cf16432abe
5
+ SHA512:
6
+ metadata.gz: 0fcab4968a5a29fdd217aab2cd46ac35d005cab551425ba02919858b82220b9fe430e15383d81bca2a3378eb295ac68ea439c0e50fb679e5bd40ac35bffa76f6
7
+ data.tar.gz: 57c3db953357f44a177560ee3dba248f89422beb42df64e2866c606a7b0d03ead3976db547a843ae158f7d8aceda74b9c8eae543f438aeb388394ab70c855f87
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # Changelog
2
+
3
+ Release notes will start after the initial release.
@@ -0,0 +1,134 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [the repository maintainer's private GitHub contact][maintainer]. Do not use a
64
+ public issue for conduct reports.
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
134
+ [maintainer]: https://github.com/BoyanGeorgiev96
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,67 @@
1
+ # Contributing
2
+
3
+ Thanks for helping improve `speedy-bg`. This is an independent community
4
+ project and is not supported by Speedy AD.
5
+
6
+ ## Support scope
7
+
8
+ Use GitHub issues for reproducible bugs, documentation corrections, and focused
9
+ feature proposals. Include the gem version, Ruby version, endpoint name,
10
+ expected behavior, actual behavior, and a minimal sanitized example. Never post
11
+ credentials, unredacted request or response bodies, customer details, shipment
12
+ numbers, or contract-specific data.
13
+
14
+ Maintenance is best-effort and generally reviewed on weekends. There is no
15
+ guaranteed response time, endpoint coverage, compatibility with undocumented
16
+ carrier behavior, or commercial support. Pull requests for fixes are welcome.
17
+ Users are also free to fork the MIT-licensed project and maintain behavior that
18
+ is outside this project's scope.
19
+
20
+ Security reports must follow [SECURITY.md](SECURITY.md), not the public issue
21
+ tracker.
22
+
23
+ ## Development
24
+
25
+ Use a currently supported Ruby version, then install dependencies and run:
26
+
27
+ ```bash
28
+ bundle install
29
+ bundle exec rake
30
+ bundle exec rbs validate
31
+ ```
32
+
33
+ Do not make live carrier requests in the normal test suite. Add deterministic
34
+ Faraday test-adapter examples for request serialization, response casting, and
35
+ errors. Contract recordings are opt-in, must use read-only operations unless a
36
+ cleanup plan has been agreed, and must be reviewed for authentication and
37
+ personal data before committing them.
38
+
39
+ ## Pull requests
40
+
41
+ - Keep changes focused and explain the public API impact.
42
+ - Add or update tests for behavior changes.
43
+ - Update the README, RBS declarations, and schema notes when public behavior
44
+ changes.
45
+ - Preserve Ruby 3.3, 3.4, and 4.0 compatibility.
46
+ - Confirm `bundle exec rake`, `bundle exec rbs validate`, and the package smoke
47
+ test pass.
48
+
49
+ By contributing, you agree that your contribution is licensed under the MIT
50
+ License included in this repository.
51
+
52
+ ## Releasing
53
+
54
+ The `Release to RubyGems` workflow is manual and its `publish` confirmation is
55
+ disabled by default, so it never runs during ordinary CI. To release, select
56
+ the existing `vVERSION` tag matching the gemspec when dispatching the workflow
57
+ and enable the confirmation. Dispatching from a branch or a mismatched tag
58
+ fails the version check. It uses RubyGems Trusted Publishing and does not read a
59
+ long-lived API key from repository secrets.
60
+
61
+ Before the first release, the owner must configure a pending trusted publisher
62
+ for the `speedy-bg` gem on RubyGems.org. It must identify this repository,
63
+ `.github/workflows/release.yml`, and the GitHub `release` environment. The
64
+ repository variable `RUBYGEMS_TRUSTED_PUBLISHING_ENABLED` must then be set to
65
+ `true`. Until both the publisher and this gate are configured, the release job
66
+ is skipped safely. Normal CI also checks that any pushed `v*` tag exactly
67
+ matches the gemspec version.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Boyan Georgiev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,150 @@
1
+ # Speedy for Ruby
2
+
3
+ A community Ruby client for the Speedy Bulgaria REST API. Not affiliated with,
4
+ endorsed by, or maintained by Speedy AD. Supports Ruby 3.3, 3.4, and 4.0.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ bundle add speedy-bg
10
+ ```
11
+
12
+ The package is `speedy-bg`; the namespace is `Speedy`. Bundler loads it
13
+ automatically, or use `require "speedy"` explicitly.
14
+
15
+ ## Configuration
16
+
17
+ Configure once at application boot. The default URL is `https://api.speedy.bg/v1/`.
18
+
19
+ ```ruby
20
+ Speedy::Client.configure do |config|
21
+ config.username = ENV.fetch("SPEEDY_USERNAME")
22
+ config.password = ENV.fetch("SPEEDY_PASSWORD")
23
+ config.language = "BG"
24
+ config.client_system_id = Integer(ENV["SPEEDY_CLIENT_SYSTEM_ID"], 10, exception: false)
25
+ config.open_timeout = 10
26
+ config.read_timeout = 30
27
+ config.write_timeout = 30
28
+ end
29
+ ```
30
+
31
+ For Rails, place configuration in `config/initializers/speedy.rb` and read
32
+ credentials from Rails credentials instead:
33
+
34
+ ```ruby
35
+ Speedy::Client.configure do |config|
36
+ config.username = Rails.application.credentials.dig(:speedy, :username)
37
+ config.password = Rails.application.credentials.dig(:speedy, :password)
38
+ config.client_system_id = Rails.application.credentials.dig(:speedy, :client_system_id)
39
+ config.language = I18n.default_locale.to_s.upcase
40
+ end
41
+ ```
42
+
43
+ `config.debug = true` logs headers and request/status lines, not bodies.
44
+ `config.debug_bodies = true` opts into body logging. Configured credentials are
45
+ always filtered, but bodies may expose customer data; protect those logs.
46
+
47
+ ## Usage
48
+
49
+ Request arguments and response readers use `snake_case`; API `camelCase` and
50
+ acronyms are converted automatically.
51
+
52
+ ```ruby
53
+ client = Speedy::Client.instance
54
+ site = client.find_sites(country_id: 100, name: "София").first
55
+ offices = client.find_offices(site_id: site.id)
56
+
57
+ calculations = client.calculate_delivery_fee(
58
+ recipient: { pickup_office_id: offices.first.id },
59
+ service: { service_ids: [505] },
60
+ content: { parcels_count: 1, total_weight: 0.1 },
61
+ payment: { courier_service_payer: "SENDER" }
62
+ )
63
+ price = calculations.first.price.total
64
+
65
+ tracking = client.track_shipments(
66
+ parcels: [{ id: "700000001001" }], last_operation_only: true
67
+ )
68
+ latest_operation = tracking.first.operations.first
69
+ ```
70
+
71
+ JSON endpoints return typed models or collections. Unknown response fields are
72
+ retained in models and `to_h`; missing documented fields return `nil`.
73
+ `print_labels_pdf` and `print_voucher` return raw PDF/ZPL bytes;
74
+ `print_labels` returns a typed extended-label response.
75
+
76
+ ### Errors
77
+
78
+ HTTP and transport failures raise `Speedy::Error` or a subclass.
79
+ `Speedy::TransportError` covers `ConnectionError`, `TimeoutError`, and `SSLError`;
80
+ its `status` is `nil` and its `cause` retains the original exception.
81
+ Errors inside successful HTTP responses remain on models or collections:
82
+
83
+ ```ruby
84
+ begin
85
+ result = client.calculate_delivery_fee(**attributes)
86
+ warn result.error.full_message if result.error?
87
+ rescue Speedy::Error => error
88
+ warn "Speedy request failed: status=#{error.status.inspect}"
89
+ end
90
+ ```
91
+
92
+ Inspect individual results for per-item errors too. Do not log submitted
93
+ shipment attributes or unsanitized API error messages containing customer data.
94
+ Transport messages are safe summaries; the original `cause` and `full_message`
95
+ may contain private data. Requests are not automatically retried, and a timeout
96
+ does not prove that a mutation failed. See the [error reference](docs/API.md#errors).
97
+
98
+ ## API coverage
99
+
100
+ See the [method reference and examples](docs/API.md) for every public endpoint
101
+ method, its arguments, return type, and mutation warnings.
102
+
103
+ Calculation, shipment management, printing, tracking, courier services, pickup,
104
+ clients/contracts, payouts, location lookups and CSV exports, and validation are
105
+ implemented. Some operations require account permissions. Tracking-file URLs
106
+ are returned without downloading them.
107
+
108
+ See [response contracts](docs/RESPONSE_CONTRACTS.md) for endpoint coverage and
109
+ example-response tests, and [schema notes](docs/schema-notes.md) for unresolved
110
+ response shapes and the address-search schemas with no documented HTTP route.
111
+
112
+ ## Development and contract tests
113
+
114
+ ```bash
115
+ bundle install
116
+ bundle exec rake
117
+ bundle exec rbs -r date -I sig validate
118
+ bundle exec rake yard # Generates browsable documentation in doc/index.html
119
+ ```
120
+
121
+ Normal tests do not contact Speedy. CI also replays committed VCR recordings
122
+ with recording and network access disabled, without loading `.env` files:
123
+
124
+ ```bash
125
+ SPEEDY_VCR_REPLAY=1 bundle exec rspec spec/recorded_contract_spec.rb
126
+ ```
127
+
128
+ For opt-in recording, copy
129
+ `.env.example` to `.env`, set test-account credentials and applicable
130
+ `SPEEDY_CONTRACT_*` values, then run:
131
+
132
+ ```bash
133
+ SPEEDY_LIVE_TESTS=1 bundle exec rspec spec/live
134
+ ```
135
+
136
+ Shipment mutations require `SPEEDY_MUTATING_LIVE_TESTS=1` as well and have explicit
137
+ cleanup. Printing tests use existing printable identifiers; documents are
138
+ replaced completely before recording. Review every cassette before committing.
139
+ See [VCR policy](docs/VCR.md) for gates, redaction, and cleanup limits.
140
+
141
+ ## Versioning and support
142
+
143
+ This gem follows [Semantic Versioning 2.0.0](https://semver.org/). Before 1.0,
144
+ minor releases may break the public API. From 1.0, incompatible changes to
145
+ documented methods, arguments, models, return types, or errors require a major release.
146
+
147
+ Issues and focused fix PRs are welcome. Maintenance is best-effort, generally
148
+ reviewed on weekends; no response time or ongoing support is guaranteed.
149
+ See [contributing](CONTRIBUTING.md) and [security reporting](SECURITY.md).
150
+ MIT licensed; you are free to fork and adapt the client.
data/SECURITY.md ADDED
@@ -0,0 +1,29 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Until a stable release exists, security fixes are made on the latest released
6
+ version and the default branch only. After 1.0, the latest minor line will be
7
+ the supported line unless a release announcement says otherwise.
8
+
9
+ ## Reporting a vulnerability
10
+
11
+ Do not open a public issue for suspected vulnerabilities or exposed secrets.
12
+ Use GitHub's private vulnerability reporting for this repository. If that
13
+ facility is unavailable, contact the maintainer privately through the contact
14
+ details on the repository owner's GitHub profile.
15
+
16
+ Include a description, affected versions, reproduction steps, impact, and any
17
+ suggested mitigation. Remove real credentials and customer or shipment data.
18
+ Reports are handled on a best-effort basis; the project cannot promise a
19
+ response or remediation deadline.
20
+
21
+ ## Integration responsibilities
22
+
23
+ The gem sends carrier credentials and may process names, phone numbers,
24
+ addresses, shipment contents, and financial information. Applications must
25
+ protect credentials, restrict log access, choose appropriate retention, and
26
+ comply with applicable privacy requirements. Debug response bodies are disabled
27
+ by default. Enabling body logging is an explicit application decision and
28
+ should not be used in production. Configured credentials remain filtered even
29
+ when body logging is enabled.