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.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +219 -0
- data/Rakefile +10 -0
- data/crisphive.gemspec +40 -0
- data/git_push.sh +57 -0
- data/lib/crisphive/api/business_skill_api.rb +211 -0
- data/lib/crisphive/api/customer_api.rb +371 -0
- data/lib/crisphive/api/job_request_business_api.rb +449 -0
- data/lib/crisphive/api/job_types_api.rb +141 -0
- data/lib/crisphive/api/service_area_api.rb +148 -0
- data/lib/crisphive/api/technician_api.rb +163 -0
- data/lib/crisphive/api/vehicle_api.rb +157 -0
- data/lib/crisphive/api_client.rb +437 -0
- data/lib/crisphive/api_error.rb +58 -0
- data/lib/crisphive/configuration.rb +393 -0
- data/lib/crisphive/models/create_customer200_response.rb +250 -0
- data/lib/crisphive/models/create_job_request200_response.rb +250 -0
- data/lib/crisphive/models/customer.rb +235 -0
- data/lib/crisphive/models/customer_address.rb +295 -0
- data/lib/crisphive/models/customer_address_request.rb +475 -0
- data/lib/crisphive/models/customer_contact.rb +255 -0
- data/lib/crisphive/models/customer_create_request.rb +383 -0
- data/lib/crisphive/models/customer_create_response.rb +215 -0
- data/lib/crisphive/models/customer_list.rb +247 -0
- data/lib/crisphive/models/customer_list_item.rb +341 -0
- data/lib/crisphive/models/customer_profile.rb +321 -0
- data/lib/crisphive/models/customer_spending.rb +299 -0
- data/lib/crisphive/models/customer_tier_progress.rb +235 -0
- data/lib/crisphive/models/customer_update_request.rb +434 -0
- data/lib/crisphive/models/get_customer200_response.rb +250 -0
- data/lib/crisphive/models/get_job_request200_response.rb +250 -0
- data/lib/crisphive/models/get_job_request_timeline200_response.rb +250 -0
- data/lib/crisphive/models/get_job_type200_response.rb +250 -0
- data/lib/crisphive/models/get_service_area200_response.rb +250 -0
- data/lib/crisphive/models/get_technician200_response.rb +250 -0
- data/lib/crisphive/models/get_vehicle200_response.rb +250 -0
- data/lib/crisphive/models/job_date.rb +225 -0
- data/lib/crisphive/models/job_date_business_range.rb +263 -0
- data/lib/crisphive/models/job_date_period.rb +41 -0
- data/lib/crisphive/models/job_date_period_entry.rb +247 -0
- data/lib/crisphive/models/job_request.rb +537 -0
- data/lib/crisphive/models/job_request_action_audit_by.rb +259 -0
- data/lib/crisphive/models/job_request_action_audit_entry.rb +235 -0
- data/lib/crisphive/models/job_request_action_summary.rb +281 -0
- data/lib/crisphive/models/job_request_address_summary.rb +295 -0
- data/lib/crisphive/models/job_request_archive_summary.rb +245 -0
- data/lib/crisphive/models/job_request_arrival_window.rb +235 -0
- data/lib/crisphive/models/job_request_assigned_vehicle.rb +225 -0
- data/lib/crisphive/models/job_request_assignment_summary.rb +255 -0
- data/lib/crisphive/models/job_request_booking_windows.rb +247 -0
- data/lib/crisphive/models/job_request_business_time_range.rb +279 -0
- data/lib/crisphive/models/job_request_changes.rb +237 -0
- data/lib/crisphive/models/job_request_create_request.rb +339 -0
- data/lib/crisphive/models/job_request_create_response.rb +245 -0
- data/lib/crisphive/models/job_request_crew_member.rb +352 -0
- data/lib/crisphive/models/job_request_customer_summary.rb +245 -0
- data/lib/crisphive/models/job_request_day_windows.rb +227 -0
- data/lib/crisphive/models/job_request_job_date_business_range_request.rb +279 -0
- data/lib/crisphive/models/job_request_job_date_period_request.rb +268 -0
- data/lib/crisphive/models/job_request_job_date_request.rb +269 -0
- data/lib/crisphive/models/job_request_list.rb +227 -0
- data/lib/crisphive/models/job_request_period.rb +261 -0
- data/lib/crisphive/models/job_request_quote_summary.rb +245 -0
- data/lib/crisphive/models/job_request_rating_summary.rb +245 -0
- data/lib/crisphive/models/job_request_schedule.rb +289 -0
- data/lib/crisphive/models/job_request_session.rb +274 -0
- data/lib/crisphive/models/job_request_skill_summary.rb +255 -0
- data/lib/crisphive/models/job_request_status_summary.rb +225 -0
- data/lib/crisphive/models/job_request_technician_info.rb +265 -0
- data/lib/crisphive/models/job_request_timeline.rb +257 -0
- data/lib/crisphive/models/job_request_timeline_action.rb +311 -0
- data/lib/crisphive/models/job_request_timeline_event.rb +291 -0
- data/lib/crisphive/models/job_type.rb +309 -0
- data/lib/crisphive/models/list_customers200_response.rb +250 -0
- data/lib/crisphive/models/list_job_request_booking_windows200_response.rb +250 -0
- data/lib/crisphive/models/list_job_request_changes200_response.rb +250 -0
- data/lib/crisphive/models/list_job_requests200_response.rb +250 -0
- data/lib/crisphive/models/list_job_types200_response.rb +252 -0
- data/lib/crisphive/models/list_service_areas200_response.rb +250 -0
- data/lib/crisphive/models/list_skill_categories200_response.rb +250 -0
- data/lib/crisphive/models/list_skills200_response.rb +250 -0
- data/lib/crisphive/models/list_skills_by_category200_response.rb +250 -0
- data/lib/crisphive/models/list_technicians200_response.rb +250 -0
- data/lib/crisphive/models/list_vehicles200_response.rb +250 -0
- data/lib/crisphive/models/pagination.rb +250 -0
- data/lib/crisphive/models/response_envelope.rb +244 -0
- data/lib/crisphive/models/service_area.rb +315 -0
- data/lib/crisphive/models/service_area_list.rb +227 -0
- data/lib/crisphive/models/skill.rb +278 -0
- data/lib/crisphive/models/skill_by_category_list.rb +225 -0
- data/lib/crisphive/models/skill_category.rb +250 -0
- data/lib/crisphive/models/skill_category_list.rb +225 -0
- data/lib/crisphive/models/skill_list.rb +217 -0
- data/lib/crisphive/models/skill_summary.rb +255 -0
- data/lib/crisphive/models/technician.rb +499 -0
- data/lib/crisphive/models/technician_address.rb +275 -0
- data/lib/crisphive/models/technician_lead_ref.rb +225 -0
- data/lib/crisphive/models/technician_list.rb +247 -0
- data/lib/crisphive/models/technician_service_area_ref.rb +225 -0
- data/lib/crisphive/models/technician_status.rb +41 -0
- data/lib/crisphive/models/vehicle.rb +413 -0
- data/lib/crisphive/models/vehicle_list.rb +247 -0
- data/lib/crisphive/models/vehicle_owner.rb +225 -0
- data/lib/crisphive/version.rb +15 -0
- data/lib/crisphive.rb +134 -0
- data/spec/spec_helper.rb +111 -0
- metadata +220 -0
|
@@ -0,0 +1,255 @@
|
|
|
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 JobRequestSkillSummary
|
|
18
|
+
# UUID of the skill's category.
|
|
19
|
+
attr_accessor :category_id
|
|
20
|
+
|
|
21
|
+
# Category display name.
|
|
22
|
+
attr_accessor :category_name
|
|
23
|
+
|
|
24
|
+
# Skill UUID.
|
|
25
|
+
attr_accessor :id
|
|
26
|
+
|
|
27
|
+
# Whether the skill is currently active.
|
|
28
|
+
attr_accessor :is_active
|
|
29
|
+
|
|
30
|
+
# Skill display name (resolved to the request locale).
|
|
31
|
+
attr_accessor :name
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'category_id' => :'category_id',
|
|
37
|
+
:'category_name' => :'category_name',
|
|
38
|
+
:'id' => :'id',
|
|
39
|
+
:'is_active' => :'is_active',
|
|
40
|
+
:'name' => :'name'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Returns all the JSON keys this model knows about
|
|
45
|
+
def self.acceptable_attributes
|
|
46
|
+
attribute_map.values
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Attribute type mapping.
|
|
50
|
+
def self.openapi_types
|
|
51
|
+
{
|
|
52
|
+
:'category_id' => :'String',
|
|
53
|
+
:'category_name' => :'String',
|
|
54
|
+
:'id' => :'String',
|
|
55
|
+
:'is_active' => :'Boolean',
|
|
56
|
+
:'name' => :'String'
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# List of attributes with nullable: true
|
|
61
|
+
def self.openapi_nullable
|
|
62
|
+
Set.new([
|
|
63
|
+
])
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Initializes the object
|
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
68
|
+
def initialize(attributes = {})
|
|
69
|
+
if (!attributes.is_a?(Hash))
|
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestSkillSummary` initialize method"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestSkillSummary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
77
|
+
end
|
|
78
|
+
h[k.to_sym] = v
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if attributes.key?(:'category_id')
|
|
82
|
+
self.category_id = attributes[:'category_id']
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if attributes.key?(:'category_name')
|
|
86
|
+
self.category_name = attributes[:'category_name']
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'id')
|
|
90
|
+
self.id = attributes[:'id']
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'is_active')
|
|
94
|
+
self.is_active = attributes[:'is_active']
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'name')
|
|
98
|
+
self.name = attributes[:'name']
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
103
|
+
# @return Array for valid properties with the reasons
|
|
104
|
+
def list_invalid_properties
|
|
105
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
106
|
+
invalid_properties = Array.new
|
|
107
|
+
invalid_properties
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Check to see if the all the properties in the model are valid
|
|
111
|
+
# @return true if the model is valid
|
|
112
|
+
def valid?
|
|
113
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
114
|
+
true
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Checks equality by comparing each attribute.
|
|
118
|
+
# @param [Object] Object to be compared
|
|
119
|
+
def ==(o)
|
|
120
|
+
return true if self.equal?(o)
|
|
121
|
+
self.class == o.class &&
|
|
122
|
+
category_id == o.category_id &&
|
|
123
|
+
category_name == o.category_name &&
|
|
124
|
+
id == o.id &&
|
|
125
|
+
is_active == o.is_active &&
|
|
126
|
+
name == o.name
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# @see the `==` method
|
|
130
|
+
# @param [Object] Object to be compared
|
|
131
|
+
def eql?(o)
|
|
132
|
+
self == o
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Calculates hash code according to all attributes.
|
|
136
|
+
# @return [Integer] Hash code
|
|
137
|
+
def hash
|
|
138
|
+
[category_id, category_name, id, is_active, name].hash
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Builds the object from hash
|
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
143
|
+
# @return [Object] Returns the model itself
|
|
144
|
+
def self.build_from_hash(attributes)
|
|
145
|
+
return nil unless attributes.is_a?(Hash)
|
|
146
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
147
|
+
transformed_hash = {}
|
|
148
|
+
openapi_types.each_pair do |key, type|
|
|
149
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
150
|
+
transformed_hash["#{key}"] = nil
|
|
151
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
152
|
+
# check to ensure the input is an array given that the attribute
|
|
153
|
+
# is documented as an array but the input is not
|
|
154
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
155
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
156
|
+
end
|
|
157
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
158
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
new(transformed_hash)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Deserializes the data based on type
|
|
165
|
+
# @param string type Data type
|
|
166
|
+
# @param string value Value to be deserialized
|
|
167
|
+
# @return [Object] Deserialized data
|
|
168
|
+
def self._deserialize(type, value)
|
|
169
|
+
case type.to_sym
|
|
170
|
+
when :Time
|
|
171
|
+
Time.parse(value)
|
|
172
|
+
when :Date
|
|
173
|
+
Date.parse(value)
|
|
174
|
+
when :String
|
|
175
|
+
value.to_s
|
|
176
|
+
when :Integer
|
|
177
|
+
value.to_i
|
|
178
|
+
when :Float
|
|
179
|
+
value.to_f
|
|
180
|
+
when :Boolean
|
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
182
|
+
true
|
|
183
|
+
else
|
|
184
|
+
false
|
|
185
|
+
end
|
|
186
|
+
when :Object
|
|
187
|
+
# generic object (usually a Hash), return directly
|
|
188
|
+
value
|
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
|
195
|
+
{}.tap do |hash|
|
|
196
|
+
value.each do |k, v|
|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
else # model
|
|
201
|
+
# models (e.g. Pet) or oneOf
|
|
202
|
+
klass = Crisphive.const_get(type)
|
|
203
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Returns the string representation of the object
|
|
208
|
+
# @return [String] String presentation of the object
|
|
209
|
+
def to_s
|
|
210
|
+
to_hash.to_s
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
|
215
|
+
def to_body
|
|
216
|
+
to_hash
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Returns the object in the form of hash
|
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
|
221
|
+
def to_hash
|
|
222
|
+
hash = {}
|
|
223
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
224
|
+
value = self.send(attr)
|
|
225
|
+
if value.nil?
|
|
226
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
227
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
hash[param] = _to_hash(value)
|
|
231
|
+
end
|
|
232
|
+
hash
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Outputs non-array value in the form of hash
|
|
236
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
237
|
+
# @param [Object] value Any valid value
|
|
238
|
+
# @return [Hash] Returns the value in the form of hash
|
|
239
|
+
def _to_hash(value)
|
|
240
|
+
if value.is_a?(Array)
|
|
241
|
+
value.compact.map { |v| _to_hash(v) }
|
|
242
|
+
elsif value.is_a?(Hash)
|
|
243
|
+
{}.tap do |hash|
|
|
244
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
245
|
+
end
|
|
246
|
+
elsif value.respond_to? :to_hash
|
|
247
|
+
value.to_hash
|
|
248
|
+
else
|
|
249
|
+
value
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
end
|
|
@@ -0,0 +1,225 @@
|
|
|
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 JobRequestStatusSummary
|
|
18
|
+
# Status display name, resolved to the request locale.
|
|
19
|
+
attr_accessor :display_name
|
|
20
|
+
|
|
21
|
+
# Workflow status key (the business's workflow defines the set; first is always \"booking\", last always \"completed\").
|
|
22
|
+
attr_accessor :key
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'display_name' => :'display_name',
|
|
28
|
+
:'key' => :'key'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns all the JSON keys this model knows about
|
|
33
|
+
def self.acceptable_attributes
|
|
34
|
+
attribute_map.values
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Attribute type mapping.
|
|
38
|
+
def self.openapi_types
|
|
39
|
+
{
|
|
40
|
+
:'display_name' => :'String',
|
|
41
|
+
:'key' => :'String'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# List of attributes with nullable: true
|
|
46
|
+
def self.openapi_nullable
|
|
47
|
+
Set.new([
|
|
48
|
+
])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Initializes the object
|
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
53
|
+
def initialize(attributes = {})
|
|
54
|
+
if (!attributes.is_a?(Hash))
|
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestStatusSummary` initialize method"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestStatusSummary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
62
|
+
end
|
|
63
|
+
h[k.to_sym] = v
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:'display_name')
|
|
67
|
+
self.display_name = attributes[:'display_name']
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if attributes.key?(:'key')
|
|
71
|
+
self.key = attributes[:'key']
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
76
|
+
# @return Array for valid properties with the reasons
|
|
77
|
+
def list_invalid_properties
|
|
78
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
79
|
+
invalid_properties = Array.new
|
|
80
|
+
invalid_properties
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Check to see if the all the properties in the model are valid
|
|
84
|
+
# @return true if the model is valid
|
|
85
|
+
def valid?
|
|
86
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
87
|
+
true
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Checks equality by comparing each attribute.
|
|
91
|
+
# @param [Object] Object to be compared
|
|
92
|
+
def ==(o)
|
|
93
|
+
return true if self.equal?(o)
|
|
94
|
+
self.class == o.class &&
|
|
95
|
+
display_name == o.display_name &&
|
|
96
|
+
key == o.key
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# @see the `==` method
|
|
100
|
+
# @param [Object] Object to be compared
|
|
101
|
+
def eql?(o)
|
|
102
|
+
self == o
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Calculates hash code according to all attributes.
|
|
106
|
+
# @return [Integer] Hash code
|
|
107
|
+
def hash
|
|
108
|
+
[display_name, key].hash
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Builds the object from hash
|
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
113
|
+
# @return [Object] Returns the model itself
|
|
114
|
+
def self.build_from_hash(attributes)
|
|
115
|
+
return nil unless attributes.is_a?(Hash)
|
|
116
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
117
|
+
transformed_hash = {}
|
|
118
|
+
openapi_types.each_pair do |key, type|
|
|
119
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
120
|
+
transformed_hash["#{key}"] = nil
|
|
121
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
122
|
+
# check to ensure the input is an array given that the attribute
|
|
123
|
+
# is documented as an array but the input is not
|
|
124
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
125
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
126
|
+
end
|
|
127
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
128
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
new(transformed_hash)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Deserializes the data based on type
|
|
135
|
+
# @param string type Data type
|
|
136
|
+
# @param string value Value to be deserialized
|
|
137
|
+
# @return [Object] Deserialized data
|
|
138
|
+
def self._deserialize(type, value)
|
|
139
|
+
case type.to_sym
|
|
140
|
+
when :Time
|
|
141
|
+
Time.parse(value)
|
|
142
|
+
when :Date
|
|
143
|
+
Date.parse(value)
|
|
144
|
+
when :String
|
|
145
|
+
value.to_s
|
|
146
|
+
when :Integer
|
|
147
|
+
value.to_i
|
|
148
|
+
when :Float
|
|
149
|
+
value.to_f
|
|
150
|
+
when :Boolean
|
|
151
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
152
|
+
true
|
|
153
|
+
else
|
|
154
|
+
false
|
|
155
|
+
end
|
|
156
|
+
when :Object
|
|
157
|
+
# generic object (usually a Hash), return directly
|
|
158
|
+
value
|
|
159
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
160
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
161
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
162
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
163
|
+
k_type = Regexp.last_match[:k_type]
|
|
164
|
+
v_type = Regexp.last_match[:v_type]
|
|
165
|
+
{}.tap do |hash|
|
|
166
|
+
value.each do |k, v|
|
|
167
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
else # model
|
|
171
|
+
# models (e.g. Pet) or oneOf
|
|
172
|
+
klass = Crisphive.const_get(type)
|
|
173
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Returns the string representation of the object
|
|
178
|
+
# @return [String] String presentation of the object
|
|
179
|
+
def to_s
|
|
180
|
+
to_hash.to_s
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
|
185
|
+
def to_body
|
|
186
|
+
to_hash
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Returns the object in the form of hash
|
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
|
191
|
+
def to_hash
|
|
192
|
+
hash = {}
|
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
194
|
+
value = self.send(attr)
|
|
195
|
+
if value.nil?
|
|
196
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
197
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
hash[param] = _to_hash(value)
|
|
201
|
+
end
|
|
202
|
+
hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Outputs non-array value in the form of hash
|
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
207
|
+
# @param [Object] value Any valid value
|
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
|
209
|
+
def _to_hash(value)
|
|
210
|
+
if value.is_a?(Array)
|
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
|
212
|
+
elsif value.is_a?(Hash)
|
|
213
|
+
{}.tap do |hash|
|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
215
|
+
end
|
|
216
|
+
elsif value.respond_to? :to_hash
|
|
217
|
+
value.to_hash
|
|
218
|
+
else
|
|
219
|
+
value
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
end
|