yasmina-motor-ruby 0.0.71
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.
- checksums.yaml +7 -0
- data/.fern/metadata.json +10 -0
- data/.fern/replay.lock +10 -0
- data/.fernignore +4 -0
- data/.rubocop.yml +103 -0
- data/CONTRIBUTING.md +120 -0
- data/LICENSE +21 -0
- data/README.md +173 -0
- data/Rakefile +20 -0
- data/custom.gemspec.rb +16 -0
- data/lib/yasminaai/client.rb +37 -0
- data/lib/yasminaai/environment.rb +9 -0
- data/lib/yasminaai/errors/api_error.rb +8 -0
- data/lib/yasminaai/errors/client_error.rb +17 -0
- data/lib/yasminaai/errors/redirect_error.rb +8 -0
- data/lib/yasminaai/errors/response_error.rb +42 -0
- data/lib/yasminaai/errors/server_error.rb +11 -0
- data/lib/yasminaai/errors/timeout_error.rb +8 -0
- data/lib/yasminaai/internal/errors/constraint_error.rb +10 -0
- data/lib/yasminaai/internal/errors/type_error.rb +10 -0
- data/lib/yasminaai/internal/http/base_request.rb +51 -0
- data/lib/yasminaai/internal/http/raw_client.rb +215 -0
- data/lib/yasminaai/internal/iterators/cursor_item_iterator.rb +28 -0
- data/lib/yasminaai/internal/iterators/cursor_page_iterator.rb +63 -0
- data/lib/yasminaai/internal/iterators/item_iterator.rb +65 -0
- data/lib/yasminaai/internal/iterators/offset_item_iterator.rb +30 -0
- data/lib/yasminaai/internal/iterators/offset_page_iterator.rb +103 -0
- data/lib/yasminaai/internal/json/request.rb +41 -0
- data/lib/yasminaai/internal/json/serializable.rb +25 -0
- data/lib/yasminaai/internal/multipart/multipart_encoder.rb +141 -0
- data/lib/yasminaai/internal/multipart/multipart_form_data.rb +78 -0
- data/lib/yasminaai/internal/multipart/multipart_form_data_part.rb +51 -0
- data/lib/yasminaai/internal/multipart/multipart_request.rb +40 -0
- data/lib/yasminaai/internal/types/array.rb +47 -0
- data/lib/yasminaai/internal/types/boolean.rb +34 -0
- data/lib/yasminaai/internal/types/enum.rb +56 -0
- data/lib/yasminaai/internal/types/hash.rb +36 -0
- data/lib/yasminaai/internal/types/model/field.rb +38 -0
- data/lib/yasminaai/internal/types/model.rb +208 -0
- data/lib/yasminaai/internal/types/type.rb +35 -0
- data/lib/yasminaai/internal/types/union.rb +161 -0
- data/lib/yasminaai/internal/types/unknown.rb +15 -0
- data/lib/yasminaai/internal/types/utils.rb +116 -0
- data/lib/yasminaai/ot_ps/client.rb +79 -0
- data/lib/yasminaai/ot_ps/types/post_issue_otp_request.rb +21 -0
- data/lib/yasminaai/ot_ps/types/post_quote_otp_request.rb +15 -0
- data/lib/yasminaai/policies/client.rb +144 -0
- data/lib/yasminaai/policies/types/get_policies_car_policy_request.rb +11 -0
- data/lib/yasminaai/policies/types/get_policies_request.rb +35 -0
- data/lib/yasminaai/policies/types/post_policies_request.rb +21 -0
- data/lib/yasminaai/quotes/client.rb +164 -0
- data/lib/yasminaai/quotes/types/delete_quote_requests_id_request.rb +11 -0
- data/lib/yasminaai/quotes/types/delete_quote_requests_id_response.rb +11 -0
- data/lib/yasminaai/quotes/types/get_quote_requests_id_request.rb +11 -0
- data/lib/yasminaai/quotes/types/get_quote_requests_request.rb +17 -0
- data/lib/yasminaai/quotes/types/post_quote_requests_request.rb +37 -0
- data/lib/yasminaai/quotes/types/post_quote_requests_request_accept_language.rb +13 -0
- data/lib/yasminaai/quotes/types/post_quote_requests_request_drivers_item.rb +15 -0
- data/lib/yasminaai/types/bad_request_error_body.rb +11 -0
- data/lib/yasminaai/types/benefit.rb +21 -0
- data/lib/yasminaai/types/company_quote.rb +25 -0
- data/lib/yasminaai/types/company_quote_type.rb +12 -0
- data/lib/yasminaai/types/error.rb +11 -0
- data/lib/yasminaai/types/paginated_policy_response.rb +35 -0
- data/lib/yasminaai/types/paginated_quote_response.rb +35 -0
- data/lib/yasminaai/types/pagination_link.rb +13 -0
- data/lib/yasminaai/types/policy.rb +39 -0
- data/lib/yasminaai/types/policy_aggregates.rb +14 -0
- data/lib/yasminaai/types/policy_month_aggregate.rb +11 -0
- data/lib/yasminaai/types/quote_price.rb +19 -0
- data/lib/yasminaai/types/quote_request_aggregates.rb +12 -0
- data/lib/yasminaai/types/quote_response.rb +37 -0
- data/lib/yasminaai/types/quote_response_drivers_item.rb +13 -0
- data/lib/yasminaai/types/quote_response_quotes_item.rb +25 -0
- data/lib/yasminaai/types/quote_response_quotes_item_type.rb +12 -0
- data/lib/yasminaai/types/unauthorized_error_body.rb +11 -0
- data/lib/yasminaai/version.rb +5 -0
- data/lib/yasminaai.rb +72 -0
- data/reference.md +872 -0
- metadata +121 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Policies
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Yasminaai::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Show a specific policy
|
|
14
|
+
#
|
|
15
|
+
# @param request_options [Hash]
|
|
16
|
+
# @param params [Hash]
|
|
17
|
+
# @option request_options [String] :base_url
|
|
18
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
19
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
21
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
22
|
+
# @option params [Integer] :car_policy
|
|
23
|
+
#
|
|
24
|
+
# @return [Yasminaai::Types::Policy]
|
|
25
|
+
def show_policy(request_options: {}, **params)
|
|
26
|
+
params = Yasminaai::Internal::Types::Utils.normalize_keys(params)
|
|
27
|
+
request = Yasminaai::Internal::JSON::Request.new(
|
|
28
|
+
base_url: request_options[:base_url],
|
|
29
|
+
method: "GET",
|
|
30
|
+
path: "policies/#{URI.encode_uri_component(params[:car_policy].to_s)}",
|
|
31
|
+
request_options: request_options
|
|
32
|
+
)
|
|
33
|
+
begin
|
|
34
|
+
response = @client.send(request)
|
|
35
|
+
rescue Net::HTTPRequestTimeout
|
|
36
|
+
raise Yasminaai::Errors::TimeoutError
|
|
37
|
+
end
|
|
38
|
+
code = response.code.to_i
|
|
39
|
+
if code.between?(200, 299)
|
|
40
|
+
Yasminaai::Types::Policy.load(response.body)
|
|
41
|
+
else
|
|
42
|
+
error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code)
|
|
43
|
+
raise error_class.new(response.body, code: code)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Listing requested policies
|
|
48
|
+
#
|
|
49
|
+
# @param request_options [Hash]
|
|
50
|
+
# @param params [Hash]
|
|
51
|
+
# @option request_options [String] :base_url
|
|
52
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
53
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
54
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
55
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
56
|
+
# @option params [Integer, nil] :quote_request_id
|
|
57
|
+
# @option params [String, nil] :quote_price_id
|
|
58
|
+
# @option params [Integer, nil] :provider_policy_id
|
|
59
|
+
# @option params [String, nil] :car_sequence_number
|
|
60
|
+
# @option params [String, nil] :new_owner_id
|
|
61
|
+
# @option params [String, nil] :previous_owner_id
|
|
62
|
+
# @option params [Integer, nil] :status
|
|
63
|
+
# @option params [Integer, nil] :min_price
|
|
64
|
+
# @option params [Integer, nil] :max_price
|
|
65
|
+
# @option params [Integer, nil] :per_page
|
|
66
|
+
# @option params [String, nil] :date_from
|
|
67
|
+
# @option params [String, nil] :date_to
|
|
68
|
+
# @option params [Boolean, nil] :include_aggregates
|
|
69
|
+
#
|
|
70
|
+
# @return [Yasminaai::Types::PaginatedPolicyResponse]
|
|
71
|
+
def list_policies(request_options: {}, **params)
|
|
72
|
+
params = Yasminaai::Internal::Types::Utils.normalize_keys(params)
|
|
73
|
+
query_params = {}
|
|
74
|
+
query_params["quote_request_id"] = params[:quote_request_id] if params.key?(:quote_request_id)
|
|
75
|
+
query_params["quote_price_id"] = params[:quote_price_id] if params.key?(:quote_price_id)
|
|
76
|
+
query_params["provider_policy_id"] = params[:provider_policy_id] if params.key?(:provider_policy_id)
|
|
77
|
+
query_params["car_sequence_number"] = params[:car_sequence_number] if params.key?(:car_sequence_number)
|
|
78
|
+
query_params["new_owner_id"] = params[:new_owner_id] if params.key?(:new_owner_id)
|
|
79
|
+
query_params["previous_owner_id"] = params[:previous_owner_id] if params.key?(:previous_owner_id)
|
|
80
|
+
query_params["status"] = params[:status] if params.key?(:status)
|
|
81
|
+
query_params["min_price"] = params[:min_price] if params.key?(:min_price)
|
|
82
|
+
query_params["max_price"] = params[:max_price] if params.key?(:max_price)
|
|
83
|
+
query_params["per_page"] = params[:per_page] if params.key?(:per_page)
|
|
84
|
+
query_params["date_from"] = params[:date_from] if params.key?(:date_from)
|
|
85
|
+
query_params["date_to"] = params[:date_to] if params.key?(:date_to)
|
|
86
|
+
query_params["include_aggregates"] = params[:include_aggregates] if params.key?(:include_aggregates)
|
|
87
|
+
|
|
88
|
+
request = Yasminaai::Internal::JSON::Request.new(
|
|
89
|
+
base_url: request_options[:base_url],
|
|
90
|
+
method: "GET",
|
|
91
|
+
path: "policies",
|
|
92
|
+
query: query_params,
|
|
93
|
+
request_options: request_options
|
|
94
|
+
)
|
|
95
|
+
begin
|
|
96
|
+
response = @client.send(request)
|
|
97
|
+
rescue Net::HTTPRequestTimeout
|
|
98
|
+
raise Yasminaai::Errors::TimeoutError
|
|
99
|
+
end
|
|
100
|
+
code = response.code.to_i
|
|
101
|
+
if code.between?(200, 299)
|
|
102
|
+
Yasminaai::Types::PaginatedPolicyResponse.load(response.body)
|
|
103
|
+
else
|
|
104
|
+
error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code)
|
|
105
|
+
raise error_class.new(response.body, code: code)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# For issuing a new policy
|
|
110
|
+
#
|
|
111
|
+
# @param request_options [Hash]
|
|
112
|
+
# @param params [Yasminaai::Policies::Types::PostPoliciesRequest]
|
|
113
|
+
# @option request_options [String] :base_url
|
|
114
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
115
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
116
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
117
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
118
|
+
#
|
|
119
|
+
# @return [Yasminaai::Types::Policy]
|
|
120
|
+
def issue_policy(request_options: {}, **params)
|
|
121
|
+
params = Yasminaai::Internal::Types::Utils.normalize_keys(params)
|
|
122
|
+
request = Yasminaai::Internal::JSON::Request.new(
|
|
123
|
+
base_url: request_options[:base_url],
|
|
124
|
+
method: "POST",
|
|
125
|
+
path: "policies",
|
|
126
|
+
body: Yasminaai::Policies::Types::PostPoliciesRequest.new(params).to_h,
|
|
127
|
+
request_options: request_options
|
|
128
|
+
)
|
|
129
|
+
begin
|
|
130
|
+
response = @client.send(request)
|
|
131
|
+
rescue Net::HTTPRequestTimeout
|
|
132
|
+
raise Yasminaai::Errors::TimeoutError
|
|
133
|
+
end
|
|
134
|
+
code = response.code.to_i
|
|
135
|
+
if code.between?(200, 299)
|
|
136
|
+
Yasminaai::Types::Policy.load(response.body)
|
|
137
|
+
else
|
|
138
|
+
error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code)
|
|
139
|
+
raise error_class.new(response.body, code: code)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Policies
|
|
5
|
+
module Types
|
|
6
|
+
class GetPoliciesCarPolicyRequest < Internal::Types::Model
|
|
7
|
+
field :car_policy, -> { Integer }, optional: false, nullable: false, api_name: "carPolicy"
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Policies
|
|
5
|
+
module Types
|
|
6
|
+
class GetPoliciesRequest < Internal::Types::Model
|
|
7
|
+
field :quote_request_id, -> { Integer }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :quote_price_id, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :provider_policy_id, -> { Integer }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :car_sequence_number, -> { String }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :new_owner_id, -> { String }, optional: true, nullable: false
|
|
16
|
+
|
|
17
|
+
field :previous_owner_id, -> { String }, optional: true, nullable: false
|
|
18
|
+
|
|
19
|
+
field :status, -> { Integer }, optional: true, nullable: false
|
|
20
|
+
|
|
21
|
+
field :min_price, -> { Integer }, optional: true, nullable: false
|
|
22
|
+
|
|
23
|
+
field :max_price, -> { Integer }, optional: true, nullable: false
|
|
24
|
+
|
|
25
|
+
field :per_page, -> { Integer }, optional: true, nullable: false
|
|
26
|
+
|
|
27
|
+
field :date_from, -> { String }, optional: true, nullable: false
|
|
28
|
+
|
|
29
|
+
field :date_to, -> { String }, optional: true, nullable: false
|
|
30
|
+
|
|
31
|
+
field :include_aggregates, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Policies
|
|
5
|
+
module Types
|
|
6
|
+
class PostPoliciesRequest < Internal::Types::Model
|
|
7
|
+
field :otp, -> { String }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :quote_request_id, -> { Integer }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :quote_reference_id, -> { String }, optional: false, nullable: false
|
|
12
|
+
|
|
13
|
+
field :quote_price_id, -> { String }, optional: false, nullable: false
|
|
14
|
+
|
|
15
|
+
field :benefits, -> { Internal::Types::Array[String] }, optional: true, nullable: false
|
|
16
|
+
|
|
17
|
+
field :extra_fields, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Quotes
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Yasminaai::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# @param request_options [Hash]
|
|
14
|
+
# @param params [Hash]
|
|
15
|
+
# @option request_options [String] :base_url
|
|
16
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
17
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
18
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
19
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
20
|
+
# @option params [Integer] :id
|
|
21
|
+
#
|
|
22
|
+
# @return [Yasminaai::Types::QuoteResponse]
|
|
23
|
+
def show_quote(request_options: {}, **params)
|
|
24
|
+
params = Yasminaai::Internal::Types::Utils.normalize_keys(params)
|
|
25
|
+
request = Yasminaai::Internal::JSON::Request.new(
|
|
26
|
+
base_url: request_options[:base_url],
|
|
27
|
+
method: "GET",
|
|
28
|
+
path: "quote-requests/#{URI.encode_uri_component(params[:id].to_s)}",
|
|
29
|
+
request_options: request_options
|
|
30
|
+
)
|
|
31
|
+
begin
|
|
32
|
+
response = @client.send(request)
|
|
33
|
+
rescue Net::HTTPRequestTimeout
|
|
34
|
+
raise Yasminaai::Errors::TimeoutError
|
|
35
|
+
end
|
|
36
|
+
code = response.code.to_i
|
|
37
|
+
if code.between?(200, 299)
|
|
38
|
+
Yasminaai::Types::QuoteResponse.load(response.body)
|
|
39
|
+
else
|
|
40
|
+
error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code)
|
|
41
|
+
raise error_class.new(response.body, code: code)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @param request_options [Hash]
|
|
46
|
+
# @param params [Hash]
|
|
47
|
+
# @option request_options [String] :base_url
|
|
48
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
49
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
50
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
51
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
52
|
+
# @option params [Integer] :id
|
|
53
|
+
#
|
|
54
|
+
# @return [Yasminaai::Quotes::Types::DeleteQuoteRequestsIDResponse]
|
|
55
|
+
def delete_quote(request_options: {}, **params)
|
|
56
|
+
params = Yasminaai::Internal::Types::Utils.normalize_keys(params)
|
|
57
|
+
request = Yasminaai::Internal::JSON::Request.new(
|
|
58
|
+
base_url: request_options[:base_url],
|
|
59
|
+
method: "DELETE",
|
|
60
|
+
path: "quote-requests/#{URI.encode_uri_component(params[:id].to_s)}",
|
|
61
|
+
request_options: request_options
|
|
62
|
+
)
|
|
63
|
+
begin
|
|
64
|
+
response = @client.send(request)
|
|
65
|
+
rescue Net::HTTPRequestTimeout
|
|
66
|
+
raise Yasminaai::Errors::TimeoutError
|
|
67
|
+
end
|
|
68
|
+
code = response.code.to_i
|
|
69
|
+
if code.between?(200, 299)
|
|
70
|
+
Yasminaai::Quotes::Types::DeleteQuoteRequestsIDResponse.load(response.body)
|
|
71
|
+
else
|
|
72
|
+
error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code)
|
|
73
|
+
raise error_class.new(response.body, code: code)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# @param request_options [Hash]
|
|
78
|
+
# @param params [Hash]
|
|
79
|
+
# @option request_options [String] :base_url
|
|
80
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
81
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
82
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
83
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
84
|
+
# @option params [String, nil] :date_from
|
|
85
|
+
# @option params [String, nil] :date_to
|
|
86
|
+
# @option params [Integer, nil] :per_page
|
|
87
|
+
# @option params [Boolean, nil] :include_aggregates
|
|
88
|
+
#
|
|
89
|
+
# @return [Yasminaai::Types::PaginatedQuoteResponse]
|
|
90
|
+
def list_quotes(request_options: {}, **params)
|
|
91
|
+
params = Yasminaai::Internal::Types::Utils.normalize_keys(params)
|
|
92
|
+
query_params = {}
|
|
93
|
+
query_params["date_from"] = params[:date_from] if params.key?(:date_from)
|
|
94
|
+
query_params["date_to"] = params[:date_to] if params.key?(:date_to)
|
|
95
|
+
query_params["per_page"] = params[:per_page] if params.key?(:per_page)
|
|
96
|
+
query_params["include_aggregates"] = params[:include_aggregates] if params.key?(:include_aggregates)
|
|
97
|
+
|
|
98
|
+
request = Yasminaai::Internal::JSON::Request.new(
|
|
99
|
+
base_url: request_options[:base_url],
|
|
100
|
+
method: "GET",
|
|
101
|
+
path: "quote-requests",
|
|
102
|
+
query: query_params,
|
|
103
|
+
request_options: request_options
|
|
104
|
+
)
|
|
105
|
+
begin
|
|
106
|
+
response = @client.send(request)
|
|
107
|
+
rescue Net::HTTPRequestTimeout
|
|
108
|
+
raise Yasminaai::Errors::TimeoutError
|
|
109
|
+
end
|
|
110
|
+
code = response.code.to_i
|
|
111
|
+
if code.between?(200, 299)
|
|
112
|
+
Yasminaai::Types::PaginatedQuoteResponse.load(response.body)
|
|
113
|
+
else
|
|
114
|
+
error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code)
|
|
115
|
+
raise error_class.new(response.body, code: code)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# For getting prices with benefits.
|
|
120
|
+
# The Quote IDs can be used later to issue a policy
|
|
121
|
+
#
|
|
122
|
+
# @param request_options [Hash]
|
|
123
|
+
# @param params [Yasminaai::Quotes::Types::PostQuoteRequestsRequest]
|
|
124
|
+
# @option request_options [String] :base_url
|
|
125
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
126
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
127
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
128
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
129
|
+
# @option params [Yasminaai::Quotes::Types::PostQuoteRequestsRequestAcceptLanguage, nil] :accept_language
|
|
130
|
+
#
|
|
131
|
+
# @return [Yasminaai::Types::QuoteResponse]
|
|
132
|
+
def request_quotes(request_options: {}, **params)
|
|
133
|
+
params = Yasminaai::Internal::Types::Utils.normalize_keys(params)
|
|
134
|
+
request_data = Yasminaai::Quotes::Types::PostQuoteRequestsRequest.new(params).to_h
|
|
135
|
+
non_body_param_names = %w[Accept-Language]
|
|
136
|
+
body = request_data.except(*non_body_param_names)
|
|
137
|
+
|
|
138
|
+
headers = {}
|
|
139
|
+
headers["Accept-Language"] = params[:accept_language] if params[:accept_language]
|
|
140
|
+
|
|
141
|
+
request = Yasminaai::Internal::JSON::Request.new(
|
|
142
|
+
base_url: request_options[:base_url],
|
|
143
|
+
method: "POST",
|
|
144
|
+
path: "quote-requests",
|
|
145
|
+
headers: headers,
|
|
146
|
+
body: body,
|
|
147
|
+
request_options: request_options
|
|
148
|
+
)
|
|
149
|
+
begin
|
|
150
|
+
response = @client.send(request)
|
|
151
|
+
rescue Net::HTTPRequestTimeout
|
|
152
|
+
raise Yasminaai::Errors::TimeoutError
|
|
153
|
+
end
|
|
154
|
+
code = response.code.to_i
|
|
155
|
+
if code.between?(200, 299)
|
|
156
|
+
Yasminaai::Types::QuoteResponse.load(response.body)
|
|
157
|
+
else
|
|
158
|
+
error_class = Yasminaai::Errors::ResponseError.subclass_for_code(code)
|
|
159
|
+
raise error_class.new(response.body, code: code)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Quotes
|
|
5
|
+
module Types
|
|
6
|
+
class GetQuoteRequestsRequest < Internal::Types::Model
|
|
7
|
+
field :date_from, -> { String }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :date_to, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :per_page, -> { Integer }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :include_aggregates, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Quotes
|
|
5
|
+
module Types
|
|
6
|
+
class PostQuoteRequestsRequest < Internal::Types::Model
|
|
7
|
+
field :accept_language, -> { Yasminaai::Quotes::Types::PostQuoteRequestsRequestAcceptLanguage }, optional: true, nullable: false, api_name: "Accept-Language"
|
|
8
|
+
|
|
9
|
+
field :otp, -> { String }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :owner_id, -> { String }, optional: false, nullable: false
|
|
12
|
+
|
|
13
|
+
field :email, -> { String }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :phone, -> { String }, optional: false, nullable: false
|
|
16
|
+
|
|
17
|
+
field :birthdate, -> { String }, optional: false, nullable: false
|
|
18
|
+
|
|
19
|
+
field :car_sequence_number, -> { String }, optional: true, nullable: false
|
|
20
|
+
|
|
21
|
+
field :custom_number, -> { String }, optional: true, nullable: false
|
|
22
|
+
|
|
23
|
+
field :is_ownership_transfer, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
24
|
+
|
|
25
|
+
field :current_car_owner_id, -> { String }, optional: true, nullable: false
|
|
26
|
+
|
|
27
|
+
field :car_estimated_cost, -> { Integer }, optional: false, nullable: false
|
|
28
|
+
|
|
29
|
+
field :car_model_year, -> { Integer }, optional: true, nullable: false
|
|
30
|
+
|
|
31
|
+
field :start_date, -> { String }, optional: true, nullable: false
|
|
32
|
+
|
|
33
|
+
field :drivers, -> { Internal::Types::Array[Yasminaai::Quotes::Types::PostQuoteRequestsRequestDriversItem] }, optional: true, nullable: false
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Quotes
|
|
5
|
+
module Types
|
|
6
|
+
class PostQuoteRequestsRequestDriversItem < Internal::Types::Model
|
|
7
|
+
field :owner_id, -> { String }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :birthdate, -> { String }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :driving_percentage, -> { Integer }, optional: false, nullable: false
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Types
|
|
5
|
+
class BadRequestErrorBody < Internal::Types::Model
|
|
6
|
+
field :code, -> { String }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :message, -> { String }, optional: true, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Types
|
|
5
|
+
class Benefit < Internal::Types::Model
|
|
6
|
+
field :quote_benefit_id, -> { String }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :id, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :name, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :name_ar, -> { String }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :amount, -> { Integer }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :vat, -> { Integer }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :url, -> { String }, optional: true, nullable: false
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Types
|
|
5
|
+
class CompanyQuote < Internal::Types::Model
|
|
6
|
+
field :company_name, -> { String }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :company_name_ar, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :type, -> { Yasminaai::Types::CompanyQuoteType }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :insurance_type_display, -> { String }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :insurance_type_display_ar, -> { String }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :company_logo_url, -> { String }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :square_company_logo_url, -> { String }, optional: true, nullable: false
|
|
19
|
+
|
|
20
|
+
field :prices, -> { Internal::Types::Array[Yasminaai::Types::QuotePrice] }, optional: true, nullable: false
|
|
21
|
+
|
|
22
|
+
field :benefits, -> { Internal::Types::Array[Yasminaai::Types::Benefit] }, optional: true, nullable: false
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Types
|
|
5
|
+
class PaginatedPolicyResponse < Internal::Types::Model
|
|
6
|
+
field :current_page, -> { Integer }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :data, -> { Internal::Types::Array[Yasminaai::Types::Policy] }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :first_page_url, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :from, -> { Integer }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :last_page, -> { Integer }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :last_page_url, -> { String }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :links, -> { Internal::Types::Array[Yasminaai::Types::PaginationLink] }, optional: true, nullable: false
|
|
19
|
+
|
|
20
|
+
field :next_page_url, -> { String }, optional: true, nullable: false
|
|
21
|
+
|
|
22
|
+
field :path, -> { String }, optional: true, nullable: false
|
|
23
|
+
|
|
24
|
+
field :per_page, -> { Integer }, optional: true, nullable: false
|
|
25
|
+
|
|
26
|
+
field :prev_page_url, -> { String }, optional: true, nullable: false
|
|
27
|
+
|
|
28
|
+
field :to, -> { Integer }, optional: true, nullable: false
|
|
29
|
+
|
|
30
|
+
field :total, -> { Integer }, optional: true, nullable: false
|
|
31
|
+
|
|
32
|
+
field :aggregates, -> { Yasminaai::Types::PolicyAggregates }, optional: true, nullable: false
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Types
|
|
5
|
+
class PaginatedQuoteResponse < Internal::Types::Model
|
|
6
|
+
field :current_page, -> { Integer }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :data, -> { Internal::Types::Array[Yasminaai::Types::QuoteResponse] }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :first_page_url, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :from, -> { Integer }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :last_page, -> { Integer }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :last_page_url, -> { String }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :links, -> { Internal::Types::Array[Yasminaai::Types::PaginationLink] }, optional: true, nullable: false
|
|
19
|
+
|
|
20
|
+
field :next_page_url, -> { String }, optional: true, nullable: false
|
|
21
|
+
|
|
22
|
+
field :path, -> { String }, optional: true, nullable: false
|
|
23
|
+
|
|
24
|
+
field :per_page, -> { Integer }, optional: true, nullable: false
|
|
25
|
+
|
|
26
|
+
field :prev_page_url, -> { String }, optional: true, nullable: false
|
|
27
|
+
|
|
28
|
+
field :to, -> { Integer }, optional: true, nullable: false
|
|
29
|
+
|
|
30
|
+
field :total, -> { Integer }, optional: true, nullable: false
|
|
31
|
+
|
|
32
|
+
field :aggregates, -> { Yasminaai::Types::QuoteRequestAggregates }, optional: true, nullable: false
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yasminaai
|
|
4
|
+
module Types
|
|
5
|
+
class PaginationLink < Internal::Types::Model
|
|
6
|
+
field :url, -> { String }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :label, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :active, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|