yasmina-motor-ruby 0.0.8

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 (80) hide show
  1. checksums.yaml +7 -0
  2. data/.fern/metadata.json +10 -0
  3. data/.fern/replay.lock +10 -0
  4. data/.fernignore +4 -0
  5. data/.rubocop.yml +103 -0
  6. data/CONTRIBUTING.md +120 -0
  7. data/LICENSE +21 -0
  8. data/README.md +173 -0
  9. data/Rakefile +20 -0
  10. data/custom.gemspec.rb +16 -0
  11. data/lib/yasminaai/client.rb +37 -0
  12. data/lib/yasminaai/environment.rb +9 -0
  13. data/lib/yasminaai/errors/api_error.rb +8 -0
  14. data/lib/yasminaai/errors/client_error.rb +17 -0
  15. data/lib/yasminaai/errors/redirect_error.rb +8 -0
  16. data/lib/yasminaai/errors/response_error.rb +42 -0
  17. data/lib/yasminaai/errors/server_error.rb +11 -0
  18. data/lib/yasminaai/errors/timeout_error.rb +8 -0
  19. data/lib/yasminaai/internal/errors/constraint_error.rb +10 -0
  20. data/lib/yasminaai/internal/errors/type_error.rb +10 -0
  21. data/lib/yasminaai/internal/http/base_request.rb +51 -0
  22. data/lib/yasminaai/internal/http/raw_client.rb +215 -0
  23. data/lib/yasminaai/internal/iterators/cursor_item_iterator.rb +28 -0
  24. data/lib/yasminaai/internal/iterators/cursor_page_iterator.rb +63 -0
  25. data/lib/yasminaai/internal/iterators/item_iterator.rb +65 -0
  26. data/lib/yasminaai/internal/iterators/offset_item_iterator.rb +30 -0
  27. data/lib/yasminaai/internal/iterators/offset_page_iterator.rb +103 -0
  28. data/lib/yasminaai/internal/json/request.rb +41 -0
  29. data/lib/yasminaai/internal/json/serializable.rb +25 -0
  30. data/lib/yasminaai/internal/multipart/multipart_encoder.rb +141 -0
  31. data/lib/yasminaai/internal/multipart/multipart_form_data.rb +78 -0
  32. data/lib/yasminaai/internal/multipart/multipart_form_data_part.rb +51 -0
  33. data/lib/yasminaai/internal/multipart/multipart_request.rb +40 -0
  34. data/lib/yasminaai/internal/types/array.rb +47 -0
  35. data/lib/yasminaai/internal/types/boolean.rb +34 -0
  36. data/lib/yasminaai/internal/types/enum.rb +56 -0
  37. data/lib/yasminaai/internal/types/hash.rb +36 -0
  38. data/lib/yasminaai/internal/types/model/field.rb +38 -0
  39. data/lib/yasminaai/internal/types/model.rb +208 -0
  40. data/lib/yasminaai/internal/types/type.rb +35 -0
  41. data/lib/yasminaai/internal/types/union.rb +161 -0
  42. data/lib/yasminaai/internal/types/unknown.rb +15 -0
  43. data/lib/yasminaai/internal/types/utils.rb +116 -0
  44. data/lib/yasminaai/ot_ps/client.rb +79 -0
  45. data/lib/yasminaai/ot_ps/types/post_issue_otp_request.rb +21 -0
  46. data/lib/yasminaai/ot_ps/types/post_quote_otp_request.rb +15 -0
  47. data/lib/yasminaai/policies/client.rb +144 -0
  48. data/lib/yasminaai/policies/types/get_policies_car_policy_request.rb +11 -0
  49. data/lib/yasminaai/policies/types/get_policies_request.rb +35 -0
  50. data/lib/yasminaai/policies/types/post_policies_request.rb +21 -0
  51. data/lib/yasminaai/quotes/client.rb +164 -0
  52. data/lib/yasminaai/quotes/types/delete_quote_requests_id_request.rb +11 -0
  53. data/lib/yasminaai/quotes/types/delete_quote_requests_id_response.rb +11 -0
  54. data/lib/yasminaai/quotes/types/get_quote_requests_id_request.rb +11 -0
  55. data/lib/yasminaai/quotes/types/get_quote_requests_request.rb +17 -0
  56. data/lib/yasminaai/quotes/types/post_quote_requests_request.rb +37 -0
  57. data/lib/yasminaai/quotes/types/post_quote_requests_request_accept_language.rb +13 -0
  58. data/lib/yasminaai/quotes/types/post_quote_requests_request_drivers_item.rb +15 -0
  59. data/lib/yasminaai/types/bad_request_error_body.rb +11 -0
  60. data/lib/yasminaai/types/benefit.rb +21 -0
  61. data/lib/yasminaai/types/company_quote.rb +25 -0
  62. data/lib/yasminaai/types/company_quote_type.rb +12 -0
  63. data/lib/yasminaai/types/error.rb +11 -0
  64. data/lib/yasminaai/types/paginated_policy_response.rb +35 -0
  65. data/lib/yasminaai/types/paginated_quote_response.rb +35 -0
  66. data/lib/yasminaai/types/pagination_link.rb +13 -0
  67. data/lib/yasminaai/types/policy.rb +39 -0
  68. data/lib/yasminaai/types/policy_aggregates.rb +14 -0
  69. data/lib/yasminaai/types/policy_month_aggregate.rb +11 -0
  70. data/lib/yasminaai/types/quote_price.rb +19 -0
  71. data/lib/yasminaai/types/quote_request_aggregates.rb +12 -0
  72. data/lib/yasminaai/types/quote_response.rb +37 -0
  73. data/lib/yasminaai/types/quote_response_drivers_item.rb +13 -0
  74. data/lib/yasminaai/types/quote_response_quotes_item.rb +25 -0
  75. data/lib/yasminaai/types/quote_response_quotes_item_type.rb +12 -0
  76. data/lib/yasminaai/types/unauthorized_error_body.rb +11 -0
  77. data/lib/yasminaai/version.rb +5 -0
  78. data/lib/yasminaai.rb +72 -0
  79. data/reference.md +872 -0
  80. metadata +121 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4988b4e0cf01f50068506c6f277e6823b6b3a08857b1c9cc4235bf64ce7d62c7
4
+ data.tar.gz: b63a865c21241e7d118a092c7ff1ff6113ddceca691fd824d4ff59c96be7ffa9
5
+ SHA512:
6
+ metadata.gz: 90133f4aedf4d53b63ca526c4f83fba3529dbe53ccab8d58484ce368655e3aa4bc98666ae5c03c296b0957766a41033f514179baebae7a4fcd3fd10b123be404
7
+ data.tar.gz: 8f1248c3d02bab79a742404c1124a3f95a6fd8a4c633e9b7bb0d432d823f82ebabb5976d92cb913c39636cfb524cda6e4cc967802073ef3d31b43a21150e34f0
@@ -0,0 +1,10 @@
1
+ {
2
+ "cliVersion": "5.49.0",
3
+ "generatorName": "fernapi/fern-ruby-sdk",
4
+ "generatorVersion": "1.13.1",
5
+ "originGitCommit": "63dfa8c27053d50d0db46746e6a4a64af46f427d",
6
+ "originGitCommitIsDirty": true,
7
+ "invokedBy": "manual",
8
+ "requestedVersion": "0.0.8",
9
+ "sdkVersion": "0.0.8"
10
+ }
data/.fern/replay.lock ADDED
@@ -0,0 +1,10 @@
1
+ # DO NOT EDIT MANUALLY - Managed by Fern Replay
2
+ version: "1.0"
3
+ generations:
4
+ - commit_sha: 65e78c66bf945f74908cc7697592a206579f1736
5
+ tree_hash: d089fe249b9c51a44a599ebae76552d5bbd869a7
6
+ timestamp: 2026-06-17T08:01:53.612Z
7
+ cli_version: unknown
8
+ generator_versions: {}
9
+ current_generation: 65e78c66bf945f74908cc7697592a206579f1736
10
+ patches: []
data/.fernignore ADDED
@@ -0,0 +1,4 @@
1
+ # Specify files that shouldn't be modified by Fern
2
+ .fern/replay.lock
3
+ .fern/replay.yml
4
+ .gitattributes
data/.rubocop.yml ADDED
@@ -0,0 +1,103 @@
1
+ plugins:
2
+ - rubocop-minitest
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 3.3
6
+ NewCops: enable
7
+
8
+ Style/StringLiterals:
9
+ EnforcedStyle: double_quotes
10
+
11
+ Style/StringLiteralsInInterpolation:
12
+ EnforcedStyle: double_quotes
13
+
14
+ Style/AccessModifierDeclarations:
15
+ Enabled: false
16
+
17
+ Lint/ConstantDefinitionInBlock:
18
+ Enabled: false
19
+
20
+ Metrics/AbcSize:
21
+ Enabled: false
22
+
23
+ Metrics/BlockLength:
24
+ Enabled: false
25
+
26
+ Metrics/ClassLength:
27
+ Enabled: false
28
+
29
+ Metrics/MethodLength:
30
+ Enabled: false
31
+
32
+ Metrics/ParameterLists:
33
+ Enabled: false
34
+
35
+ Metrics/PerceivedComplexity:
36
+ Enabled: false
37
+
38
+ Metrics/CyclomaticComplexity:
39
+ Enabled: false
40
+
41
+ Metrics/ModuleLength:
42
+ Enabled: false
43
+
44
+ Layout/LineLength:
45
+ Enabled: false
46
+
47
+ Naming/VariableNumber:
48
+ EnforcedStyle: normalcase
49
+ Severity: warning
50
+
51
+ Style/Documentation:
52
+ Enabled: false
53
+
54
+ Style/Lambda:
55
+ EnforcedStyle: literal
56
+
57
+ Minitest/MultipleAssertions:
58
+ Enabled: false
59
+
60
+ Minitest/UselessAssertion:
61
+ Enabled: false
62
+
63
+ # Dynamic snippets are code samples for documentation, not standalone Ruby files.
64
+ Style/FrozenStringLiteralComment:
65
+ Exclude:
66
+ - "dynamic-snippets/**/*"
67
+
68
+ # Indent hash elements 2 spaces from the start of the enclosing line rather than
69
+ # aligning with the preceding paren or bracket. Generated code nests hashes inside
70
+ # arrays and method calls; the "consistent" style is more readable there.
71
+ Layout/FirstHashElementIndentation:
72
+ EnforcedStyle: consistent
73
+ Exclude:
74
+ - "dynamic-snippets/**/*"
75
+
76
+ # Match Layout/FirstHashElementIndentation: indent the first argument 2 spaces
77
+ # from the start of the method call's line, regardless of parenthesis position.
78
+ # Dynamic snippets are code samples, not standalone Ruby files; exclude them to
79
+ # keep this config symmetric with Layout/FirstHashElementIndentation above.
80
+ Layout/FirstArgumentIndentation:
81
+ EnforcedStyle: consistent
82
+ Exclude:
83
+ - "dynamic-snippets/**/*"
84
+
85
+ # The generator emits non-idiomatic class names (e.g. Get_With_Query, JSON_)
86
+ # derived from IR type names whose wire form contains underscores or digits.
87
+ # Rubocop never auto-corrected these (naming cops have no autocorrecter), so
88
+ # disabling the cop keeps CI green without changing customer output. Fixing at
89
+ # source would rename public types across every existing SDK and therefore
90
+ # requires a ruby-v2 major-version bump with a generator migration.
91
+ Naming/ClassAndModuleCamelCase:
92
+ Enabled: false
93
+
94
+ # Integer literals are emitted unformatted (e.g. 1000000, not 1_000_000).
95
+ # Rubocop has an autocorrecter for this cop, but the only caller of integer
96
+ # emission is the dynamic-snippets path, which feeds customer-facing surfaces:
97
+ # (1) snippet markdown in reference docs, (2) dynamic-snippets/*.rb sample
98
+ # files. Neither is rubocop-gated (markdown isn't Ruby, dynamic-snippets/**/*
99
+ # is excluded above), so formatting integers there would change docs/dashboard
100
+ # output without any rubocop benefit. Disabling the cop keeps integers raw
101
+ # everywhere and avoids customer-visible diffs.
102
+ Style/NumericLiterals:
103
+ Enabled: false
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,120 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project.
4
+
5
+ ## Getting Started
6
+
7
+ ### Prerequisites
8
+
9
+ - Ruby 3.0+
10
+ - Bundler
11
+
12
+ ### Installation
13
+
14
+ Install the project dependencies:
15
+
16
+ ```bash
17
+ bundle install
18
+ ```
19
+
20
+ ### Building
21
+
22
+ Build the gem:
23
+
24
+ ```bash
25
+ gem build *.gemspec
26
+ ```
27
+
28
+ ### Testing
29
+
30
+ Run the test suite:
31
+
32
+ ```bash
33
+ bundle exec rspec
34
+ ```
35
+
36
+ ### Linting and Formatting
37
+
38
+ Check code style:
39
+
40
+ ```bash
41
+ bundle exec rubocop
42
+ ```
43
+
44
+ Fix code style issues:
45
+
46
+ ```bash
47
+ bundle exec rubocop -a
48
+ ```
49
+
50
+ ## About Generated Code
51
+
52
+ **Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated.
53
+
54
+ ### Generated Files
55
+
56
+ The following directories contain generated code:
57
+ - `lib/` - API client classes and types
58
+ - Most Ruby files in the project
59
+
60
+ ### How to Customize
61
+
62
+ If you need to customize the SDK, you have two options:
63
+
64
+ #### Option 1: Use `.fernignore`
65
+
66
+ For custom code that should persist across SDK regenerations:
67
+
68
+ 1. Create a `.fernignore` file in the project root
69
+ 2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax)
70
+ 3. Add your custom code to those files
71
+
72
+ Files listed in `.fernignore` will not be overwritten when the SDK is regenerated.
73
+
74
+ For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code).
75
+
76
+ #### Option 2: Contribute to the Generator
77
+
78
+ If you want to change how code is generated for all users of this SDK:
79
+
80
+ 1. The Ruby SDK generator lives in the [Fern repository](https://github.com/fern-api/fern)
81
+ 2. Generator code is located at `generators/ruby-v2/`
82
+ 3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md)
83
+ 4. Submit a pull request with your changes to the generator
84
+
85
+ This approach is best for:
86
+ - Bug fixes in generated code
87
+ - New features that would benefit all users
88
+ - Improvements to code generation patterns
89
+
90
+ ## Making Changes
91
+
92
+ ### Workflow
93
+
94
+ 1. Create a new branch for your changes
95
+ 2. Make your modifications
96
+ 3. Run tests to ensure nothing breaks: `bundle exec rspec`
97
+ 4. Run linting: `bundle exec rubocop`
98
+ 5. Build the gem: `gem build *.gemspec`
99
+ 6. Commit your changes with a clear commit message
100
+ 7. Push your branch and create a pull request
101
+
102
+ ### Commit Messages
103
+
104
+ Write clear, descriptive commit messages that explain what changed and why.
105
+
106
+ ### Code Style
107
+
108
+ This project uses RuboCop for code formatting. Run `bundle exec rubocop` before committing to ensure your code meets the project's style guidelines.
109
+
110
+ ## Questions or Issues?
111
+
112
+ If you have questions or run into issues:
113
+
114
+ 1. Check the [Fern documentation](https://buildwithfern.com)
115
+ 2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues)
116
+ 3. Open a new issue if your question hasn't been addressed
117
+
118
+ ## License
119
+
120
+ By contributing to this project, you agree that your contributions will be licensed under the same license as the project.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yasminaai.
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # Yasminaai Ruby Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FYasminaAI%2Fmotor-ruby-sdk)
4
+
5
+ The Yasminaai Ruby library provides convenient access to the Yasminaai APIs from Ruby.
6
+
7
+ ## Table of Contents
8
+
9
+ - [Reference](#reference)
10
+ - [Usage](#usage)
11
+ - [Environments](#environments)
12
+ - [Errors](#errors)
13
+ - [Advanced](#advanced)
14
+ - [Retries](#retries)
15
+ - [Timeouts](#timeouts)
16
+ - [Additional Headers](#additional-headers)
17
+ - [Additional Query Parameters](#additional-query-parameters)
18
+ - [Contributing](#contributing)
19
+
20
+ ## Reference
21
+
22
+ A full reference for this library is available [here](https://github.com/YasminaAI/motor-ruby-sdk/blob/HEAD/./reference.md).
23
+
24
+ ## Usage
25
+
26
+ Instantiate and use the client with the following:
27
+
28
+ ```ruby
29
+ require "yasminaai"
30
+
31
+ client = Yasminaai::Client.new(token: "<token>")
32
+
33
+ client.quotes.request_quotes(
34
+ otp: "123456",
35
+ owner_id: "owner_id",
36
+ phone: "phone",
37
+ birthdate: "2023-01-15",
38
+ car_estimated_cost: 1.1
39
+ )
40
+ ```
41
+
42
+ ## Environments
43
+
44
+ This SDK allows you to configure different environments or custom URLs for API requests. You can either use the predefined environments or specify your own custom URL.
45
+ ### Environments
46
+ ```ruby
47
+ require "yasminaai"
48
+
49
+ yasminaai = Yasminaai::Client.new(
50
+ base_url: Yasminaai::Environment::SANDBOX
51
+ )
52
+ ```
53
+
54
+ ### Custom URL
55
+ ```ruby
56
+ require "yasminaai"
57
+
58
+ client = Yasminaai::Client.new(
59
+ base_url: "https://example.com"
60
+ )
61
+ ```
62
+
63
+ ## Errors
64
+
65
+ Failed API calls will raise errors that can be rescued from granularly.
66
+
67
+ ```ruby
68
+ require "yasminaai"
69
+
70
+ client = Yasminaai::Client.new(
71
+ base_url: "https://example.com"
72
+ )
73
+
74
+ begin
75
+ result = client.quotes.request_quotes
76
+ rescue Yasminaai::Errors::TimeoutError
77
+ puts "API didn't respond before our timeout elapsed"
78
+ rescue Yasminaai::Errors::ServiceUnavailableError
79
+ puts "API returned status 503, is probably overloaded, try again later"
80
+ rescue Yasminaai::Errors::ServerError
81
+ puts "API returned some other 5xx status, this is probably a bug"
82
+ rescue Yasminaai::Errors::ResponseError => e
83
+ puts "API returned an unexpected status other than 5xx: #{e.code} #{e.message}"
84
+ rescue Yasminaai::Errors::ApiError => e
85
+ puts "Some other error occurred when calling the API: #{e.message}"
86
+ end
87
+ ```
88
+
89
+ ## Advanced
90
+
91
+ ### Retries
92
+
93
+ The SDK is instrumented with automatic retries. A request will be retried as long as the request is deemed
94
+ retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
95
+
96
+ A request is deemed retryable when any of the following HTTP status codes is returned:
97
+
98
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
99
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
100
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error)
101
+
102
+ The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried:
103
+
104
+ - `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524`
105
+ - `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures)
106
+
107
+ Use the `max_retries` option to configure this behavior.
108
+
109
+ ```ruby
110
+ require "yasminaai"
111
+
112
+ client = Yasminaai::Client.new(
113
+ base_url: "https://example.com",
114
+ max_retries: 3 # Configure max retries (default is 2)
115
+ )
116
+ ```
117
+
118
+ ### Timeouts
119
+
120
+ The SDK defaults to a 60 second timeout. Use the `timeout` option to configure this behavior.
121
+
122
+ ```ruby
123
+ require "yasminaai"
124
+
125
+ response = client.quotes.request_quotes(
126
+ ...,
127
+ timeout: 30 # 30 second timeout
128
+ )
129
+ ```
130
+
131
+ ### Additional Headers
132
+
133
+ If you would like to send additional headers as part of the request, use the `additional_headers` request option.
134
+
135
+ ```ruby
136
+ require "yasminaai"
137
+
138
+ response = client.quotes.request_quotes(
139
+ ...,
140
+ request_options: {
141
+ additional_headers: {
142
+ "X-Custom-Header" => "custom-value"
143
+ }
144
+ }
145
+ )
146
+ ```
147
+
148
+ ### Additional Query Parameters
149
+
150
+ If you would like to send additional query parameters as part of the request, use the `additional_query_parameters` request option.
151
+
152
+ ```ruby
153
+ require "yasminaai"
154
+
155
+ response = client.quotes.request_quotes(
156
+ ...,
157
+ request_options: {
158
+ additional_query_parameters: {
159
+ "custom_param" => "custom-value"
160
+ }
161
+ }
162
+ )
163
+ ```
164
+
165
+ ## Contributing
166
+
167
+ While we value open-source contributions to this SDK, this library is generated programmatically.
168
+ Additions made directly to this library would have to be moved over to our generation code,
169
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
170
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
171
+ an issue first to discuss with us!
172
+
173
+ On the other hand, contributions to the README are always very welcome!
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[test]
13
+
14
+ task lint: %i[rubocop]
15
+
16
+ # Run only the custom test file
17
+ Minitest::TestTask.create(:customtest) do |t|
18
+ t.libs << "test"
19
+ t.test_globs = ["test/custom.test.rb"]
20
+ end
data/custom.gemspec.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Custom gemspec configuration file
4
+ # This file is automatically loaded by the main gemspec file. The 'spec' variable is available
5
+ # in this context from the main gemspec file. You can modify this file to add custom metadata,
6
+ # dependencies, or other gemspec configurations. If you do make changes to this file, you will
7
+ # need to add it to the .fernignore file to prevent your changes from being overwritten.
8
+
9
+ def add_custom_gemspec_data(spec)
10
+ # Example custom configurations (uncomment and modify as needed)
11
+
12
+ # spec.authors = ["Your name"]
13
+ # spec.email = ["your.email@example.com"]
14
+ # spec.homepage = "https://github.com/your-org/yasminaai-ruby"
15
+ # spec.license = "Your license"
16
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ class Client
5
+ # @param token [String]
6
+ # @param base_url [String, nil]
7
+ # @param max_retries [Integer]
8
+ #
9
+ # @return [void]
10
+ def initialize(token:, base_url: nil, max_retries: 2)
11
+ @raw_client = Yasminaai::Internal::Http::RawClient.new(
12
+ base_url: base_url || Yasminaai::Environment::SANDBOX,
13
+ headers: {
14
+ "User-Agent" => "yasmina-motor-ruby/0.0.8",
15
+ "X-Fern-Language" => "Ruby",
16
+ Authorization: "Bearer #{token}"
17
+ },
18
+ max_retries: max_retries
19
+ )
20
+ end
21
+
22
+ # @return [Yasminaai::Quotes::Client]
23
+ def quotes
24
+ @quotes ||= Yasminaai::Quotes::Client.new(client: @raw_client)
25
+ end
26
+
27
+ # @return [Yasminaai::Policies::Client]
28
+ def policies
29
+ @policies ||= Yasminaai::Policies::Client.new(client: @raw_client)
30
+ end
31
+
32
+ # @return [Yasminaai::OtPs::Client]
33
+ def ot_ps
34
+ @ot_ps ||= Yasminaai::OtPs::Client.new(client: @raw_client)
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ class Environment
5
+ SANDBOX = "https://sandbox.yasmina.ai/api/v1/car-comp"
6
+
7
+ PRODUCTION = "https://production.yasmina.ai/api/v1/car-comp"
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ module Errors
5
+ class ApiError < StandardError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ module Errors
5
+ class ClientError < ResponseError
6
+ end
7
+
8
+ class UnauthorizedError < ClientError
9
+ end
10
+
11
+ class ForbiddenError < ClientError
12
+ end
13
+
14
+ class NotFoundError < ClientError
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ module Errors
5
+ class RedirectError < ResponseError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ module Errors
5
+ class ResponseError < ApiError
6
+ attr_reader :code
7
+
8
+ def initialize(msg, code:)
9
+ @code = code
10
+ super(msg)
11
+ end
12
+
13
+ def inspect
14
+ "#<#{self.class.name} @code=#{code} @body=#{message}>"
15
+ end
16
+
17
+ # Returns the most appropriate error class for the given code.
18
+ #
19
+ # @return [Class]
20
+ def self.subclass_for_code(code)
21
+ case code
22
+ when 300..399
23
+ RedirectError
24
+ when 401
25
+ UnauthorizedError
26
+ when 403
27
+ ForbiddenError
28
+ when 404
29
+ NotFoundError
30
+ when 400..499
31
+ ClientError
32
+ when 503
33
+ ServiceUnavailableError
34
+ when 500..599
35
+ ServerError
36
+ else
37
+ ResponseError
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ module Errors
5
+ class ServerError < ResponseError
6
+ end
7
+
8
+ class ServiceUnavailableError < ApiError
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ module Errors
5
+ class TimeoutError < ApiError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ module Internal
5
+ module Errors
6
+ class ConstraintError < StandardError
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yasminaai
4
+ module Internal
5
+ module Errors
6
+ class TypeError < StandardError
7
+ end
8
+ end
9
+ end
10
+ end