crisphive 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 (108) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +219 -0
  4. data/Rakefile +10 -0
  5. data/crisphive.gemspec +40 -0
  6. data/git_push.sh +57 -0
  7. data/lib/crisphive/api/business_skill_api.rb +211 -0
  8. data/lib/crisphive/api/customer_api.rb +371 -0
  9. data/lib/crisphive/api/job_request_business_api.rb +449 -0
  10. data/lib/crisphive/api/job_types_api.rb +141 -0
  11. data/lib/crisphive/api/service_area_api.rb +148 -0
  12. data/lib/crisphive/api/technician_api.rb +163 -0
  13. data/lib/crisphive/api/vehicle_api.rb +157 -0
  14. data/lib/crisphive/api_client.rb +437 -0
  15. data/lib/crisphive/api_error.rb +58 -0
  16. data/lib/crisphive/configuration.rb +393 -0
  17. data/lib/crisphive/models/create_customer200_response.rb +250 -0
  18. data/lib/crisphive/models/create_job_request200_response.rb +250 -0
  19. data/lib/crisphive/models/customer.rb +235 -0
  20. data/lib/crisphive/models/customer_address.rb +295 -0
  21. data/lib/crisphive/models/customer_address_request.rb +475 -0
  22. data/lib/crisphive/models/customer_contact.rb +255 -0
  23. data/lib/crisphive/models/customer_create_request.rb +383 -0
  24. data/lib/crisphive/models/customer_create_response.rb +215 -0
  25. data/lib/crisphive/models/customer_list.rb +247 -0
  26. data/lib/crisphive/models/customer_list_item.rb +341 -0
  27. data/lib/crisphive/models/customer_profile.rb +321 -0
  28. data/lib/crisphive/models/customer_spending.rb +299 -0
  29. data/lib/crisphive/models/customer_tier_progress.rb +235 -0
  30. data/lib/crisphive/models/customer_update_request.rb +434 -0
  31. data/lib/crisphive/models/get_customer200_response.rb +250 -0
  32. data/lib/crisphive/models/get_job_request200_response.rb +250 -0
  33. data/lib/crisphive/models/get_job_request_timeline200_response.rb +250 -0
  34. data/lib/crisphive/models/get_job_type200_response.rb +250 -0
  35. data/lib/crisphive/models/get_service_area200_response.rb +250 -0
  36. data/lib/crisphive/models/get_technician200_response.rb +250 -0
  37. data/lib/crisphive/models/get_vehicle200_response.rb +250 -0
  38. data/lib/crisphive/models/job_date.rb +225 -0
  39. data/lib/crisphive/models/job_date_business_range.rb +263 -0
  40. data/lib/crisphive/models/job_date_period.rb +41 -0
  41. data/lib/crisphive/models/job_date_period_entry.rb +247 -0
  42. data/lib/crisphive/models/job_request.rb +537 -0
  43. data/lib/crisphive/models/job_request_action_audit_by.rb +259 -0
  44. data/lib/crisphive/models/job_request_action_audit_entry.rb +235 -0
  45. data/lib/crisphive/models/job_request_action_summary.rb +281 -0
  46. data/lib/crisphive/models/job_request_address_summary.rb +295 -0
  47. data/lib/crisphive/models/job_request_archive_summary.rb +245 -0
  48. data/lib/crisphive/models/job_request_arrival_window.rb +235 -0
  49. data/lib/crisphive/models/job_request_assigned_vehicle.rb +225 -0
  50. data/lib/crisphive/models/job_request_assignment_summary.rb +255 -0
  51. data/lib/crisphive/models/job_request_booking_windows.rb +247 -0
  52. data/lib/crisphive/models/job_request_business_time_range.rb +279 -0
  53. data/lib/crisphive/models/job_request_changes.rb +237 -0
  54. data/lib/crisphive/models/job_request_create_request.rb +339 -0
  55. data/lib/crisphive/models/job_request_create_response.rb +245 -0
  56. data/lib/crisphive/models/job_request_crew_member.rb +352 -0
  57. data/lib/crisphive/models/job_request_customer_summary.rb +245 -0
  58. data/lib/crisphive/models/job_request_day_windows.rb +227 -0
  59. data/lib/crisphive/models/job_request_job_date_business_range_request.rb +279 -0
  60. data/lib/crisphive/models/job_request_job_date_period_request.rb +268 -0
  61. data/lib/crisphive/models/job_request_job_date_request.rb +269 -0
  62. data/lib/crisphive/models/job_request_list.rb +227 -0
  63. data/lib/crisphive/models/job_request_period.rb +261 -0
  64. data/lib/crisphive/models/job_request_quote_summary.rb +245 -0
  65. data/lib/crisphive/models/job_request_rating_summary.rb +245 -0
  66. data/lib/crisphive/models/job_request_schedule.rb +289 -0
  67. data/lib/crisphive/models/job_request_session.rb +274 -0
  68. data/lib/crisphive/models/job_request_skill_summary.rb +255 -0
  69. data/lib/crisphive/models/job_request_status_summary.rb +225 -0
  70. data/lib/crisphive/models/job_request_technician_info.rb +265 -0
  71. data/lib/crisphive/models/job_request_timeline.rb +257 -0
  72. data/lib/crisphive/models/job_request_timeline_action.rb +311 -0
  73. data/lib/crisphive/models/job_request_timeline_event.rb +291 -0
  74. data/lib/crisphive/models/job_type.rb +309 -0
  75. data/lib/crisphive/models/list_customers200_response.rb +250 -0
  76. data/lib/crisphive/models/list_job_request_booking_windows200_response.rb +250 -0
  77. data/lib/crisphive/models/list_job_request_changes200_response.rb +250 -0
  78. data/lib/crisphive/models/list_job_requests200_response.rb +250 -0
  79. data/lib/crisphive/models/list_job_types200_response.rb +252 -0
  80. data/lib/crisphive/models/list_service_areas200_response.rb +250 -0
  81. data/lib/crisphive/models/list_skill_categories200_response.rb +250 -0
  82. data/lib/crisphive/models/list_skills200_response.rb +250 -0
  83. data/lib/crisphive/models/list_skills_by_category200_response.rb +250 -0
  84. data/lib/crisphive/models/list_technicians200_response.rb +250 -0
  85. data/lib/crisphive/models/list_vehicles200_response.rb +250 -0
  86. data/lib/crisphive/models/pagination.rb +250 -0
  87. data/lib/crisphive/models/response_envelope.rb +244 -0
  88. data/lib/crisphive/models/service_area.rb +315 -0
  89. data/lib/crisphive/models/service_area_list.rb +227 -0
  90. data/lib/crisphive/models/skill.rb +278 -0
  91. data/lib/crisphive/models/skill_by_category_list.rb +225 -0
  92. data/lib/crisphive/models/skill_category.rb +250 -0
  93. data/lib/crisphive/models/skill_category_list.rb +225 -0
  94. data/lib/crisphive/models/skill_list.rb +217 -0
  95. data/lib/crisphive/models/skill_summary.rb +255 -0
  96. data/lib/crisphive/models/technician.rb +499 -0
  97. data/lib/crisphive/models/technician_address.rb +275 -0
  98. data/lib/crisphive/models/technician_lead_ref.rb +225 -0
  99. data/lib/crisphive/models/technician_list.rb +247 -0
  100. data/lib/crisphive/models/technician_service_area_ref.rb +225 -0
  101. data/lib/crisphive/models/technician_status.rb +41 -0
  102. data/lib/crisphive/models/vehicle.rb +413 -0
  103. data/lib/crisphive/models/vehicle_list.rb +247 -0
  104. data/lib/crisphive/models/vehicle_owner.rb +225 -0
  105. data/lib/crisphive/version.rb +15 -0
  106. data/lib/crisphive.rb +134 -0
  107. data/spec/spec_helper.rb +111 -0
  108. metadata +220 -0
@@ -0,0 +1,259 @@
1
+ =begin
2
+ #CrispHive Developer API
3
+
4
+ #Public REST API for integrating CrispHive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Crisphive
17
+ class JobRequestActionAuditBy
18
+ # Role that fired the action (business_on_behalf = a business user acting for the customer/technician).
19
+ attr_accessor :actor
20
+
21
+ # UUID of the firing user; null for an unauthenticated customer actor.
22
+ attr_accessor :user_id
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'actor' => :'actor',
50
+ :'user_id' => :'user_id'
51
+ }
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'actor' => :'String',
63
+ :'user_id' => :'String'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestActionAuditBy` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestActionAuditBy`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'actor')
89
+ self.actor = attributes[:'actor']
90
+ end
91
+
92
+ if attributes.key?(:'user_id')
93
+ self.user_id = attributes[:'user_id']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
109
+ actor_validator = EnumAttributeValidator.new('String', ["business", "customer", "technician", "business_on_behalf"])
110
+ return false unless actor_validator.valid?(@actor)
111
+ true
112
+ end
113
+
114
+ # Custom attribute writer method checking allowed values (enum).
115
+ # @param [Object] actor Object to be assigned
116
+ def actor=(actor)
117
+ validator = EnumAttributeValidator.new('String', ["business", "customer", "technician", "business_on_behalf"])
118
+ unless validator.valid?(actor)
119
+ fail ArgumentError, "invalid value for \"actor\", must be one of #{validator.allowable_values}."
120
+ end
121
+ @actor = actor
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ actor == o.actor &&
130
+ user_id == o.user_id
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [actor, user_id].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ transformed_hash = {}
152
+ openapi_types.each_pair do |key, type|
153
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = nil
155
+ elsif type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
160
+ end
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
+ end
164
+ end
165
+ new(transformed_hash)
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def self._deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ # models (e.g. Pet) or oneOf
206
+ klass = Crisphive.const_get(type)
207
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end
@@ -0,0 +1,235 @@
1
+ =begin
2
+ #CrispHive Developer API
3
+
4
+ #Public REST API for integrating CrispHive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Crisphive
17
+ class JobRequestActionAuditEntry
18
+ # When the action was fired (UTC).
19
+ attr_accessor :at
20
+
21
+ # Who fired the action.
22
+ attr_accessor :by
23
+
24
+ # Payload is the raw capability payload (e.g. {\"location\":{\"lat\":..., \"lng\":...}} for client_location). Forwarded as json.RawMessage so FE receives a real JSON object, NOT a stringified blob. `swaggertype` hints the older swag CLI used in the Docker build pipeline (it does not natively recognise json.RawMessage).
25
+ attr_accessor :payload
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'at' => :'at',
31
+ :'by' => :'by',
32
+ :'payload' => :'payload'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'at' => :'String',
45
+ :'by' => :'JobRequestActionAuditBy',
46
+ :'payload' => :'Object'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestActionAuditEntry` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestActionAuditEntry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'at')
72
+ self.at = attributes[:'at']
73
+ end
74
+
75
+ if attributes.key?(:'by')
76
+ self.by = attributes[:'by']
77
+ end
78
+
79
+ if attributes.key?(:'payload')
80
+ self.payload = attributes[:'payload']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ warn '[DEPRECATED] the `valid?` method is obsolete'
96
+ true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ at == o.at &&
105
+ by == o.by &&
106
+ payload == o.payload
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Integer] Hash code
117
+ def hash
118
+ [at, by, payload].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def self.build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ attributes = attributes.transform_keys(&:to_sym)
127
+ transformed_hash = {}
128
+ openapi_types.each_pair do |key, type|
129
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
130
+ transformed_hash["#{key}"] = nil
131
+ elsif type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[attribute_map[key]].is_a?(Array)
135
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
+ end
137
+ elsif !attributes[attribute_map[key]].nil?
138
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
139
+ end
140
+ end
141
+ new(transformed_hash)
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def self._deserialize(type, value)
149
+ case type.to_sym
150
+ when :Time
151
+ Time.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :Boolean
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ # models (e.g. Pet) or oneOf
182
+ klass = Crisphive.const_get(type)
183
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end