freeclimb 4.3.0 → 4.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +20 -4
- data/docs/DefaultApi.md +433 -0
- data/docs/IncomingNumberRequest.md +3 -1
- data/docs/SMSTenDLCBrand.md +78 -0
- data/docs/SMSTenDLCBrandsListResult.md +32 -0
- data/docs/SMSTenDLCBrandsListResultAllOf.md +18 -0
- data/docs/SMSTenDLCCampaign.md +78 -0
- data/docs/SMSTenDLCCampaignsListResult.md +32 -0
- data/docs/SMSTenDLCCampaignsListResultAllOf.md +18 -0
- data/docs/SMSTenDLCPartnerCampaign.md +74 -0
- data/docs/SMSTenDLCPartnerCampaignBrand.md +38 -0
- data/docs/SMSTenDLCPartnerCampaignsListResult.md +32 -0
- data/docs/SMSTenDLCPartnerCampaignsListResultAllOf.md +18 -0
- data/lib/freeclimb/api/default_api.rb +360 -0
- data/lib/freeclimb/models/incoming_number_request.rb +15 -4
- data/lib/freeclimb/models/sms_ten_dlc_brand.rb +960 -0
- data/lib/freeclimb/models/sms_ten_dlc_brands_list_result.rb +306 -0
- data/lib/freeclimb/models/sms_ten_dlc_brands_list_result_all_of.rb +221 -0
- data/lib/freeclimb/models/sms_ten_dlc_campaign.rb +814 -0
- data/lib/freeclimb/models/sms_ten_dlc_campaigns_list_result.rb +306 -0
- data/lib/freeclimb/models/sms_ten_dlc_campaigns_list_result_all_of.rb +221 -0
- data/lib/freeclimb/models/sms_ten_dlc_partner_campaign.rb +807 -0
- data/lib/freeclimb/models/sms_ten_dlc_partner_campaign_brand.rb +445 -0
- data/lib/freeclimb/models/sms_ten_dlc_partner_campaigns_list_result.rb +306 -0
- data/lib/freeclimb/models/sms_ten_dlc_partner_campaigns_list_result_all_of.rb +221 -0
- data/lib/freeclimb/version.rb +1 -1
- data/lib/freeclimb.rb +10 -0
- data/openapi.json +1277 -12
- data/spec/api/default_api_spec.rb +151 -1
- data/spec/models/account_request_spec.rb +143 -2
- data/spec/models/account_result_spec.rb +377 -13
- data/spec/models/account_status_spec.rb +39 -6
- data/spec/models/account_type_spec.rb +26 -4
- data/spec/models/add_to_conference_spec.rb +343 -10
- data/spec/models/answered_by_spec.rb +26 -4
- data/spec/models/application_list_spec.rb +293 -8
- data/spec/models/application_request_spec.rb +268 -7
- data/spec/models/application_result_spec.rb +418 -13
- data/spec/models/available_number_list_spec.rb +293 -8
- data/spec/models/available_number_spec.rb +263 -7
- data/spec/models/buy_incoming_number_request_spec.rb +168 -3
- data/spec/models/call_direction_spec.rb +39 -6
- data/spec/models/call_list_spec.rb +293 -8
- data/spec/models/call_result_spec.rb +603 -22
- data/spec/models/call_status_spec.rb +104 -16
- data/spec/models/capabilities_spec.rb +218 -5
- data/spec/models/conference_list_spec.rb +293 -8
- data/spec/models/conference_participant_list_spec.rb +293 -8
- data/spec/models/conference_participant_result_spec.rb +343 -10
- data/spec/models/conference_result_spec.rb +464 -16
- data/spec/models/conference_status_spec.rb +52 -8
- data/spec/models/create_conference_request_spec.rb +228 -6
- data/spec/models/create_conference_spec.rb +253 -7
- data/spec/models/enqueue_spec.rb +193 -4
- data/spec/models/filter_logs_request_spec.rb +118 -1
- data/spec/models/get_digits_spec.rb +318 -9
- data/spec/models/get_speech_reason_spec.rb +78 -12
- data/spec/models/get_speech_spec.rb +388 -14
- data/spec/models/grammar_file_built_in_spec.rb +195 -30
- data/spec/models/grammar_type_spec.rb +26 -4
- data/spec/models/hangup_spec.rb +118 -1
- data/spec/models/if_machine_spec.rb +26 -4
- data/spec/models/incoming_number_list_spec.rb +293 -8
- data/spec/models/incoming_number_request_spec.rb +173 -2
- data/spec/models/incoming_number_result_spec.rb +488 -16
- data/spec/models/language_spec.rb +338 -52
- data/spec/models/log_level_spec.rb +39 -6
- data/spec/models/log_list_spec.rb +293 -8
- data/spec/models/log_result_spec.rb +275 -8
- data/spec/models/machine_type_spec.rb +26 -4
- data/spec/models/make_call_request_spec.rb +343 -10
- data/spec/models/message_direction_spec.rb +26 -4
- data/spec/models/message_request_spec.rb +318 -9
- data/spec/models/message_result_spec.rb +431 -13
- data/spec/models/message_status_spec.rb +143 -22
- data/spec/models/messages_list_spec.rb +293 -8
- data/spec/models/mutable_resource_model_spec.rb +193 -4
- data/spec/models/out_dial_spec.rb +345 -11
- data/spec/models/pagination_model_spec.rb +268 -7
- data/spec/models/park_spec.rb +168 -3
- data/spec/models/pause_spec.rb +118 -1
- data/spec/models/percl_command_spec.rb +132 -3
- data/spec/models/percl_script_spec.rb +118 -1
- data/spec/models/play_beep_spec.rb +52 -8
- data/spec/models/play_early_media_spec.rb +118 -1
- data/spec/models/play_spec.rb +193 -4
- data/spec/models/queue_list_spec.rb +293 -8
- data/spec/models/queue_member_list_spec.rb +293 -8
- data/spec/models/queue_member_spec.rb +218 -5
- data/spec/models/queue_request_spec.rb +143 -2
- data/spec/models/queue_result_spec.rb +369 -11
- data/spec/models/queue_result_status_spec.rb +52 -8
- data/spec/models/record_utterance_spec.rb +268 -7
- data/spec/models/record_utterance_term_reason_spec.rb +52 -8
- data/spec/models/recording_list_spec.rb +293 -8
- data/spec/models/recording_result_spec.rb +318 -9
- data/spec/models/redirect_spec.rb +118 -1
- data/spec/models/reject_spec.rb +118 -1
- data/spec/models/remove_from_conference_spec.rb +118 -1
- data/spec/models/request_type_spec.rb +299 -46
- data/spec/models/say_spec.rb +218 -5
- data/spec/models/send_digits_spec.rb +168 -3
- data/spec/models/set_listen_spec.rb +143 -2
- data/spec/models/set_talk_spec.rb +143 -2
- data/spec/models/sms_spec.rb +193 -4
- data/spec/models/sms_ten_dlc_brand_spec.rb +1240 -0
- data/spec/models/sms_ten_dlc_brands_list_result_spec.rb +361 -0
- data/spec/models/sms_ten_dlc_campaign_spec.rb +1055 -0
- data/spec/models/sms_ten_dlc_campaigns_list_result_spec.rb +361 -0
- data/spec/models/sms_ten_dlc_partner_campaign_brand_spec.rb +448 -0
- data/spec/models/sms_ten_dlc_partner_campaign_spec.rb +994 -0
- data/spec/models/sms_ten_dlc_partner_campaigns_list_result_spec.rb +361 -0
- data/spec/models/terminate_conference_spec.rb +118 -1
- data/spec/models/update_call_request_spec.rb +120 -2
- data/spec/models/update_call_request_status_spec.rb +26 -4
- data/spec/models/update_conference_participant_request_spec.rb +143 -2
- data/spec/models/update_conference_request_spec.rb +180 -5
- data/spec/models/update_conference_request_status_spec.rb +26 -4
- metadata +102 -68
@@ -0,0 +1,445 @@
|
|
1
|
+
=begin
|
2
|
+
#FreeClimb API
|
3
|
+
|
4
|
+
#FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: support@freeclimb.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Freeclimb
|
17
|
+
class SMSTenDLCPartnerCampaignBrand
|
18
|
+
# ID of the account that created this Queue.
|
19
|
+
attr_accessor :account_id
|
20
|
+
|
21
|
+
# Unique identifier assigned to the brand by the registry.
|
22
|
+
attr_accessor :brand_id
|
23
|
+
|
24
|
+
# First or given name.
|
25
|
+
attr_accessor :first_name
|
26
|
+
|
27
|
+
# Last or Surname.
|
28
|
+
attr_accessor :last_name
|
29
|
+
|
30
|
+
# Display or marketing name of the brand.
|
31
|
+
attr_accessor :display_name
|
32
|
+
|
33
|
+
# (Required for Non-profit/private/public) Legal company name.
|
34
|
+
attr_accessor :company_name
|
35
|
+
|
36
|
+
# Valid phone number in e.164 international format.
|
37
|
+
attr_accessor :phone
|
38
|
+
|
39
|
+
# Valid email address of brand support contact.
|
40
|
+
attr_accessor :email
|
41
|
+
|
42
|
+
# Brand website URL.
|
43
|
+
attr_accessor :website
|
44
|
+
|
45
|
+
# Optional brand attributes. Please refer to GET /enum/optionalAttributeNames for dictionary of optional attribute names.
|
46
|
+
attr_accessor :optional_attributes
|
47
|
+
|
48
|
+
# External vetting score.
|
49
|
+
attr_accessor :evp_vetting_score
|
50
|
+
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
52
|
+
def self.attribute_map
|
53
|
+
{
|
54
|
+
:'account_id' => :'accountId',
|
55
|
+
:'brand_id' => :'brandId',
|
56
|
+
:'first_name' => :'firstName',
|
57
|
+
:'last_name' => :'lastName',
|
58
|
+
:'display_name' => :'displayName',
|
59
|
+
:'company_name' => :'companyName',
|
60
|
+
:'phone' => :'phone',
|
61
|
+
:'email' => :'email',
|
62
|
+
:'website' => :'website',
|
63
|
+
:'optional_attributes' => :'optionalAttributes',
|
64
|
+
:'evp_vetting_score' => :'evpVettingScore'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns all the JSON keys this model knows about
|
69
|
+
def self.acceptable_attributes
|
70
|
+
attribute_map.values
|
71
|
+
end
|
72
|
+
|
73
|
+
# Attribute type mapping.
|
74
|
+
def self.openapi_types
|
75
|
+
{
|
76
|
+
:'account_id' => :'String',
|
77
|
+
:'brand_id' => :'String',
|
78
|
+
:'first_name' => :'String',
|
79
|
+
:'last_name' => :'String',
|
80
|
+
:'display_name' => :'String',
|
81
|
+
:'company_name' => :'String',
|
82
|
+
:'phone' => :'String',
|
83
|
+
:'email' => :'String',
|
84
|
+
:'website' => :'String',
|
85
|
+
:'optional_attributes' => :'Hash<String, Object>',
|
86
|
+
:'evp_vetting_score' => :'Integer'
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
# List of attributes with nullable: true
|
91
|
+
def self.openapi_nullable
|
92
|
+
Set.new([
|
93
|
+
:'account_id',
|
94
|
+
])
|
95
|
+
end
|
96
|
+
|
97
|
+
# Initializes the object
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
def initialize(attributes = {})
|
100
|
+
if (!attributes.is_a?(Hash))
|
101
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::SMSTenDLCPartnerCampaignBrand` initialize method"
|
102
|
+
end
|
103
|
+
|
104
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
105
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
106
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
107
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::SMSTenDLCPartnerCampaignBrand`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
108
|
+
end
|
109
|
+
h[k.to_sym] = v
|
110
|
+
}
|
111
|
+
|
112
|
+
if attributes.key?(:'account_id')
|
113
|
+
self.account_id = attributes[:'account_id']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'brand_id')
|
117
|
+
self.brand_id = attributes[:'brand_id']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'first_name')
|
121
|
+
self.first_name = attributes[:'first_name']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'last_name')
|
125
|
+
self.last_name = attributes[:'last_name']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'display_name')
|
129
|
+
self.display_name = attributes[:'display_name']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'company_name')
|
133
|
+
self.company_name = attributes[:'company_name']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'phone')
|
137
|
+
self.phone = attributes[:'phone']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'email')
|
141
|
+
self.email = attributes[:'email']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'website')
|
145
|
+
self.website = attributes[:'website']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'optional_attributes')
|
149
|
+
if (value = attributes[:'optional_attributes']).is_a?(Hash)
|
150
|
+
self.optional_attributes = value
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'evp_vetting_score')
|
155
|
+
self.evp_vetting_score = attributes[:'evp_vetting_score']
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
160
|
+
# @return Array for valid properties with the reasons
|
161
|
+
def list_invalid_properties
|
162
|
+
invalid_properties = Array.new
|
163
|
+
if !@first_name.nil? && @first_name.to_s.length > 100
|
164
|
+
invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 100.')
|
165
|
+
end
|
166
|
+
|
167
|
+
if !@last_name.nil? && @last_name.to_s.length > 100
|
168
|
+
invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 100.')
|
169
|
+
end
|
170
|
+
|
171
|
+
if !@display_name.nil? && @display_name.to_s.length > 255
|
172
|
+
invalid_properties.push('invalid value for "display_name", the character length must be smaller than or equal to 255.')
|
173
|
+
end
|
174
|
+
|
175
|
+
if !@company_name.nil? && @company_name.to_s.length > 255
|
176
|
+
invalid_properties.push('invalid value for "company_name", the character length must be smaller than or equal to 255.')
|
177
|
+
end
|
178
|
+
|
179
|
+
if @phone.nil?
|
180
|
+
invalid_properties.push('invalid value for "phone", phone cannot be nil.')
|
181
|
+
end
|
182
|
+
|
183
|
+
if @phone.to_s.length > 20
|
184
|
+
invalid_properties.push('invalid value for "phone", the character length must be smaller than or equal to 20.')
|
185
|
+
end
|
186
|
+
|
187
|
+
if @email.nil?
|
188
|
+
invalid_properties.push('invalid value for "email", email cannot be nil.')
|
189
|
+
end
|
190
|
+
|
191
|
+
if @email.to_s.length > 100
|
192
|
+
invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 100.')
|
193
|
+
end
|
194
|
+
|
195
|
+
if !@website.nil? && @website.to_s.length > 100
|
196
|
+
invalid_properties.push('invalid value for "website", the character length must be smaller than or equal to 100.')
|
197
|
+
end
|
198
|
+
|
199
|
+
invalid_properties
|
200
|
+
end
|
201
|
+
|
202
|
+
# Check to see if the all the properties in the model are valid
|
203
|
+
# @return true if the model is valid
|
204
|
+
def valid?
|
205
|
+
return false if !@first_name.nil? && @first_name.to_s.length > 100
|
206
|
+
return false if !@last_name.nil? && @last_name.to_s.length > 100
|
207
|
+
return false if !@display_name.nil? && @display_name.to_s.length > 255
|
208
|
+
return false if !@company_name.nil? && @company_name.to_s.length > 255
|
209
|
+
return false if @phone.nil?
|
210
|
+
return false if @phone.to_s.length > 20
|
211
|
+
return false if @email.nil?
|
212
|
+
return false if @email.to_s.length > 100
|
213
|
+
return false if !@website.nil? && @website.to_s.length > 100
|
214
|
+
true
|
215
|
+
end
|
216
|
+
|
217
|
+
# Custom attribute writer method with validation
|
218
|
+
# @param [Object] first_name Value to be assigned
|
219
|
+
def first_name=(first_name)
|
220
|
+
if !first_name.nil? && first_name.to_s.length > 100
|
221
|
+
fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 100.'
|
222
|
+
end
|
223
|
+
|
224
|
+
@first_name = first_name
|
225
|
+
end
|
226
|
+
|
227
|
+
# Custom attribute writer method with validation
|
228
|
+
# @param [Object] last_name Value to be assigned
|
229
|
+
def last_name=(last_name)
|
230
|
+
if !last_name.nil? && last_name.to_s.length > 100
|
231
|
+
fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 100.'
|
232
|
+
end
|
233
|
+
|
234
|
+
@last_name = last_name
|
235
|
+
end
|
236
|
+
|
237
|
+
# Custom attribute writer method with validation
|
238
|
+
# @param [Object] display_name Value to be assigned
|
239
|
+
def display_name=(display_name)
|
240
|
+
if !display_name.nil? && display_name.to_s.length > 255
|
241
|
+
fail ArgumentError, 'invalid value for "display_name", the character length must be smaller than or equal to 255.'
|
242
|
+
end
|
243
|
+
|
244
|
+
@display_name = display_name
|
245
|
+
end
|
246
|
+
|
247
|
+
# Custom attribute writer method with validation
|
248
|
+
# @param [Object] company_name Value to be assigned
|
249
|
+
def company_name=(company_name)
|
250
|
+
if !company_name.nil? && company_name.to_s.length > 255
|
251
|
+
fail ArgumentError, 'invalid value for "company_name", the character length must be smaller than or equal to 255.'
|
252
|
+
end
|
253
|
+
|
254
|
+
@company_name = company_name
|
255
|
+
end
|
256
|
+
|
257
|
+
# Custom attribute writer method with validation
|
258
|
+
# @param [Object] phone Value to be assigned
|
259
|
+
def phone=(phone)
|
260
|
+
if phone.nil?
|
261
|
+
fail ArgumentError, 'phone cannot be nil'
|
262
|
+
end
|
263
|
+
|
264
|
+
if phone.to_s.length > 20
|
265
|
+
fail ArgumentError, 'invalid value for "phone", the character length must be smaller than or equal to 20.'
|
266
|
+
end
|
267
|
+
|
268
|
+
@phone = phone
|
269
|
+
end
|
270
|
+
|
271
|
+
# Custom attribute writer method with validation
|
272
|
+
# @param [Object] email Value to be assigned
|
273
|
+
def email=(email)
|
274
|
+
if email.nil?
|
275
|
+
fail ArgumentError, 'email cannot be nil'
|
276
|
+
end
|
277
|
+
|
278
|
+
if email.to_s.length > 100
|
279
|
+
fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 100.'
|
280
|
+
end
|
281
|
+
|
282
|
+
@email = email
|
283
|
+
end
|
284
|
+
|
285
|
+
# Custom attribute writer method with validation
|
286
|
+
# @param [Object] website Value to be assigned
|
287
|
+
def website=(website)
|
288
|
+
if !website.nil? && website.to_s.length > 100
|
289
|
+
fail ArgumentError, 'invalid value for "website", the character length must be smaller than or equal to 100.'
|
290
|
+
end
|
291
|
+
|
292
|
+
@website = website
|
293
|
+
end
|
294
|
+
|
295
|
+
# Checks equality by comparing each attribute.
|
296
|
+
# @param [Object] Object to be compared
|
297
|
+
def ==(o)
|
298
|
+
return true if self.equal?(o)
|
299
|
+
self.class == o.class &&
|
300
|
+
account_id == o.account_id &&
|
301
|
+
brand_id == o.brand_id &&
|
302
|
+
first_name == o.first_name &&
|
303
|
+
last_name == o.last_name &&
|
304
|
+
display_name == o.display_name &&
|
305
|
+
company_name == o.company_name &&
|
306
|
+
phone == o.phone &&
|
307
|
+
email == o.email &&
|
308
|
+
website == o.website &&
|
309
|
+
optional_attributes == o.optional_attributes &&
|
310
|
+
evp_vetting_score == o.evp_vetting_score
|
311
|
+
end
|
312
|
+
|
313
|
+
# @see the `==` method
|
314
|
+
# @param [Object] Object to be compared
|
315
|
+
def eql?(o)
|
316
|
+
self == o
|
317
|
+
end
|
318
|
+
|
319
|
+
# Calculates hash code according to all attributes.
|
320
|
+
# @return [Integer] Hash code
|
321
|
+
def hash
|
322
|
+
[account_id, brand_id, first_name, last_name, display_name, company_name, phone, email, website, optional_attributes, evp_vetting_score].hash
|
323
|
+
end
|
324
|
+
|
325
|
+
# Builds the object from hash
|
326
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
327
|
+
# @return [Object] Returns the model itself
|
328
|
+
def self.build_from_hash(attributes)
|
329
|
+
new.build_from_hash(attributes)
|
330
|
+
end
|
331
|
+
|
332
|
+
# Builds the object from hash
|
333
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
334
|
+
# @return [Object] Returns the model itself
|
335
|
+
def build_from_hash(attributes)
|
336
|
+
return nil unless attributes.is_a?(Hash)
|
337
|
+
self.class.openapi_types.each_pair do |key, type|
|
338
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
339
|
+
self.send("#{key}=", nil)
|
340
|
+
elsif type =~ /\AArray<(.*)>/i
|
341
|
+
# check to ensure the input is an array given that the attribute
|
342
|
+
# is documented as an array but the input is not
|
343
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
344
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
345
|
+
end
|
346
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
347
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
self
|
352
|
+
end
|
353
|
+
|
354
|
+
# Deserializes the data based on type
|
355
|
+
# @param string type Data type
|
356
|
+
# @param string value Value to be deserialized
|
357
|
+
# @return [Object] Deserialized data
|
358
|
+
def _deserialize(type, value)
|
359
|
+
case type.to_sym
|
360
|
+
when :Time
|
361
|
+
Time.parse(value)
|
362
|
+
when :Date
|
363
|
+
Date.parse(value)
|
364
|
+
when :String
|
365
|
+
value.to_s
|
366
|
+
when :Integer
|
367
|
+
value.to_i
|
368
|
+
when :Float
|
369
|
+
value.to_f
|
370
|
+
when :Boolean
|
371
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
372
|
+
true
|
373
|
+
else
|
374
|
+
false
|
375
|
+
end
|
376
|
+
when :Object
|
377
|
+
# generic object (usually a Hash), return directly
|
378
|
+
value
|
379
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
380
|
+
inner_type = Regexp.last_match[:inner_type]
|
381
|
+
value.map { |v| _deserialize(inner_type, v) }
|
382
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
383
|
+
k_type = Regexp.last_match[:k_type]
|
384
|
+
v_type = Regexp.last_match[:v_type]
|
385
|
+
{}.tap do |hash|
|
386
|
+
value.each do |k, v|
|
387
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
else # model
|
391
|
+
# models (e.g. Pet) or oneOf
|
392
|
+
klass = Freeclimb.const_get(type)
|
393
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
# Returns the string representation of the object
|
398
|
+
# @return [String] String presentation of the object
|
399
|
+
def to_s
|
400
|
+
to_hash.to_s
|
401
|
+
end
|
402
|
+
|
403
|
+
# to_body is an alias to to_hash (backward compatibility)
|
404
|
+
# @return [Hash] Returns the object in the form of hash
|
405
|
+
def to_body
|
406
|
+
to_hash
|
407
|
+
end
|
408
|
+
|
409
|
+
# Returns the object in the form of hash
|
410
|
+
# @return [Hash] Returns the object in the form of hash
|
411
|
+
def to_hash
|
412
|
+
hash = {}
|
413
|
+
self.class.attribute_map.each_pair do |attr, param|
|
414
|
+
value = self.send(attr)
|
415
|
+
if value.nil?
|
416
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
417
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
418
|
+
end
|
419
|
+
|
420
|
+
hash[param] = _to_hash(value)
|
421
|
+
end
|
422
|
+
hash
|
423
|
+
end
|
424
|
+
|
425
|
+
# Outputs non-array value in the form of hash
|
426
|
+
# For object, use to_hash. Otherwise, just return the value
|
427
|
+
# @param [Object] value Any valid value
|
428
|
+
# @return [Hash] Returns the value in the form of hash
|
429
|
+
def _to_hash(value)
|
430
|
+
if value.is_a?(Array)
|
431
|
+
value.compact.map { |v| _to_hash(v) }
|
432
|
+
elsif value.is_a?(Hash)
|
433
|
+
{}.tap do |hash|
|
434
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
435
|
+
end
|
436
|
+
elsif value.respond_to? :to_hash
|
437
|
+
value.to_hash
|
438
|
+
else
|
439
|
+
value
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
end
|
444
|
+
|
445
|
+
end
|