freeclimb 4.5.2 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +13 -6
  5. data/docs/AddToConference.md +0 -2
  6. data/docs/AddToConferenceAllOf.md +0 -2
  7. data/docs/CreateWebRTCToken.md +22 -0
  8. data/docs/DefaultApi.md +302 -7
  9. data/docs/GetDigits.md +1 -1
  10. data/docs/GetDigitsAllOf.md +1 -1
  11. data/docs/IncomingNumberResult.md +3 -1
  12. data/docs/IncomingNumberResultAllOf.md +3 -1
  13. data/docs/MessageRequest.md +2 -2
  14. data/docs/MessageRequestAllOf.md +2 -2
  15. data/docs/MessageResult.md +3 -1
  16. data/docs/MessageResultAllOf.md +3 -1
  17. data/docs/Play.md +0 -2
  18. data/docs/PlayAllOf.md +0 -2
  19. data/docs/RemoveFromConference.md +1 -4
  20. data/docs/SMSTenDLCCampaign.md +10 -0
  21. data/docs/SMSTollFreeCampaign.md +30 -0
  22. data/docs/SMSTollFreeCampaignsListResult.md +32 -0
  23. data/docs/SMSTollFreeCampaignsListResultAllOf.md +18 -0
  24. data/docs/Say.md +0 -2
  25. data/docs/SayAllOf.md +0 -2
  26. data/docs/SetListen.md +0 -2
  27. data/docs/SetListenAllOf.md +0 -2
  28. data/docs/SetTalk.md +0 -2
  29. data/docs/SetTalkAllOf.md +0 -2
  30. data/docs/TFN.md +18 -0
  31. data/docs/TerminateConference.md +1 -4
  32. data/lib/freeclimb/api/default_api.rb +258 -7
  33. data/lib/freeclimb/models/add_to_conference.rb +1 -13
  34. data/lib/freeclimb/models/add_to_conference_all_of.rb +1 -13
  35. data/lib/freeclimb/models/create_web_rtc_token.rb +278 -0
  36. data/lib/freeclimb/models/get_digits.rb +1 -1
  37. data/lib/freeclimb/models/get_digits_all_of.rb +1 -1
  38. data/lib/freeclimb/models/incoming_number_result.rb +16 -5
  39. data/lib/freeclimb/models/incoming_number_result_all_of.rb +16 -5
  40. data/lib/freeclimb/models/message_request.rb +11 -9
  41. data/lib/freeclimb/models/message_request_all_of.rb +11 -9
  42. data/lib/freeclimb/models/message_result.rb +19 -5
  43. data/lib/freeclimb/models/message_result_all_of.rb +19 -5
  44. data/lib/freeclimb/models/play.rb +1 -13
  45. data/lib/freeclimb/models/play_all_of.rb +1 -13
  46. data/lib/freeclimb/models/remove_from_conference.rb +3 -23
  47. data/lib/freeclimb/models/say.rb +1 -13
  48. data/lib/freeclimb/models/say_all_of.rb +1 -13
  49. data/lib/freeclimb/models/set_listen.rb +2 -18
  50. data/lib/freeclimb/models/set_listen_all_of.rb +2 -18
  51. data/lib/freeclimb/models/set_talk.rb +2 -18
  52. data/lib/freeclimb/models/set_talk_all_of.rb +2 -18
  53. data/lib/freeclimb/models/sms_ten_dlc_campaign.rb +131 -1
  54. data/lib/freeclimb/models/sms_toll_free_campaign.rb +349 -0
  55. data/lib/freeclimb/models/sms_toll_free_campaigns_list_result.rb +311 -0
  56. data/lib/freeclimb/models/sms_toll_free_campaigns_list_result_all_of.rb +226 -0
  57. data/lib/freeclimb/models/terminate_conference.rb +3 -23
  58. data/lib/freeclimb/models/tfn.rb +229 -0
  59. data/lib/freeclimb/version.rb +1 -1
  60. data/lib/freeclimb.rb +5 -2
  61. data/openapi.json +605 -110
  62. data/package.json +8 -0
  63. data/spec/api/default_api_spec.rb +104 -3
  64. data/spec/models/add_to_conference_spec.rb +0 -30
  65. data/spec/models/create_web_rtc_token_spec.rb +225 -0
  66. data/spec/models/get_digits_spec.rb +19 -19
  67. data/spec/models/incoming_number_result_spec.rb +25 -0
  68. data/spec/models/message_request_spec.rb +23 -23
  69. data/spec/models/message_result_spec.rb +30 -0
  70. data/spec/models/play_spec.rb +0 -30
  71. data/spec/models/remove_from_conference_spec.rb +1 -67
  72. data/spec/models/say_spec.rb +0 -30
  73. data/spec/models/set_listen_spec.rb +0 -31
  74. data/spec/models/set_talk_spec.rb +0 -31
  75. data/spec/models/sms_ten_dlc_campaign_spec.rb +165 -0
  76. data/spec/models/sms_toll_free_campaign_spec.rb +368 -0
  77. data/spec/models/sms_toll_free_campaigns_list_result_spec.rb +371 -0
  78. data/spec/models/terminate_conference_spec.rb +1 -67
  79. data/spec/models/tfn_spec.rb +162 -0
  80. data/yarn.lock +1292 -0
  81. metadata +103 -83
@@ -98,6 +98,21 @@ module Freeclimb
98
98
  # Help message of the campaign.
99
99
  attr_accessor :help_message
100
100
 
101
+ # Subscriber opt-in keywords. Multiple keywords are comma separated without space.
102
+ attr_accessor :optin_keywords
103
+
104
+ # Subscriber opt-out keywords. Multiple keywords are comma separated without space.
105
+ attr_accessor :optout_keywords
106
+
107
+ # Subscriber help keywords. Multiple keywords are comma separated without space.
108
+ attr_accessor :help_keywords
109
+
110
+ # Subscriber opt-in message.
111
+ attr_accessor :optin_message
112
+
113
+ # Subscriber opt-out message.
114
+ attr_accessor :optout_message
115
+
101
116
  # Caller supplied campaign reference ID. If supplied, the value must be unique across all submitted campaigns. Can be used to prevent duplicate campaign registrations.
102
117
  attr_accessor :reference_id
103
118
 
@@ -160,6 +175,11 @@ module Freeclimb
160
175
  :'sample5' => :'sample5',
161
176
  :'message_flow' => :'messageFlow',
162
177
  :'help_message' => :'helpMessage',
178
+ :'optin_keywords' => :'optinKeywords',
179
+ :'optout_keywords' => :'optoutKeywords',
180
+ :'help_keywords' => :'helpKeywords',
181
+ :'optin_message' => :'optinMessage',
182
+ :'optout_message' => :'optoutMessage',
163
183
  :'reference_id' => :'referenceId',
164
184
  :'mock' => :'mock',
165
185
  :'next_renewal_or_expiration_date' => :'nextRenewalOrExpirationDate'
@@ -202,6 +222,11 @@ module Freeclimb
202
222
  :'sample5' => :'String',
203
223
  :'message_flow' => :'String',
204
224
  :'help_message' => :'String',
225
+ :'optin_keywords' => :'String',
226
+ :'optout_keywords' => :'String',
227
+ :'help_keywords' => :'String',
228
+ :'optin_message' => :'String',
229
+ :'optout_message' => :'String',
205
230
  :'reference_id' => :'String',
206
231
  :'mock' => :'Boolean',
207
232
  :'next_renewal_or_expiration_date' => :'Date'
@@ -366,6 +391,26 @@ module Freeclimb
366
391
  self.help_message = attributes[:'help_message']
367
392
  end
368
393
 
394
+ if attributes.key?(:'optin_keywords')
395
+ self.optin_keywords = attributes[:'optin_keywords']
396
+ end
397
+
398
+ if attributes.key?(:'optout_keywords')
399
+ self.optout_keywords = attributes[:'optout_keywords']
400
+ end
401
+
402
+ if attributes.key?(:'help_keywords')
403
+ self.help_keywords = attributes[:'help_keywords']
404
+ end
405
+
406
+ if attributes.key?(:'optin_message')
407
+ self.optin_message = attributes[:'optin_message']
408
+ end
409
+
410
+ if attributes.key?(:'optout_message')
411
+ self.optout_message = attributes[:'optout_message']
412
+ end
413
+
369
414
  if attributes.key?(:'reference_id')
370
415
  self.reference_id = attributes[:'reference_id']
371
416
  end
@@ -451,6 +496,26 @@ module Freeclimb
451
496
  invalid_properties.push('invalid value for "help_message", the character length must be smaller than or equal to 255.')
452
497
  end
453
498
 
499
+ if !@optin_keywords.nil? && @optin_keywords.to_s.length > 255
500
+ invalid_properties.push('invalid value for "optin_keywords", the character length must be smaller than or equal to 255.')
501
+ end
502
+
503
+ if !@optout_keywords.nil? && @optout_keywords.to_s.length > 255
504
+ invalid_properties.push('invalid value for "optout_keywords", the character length must be smaller than or equal to 255.')
505
+ end
506
+
507
+ if !@help_keywords.nil? && @help_keywords.to_s.length > 255
508
+ invalid_properties.push('invalid value for "help_keywords", the character length must be smaller than or equal to 255.')
509
+ end
510
+
511
+ if !@optin_message.nil? && @optin_message.to_s.length > 255
512
+ invalid_properties.push('invalid value for "optin_message", the character length must be smaller than or equal to 255.')
513
+ end
514
+
515
+ if !@optout_message.nil? && @optout_message.to_s.length > 255
516
+ invalid_properties.push('invalid value for "optout_message", the character length must be smaller than or equal to 255.')
517
+ end
518
+
454
519
  if !@reference_id.nil? && @reference_id.to_s.length > 50
455
520
  invalid_properties.push('invalid value for "reference_id", the character length must be smaller than or equal to 50.')
456
521
  end
@@ -506,6 +571,16 @@ module Freeclimb
506
571
  false
507
572
  elsif @sample1.nil?
508
573
  false
574
+ elsif @optin_keywords.nil?
575
+ false
576
+ elsif @optout_keywords.nil?
577
+ false
578
+ elsif @help_keywords.nil?
579
+ false
580
+ elsif @optin_message.nil?
581
+ false
582
+ elsif @optout_message.nil?
583
+ false
509
584
  elsif @mock.nil?
510
585
  false
511
586
  else
@@ -655,6 +730,56 @@ module Freeclimb
655
730
  @help_message = help_message
656
731
  end
657
732
 
733
+ # Custom attribute writer method with validation
734
+ # @param [Object] optin_keywords Value to be assigned
735
+ def optin_keywords=(optin_keywords)
736
+ if !optin_keywords.nil? && optin_keywords.to_s.length > 255
737
+ fail ArgumentError, 'invalid value for "optin_keywords", the character length must be smaller than or equal to 255.'
738
+ end
739
+
740
+ @optin_keywords = optin_keywords
741
+ end
742
+
743
+ # Custom attribute writer method with validation
744
+ # @param [Object] optout_keywords Value to be assigned
745
+ def optout_keywords=(optout_keywords)
746
+ if !optout_keywords.nil? && optout_keywords.to_s.length > 255
747
+ fail ArgumentError, 'invalid value for "optout_keywords", the character length must be smaller than or equal to 255.'
748
+ end
749
+
750
+ @optout_keywords = optout_keywords
751
+ end
752
+
753
+ # Custom attribute writer method with validation
754
+ # @param [Object] help_keywords Value to be assigned
755
+ def help_keywords=(help_keywords)
756
+ if !help_keywords.nil? && help_keywords.to_s.length > 255
757
+ fail ArgumentError, 'invalid value for "help_keywords", the character length must be smaller than or equal to 255.'
758
+ end
759
+
760
+ @help_keywords = help_keywords
761
+ end
762
+
763
+ # Custom attribute writer method with validation
764
+ # @param [Object] optin_message Value to be assigned
765
+ def optin_message=(optin_message)
766
+ if !optin_message.nil? && optin_message.to_s.length > 255
767
+ fail ArgumentError, 'invalid value for "optin_message", the character length must be smaller than or equal to 255.'
768
+ end
769
+
770
+ @optin_message = optin_message
771
+ end
772
+
773
+ # Custom attribute writer method with validation
774
+ # @param [Object] optout_message Value to be assigned
775
+ def optout_message=(optout_message)
776
+ if !optout_message.nil? && optout_message.to_s.length > 255
777
+ fail ArgumentError, 'invalid value for "optout_message", the character length must be smaller than or equal to 255.'
778
+ end
779
+
780
+ @optout_message = optout_message
781
+ end
782
+
658
783
  # Custom attribute writer method with validation
659
784
  # @param [Object] reference_id Value to be assigned
660
785
  def reference_id=(reference_id)
@@ -698,6 +823,11 @@ module Freeclimb
698
823
  sample5 == o.sample5 &&
699
824
  message_flow == o.message_flow &&
700
825
  help_message == o.help_message &&
826
+ optin_keywords == o.optin_keywords &&
827
+ optout_keywords == o.optout_keywords &&
828
+ help_keywords == o.help_keywords &&
829
+ optin_message == o.optin_message &&
830
+ optout_message == o.optout_message &&
701
831
  reference_id == o.reference_id &&
702
832
  mock == o.mock &&
703
833
  next_renewal_or_expiration_date == o.next_renewal_or_expiration_date
@@ -712,7 +842,7 @@ module Freeclimb
712
842
  # Calculates hash code according to all attributes.
713
843
  # @return [Integer] Hash code
714
844
  def hash
715
- [account_id, campaign_id, csp_id, reseller_id, status, create_date, auto_renewal, billed_date, brand_id, usecase, sub_usecases, description, embedded_link, embedded_phone, affiliate_marketing, number_pool, age_gated, direct_lending, subscriber_optin, subscriber_optout, subscriber_help, sample1, sample2, sample3, sample4, sample5, message_flow, help_message, reference_id, mock, next_renewal_or_expiration_date].hash
845
+ [account_id, campaign_id, csp_id, reseller_id, status, create_date, auto_renewal, billed_date, brand_id, usecase, sub_usecases, description, embedded_link, embedded_phone, affiliate_marketing, number_pool, age_gated, direct_lending, subscriber_optin, subscriber_optout, subscriber_help, sample1, sample2, sample3, sample4, sample5, message_flow, help_message, optin_keywords, optout_keywords, help_keywords, optin_message, optout_message, reference_id, mock, next_renewal_or_expiration_date].hash
716
846
  end
717
847
 
718
848
  # Builds the object from hash
@@ -0,0 +1,349 @@
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 SMSTollFreeCampaign
18
+ # ID of the account that created this toll-free campaign
19
+ attr_accessor :account_id
20
+
21
+ # Alphanumeric identifier used by the platform to identify this toll-free campaign
22
+ attr_accessor :campaign_id
23
+
24
+ attr_accessor :use_case
25
+
26
+ # Current toll-free campaign registration status.Possible values: UNREGISTERED,INITIATED,PENDING,DECLINED,REGISTERED. A newly created campaign defaults to INITIATED status.
27
+ attr_accessor :registration_status
28
+
29
+ attr_accessor :date_created
30
+
31
+ attr_accessor :date_updated
32
+
33
+ attr_accessor :revision
34
+
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype
37
+ attr_reader :allowable_values
38
+
39
+ def initialize(datatype, allowable_values)
40
+ @allowable_values = allowable_values.map do |value|
41
+ case datatype.to_s
42
+ when /Integer/i
43
+ value.to_i
44
+ when /Float/i
45
+ value.to_f
46
+ else
47
+ value
48
+ end
49
+ end
50
+ end
51
+
52
+ def valid?(value)
53
+ !value || allowable_values.include?(value)
54
+ end
55
+ end
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'account_id' => :'accountId',
61
+ :'campaign_id' => :'campaignId',
62
+ :'use_case' => :'useCase',
63
+ :'registration_status' => :'registrationStatus',
64
+ :'date_created' => :'dateCreated',
65
+ :'date_updated' => :'dateUpdated',
66
+ :'revision' => :'revision'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'account_id' => :'String',
79
+ :'campaign_id' => :'String',
80
+ :'use_case' => :'String',
81
+ :'registration_status' => :'String',
82
+ :'date_created' => :'String',
83
+ :'date_updated' => :'String',
84
+ :'revision' => :'Integer'
85
+ }
86
+ end
87
+
88
+ # List of attributes with nullable: true
89
+ def self.openapi_nullable
90
+ Set.new([
91
+ :'account_id',
92
+ ])
93
+ end
94
+
95
+ # Initializes the object
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ def initialize(attributes = {})
98
+ if (!attributes.is_a?(Hash))
99
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::SMSTollFreeCampaign` initialize method"
100
+ end
101
+
102
+ # check to see if the attribute exists and convert string to symbol for hash key
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!self.class.attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::SMSTollFreeCampaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'account_id')
111
+ self.account_id = attributes[:'account_id']
112
+ end
113
+
114
+ if attributes.key?(:'campaign_id')
115
+ self.campaign_id = attributes[:'campaign_id']
116
+ end
117
+
118
+ if attributes.key?(:'use_case')
119
+ self.use_case = attributes[:'use_case']
120
+ end
121
+
122
+ if attributes.key?(:'registration_status')
123
+ self.registration_status = attributes[:'registration_status']
124
+ end
125
+
126
+ if attributes.key?(:'date_created')
127
+ self.date_created = attributes[:'date_created']
128
+ end
129
+
130
+ if attributes.key?(:'date_updated')
131
+ self.date_updated = attributes[:'date_updated']
132
+ end
133
+
134
+ if attributes.key?(:'revision')
135
+ self.revision = attributes[:'revision']
136
+ end
137
+ end
138
+
139
+ # Show invalid properties with the reasons. Usually used together with valid?
140
+ # @return Array for valid properties with the reasons
141
+ def list_invalid_properties
142
+ invalid_properties = Array.new
143
+ if @campaign_id.nil?
144
+ invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
145
+ end
146
+
147
+ if @use_case.nil?
148
+ invalid_properties.push('invalid value for "use_case", use_case cannot be nil.')
149
+ end
150
+
151
+ if @registration_status.nil?
152
+ invalid_properties.push('invalid value for "registration_status", registration_status cannot be nil.')
153
+ end
154
+
155
+ if @date_created.nil?
156
+ invalid_properties.push('invalid value for "date_created", date_created cannot be nil.')
157
+ end
158
+
159
+ if @date_updated.nil?
160
+ invalid_properties.push('invalid value for "date_updated", date_updated cannot be nil.')
161
+ end
162
+
163
+ if @revision.nil?
164
+ invalid_properties.push('invalid value for "revision", revision cannot be nil.')
165
+ end
166
+
167
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+
174
+ if @account_id.nil?
175
+ false
176
+ elsif @campaign_id.nil?
177
+ false
178
+ elsif @use_case.nil?
179
+ false
180
+ elsif @registration_status.nil?
181
+ false
182
+ elsif @date_created.nil?
183
+ false
184
+ elsif @date_updated.nil?
185
+ false
186
+ elsif @revision.nil?
187
+ false
188
+ else
189
+ list_invalid_properties.length() == 0
190
+ end
191
+ end
192
+
193
+ # Custom attribute writer method checking allowed values (enum).
194
+ # @param [Object] registration_status Object to be assigned
195
+ def registration_status=(registration_status)
196
+ validator = EnumAttributeValidator.new('String', ["UNREGISTERED", "INITIATED", "PENDING", "DECLINED", "REGISTERED"])
197
+ unless validator.valid?(registration_status)
198
+ fail ArgumentError, "invalid value for \"registration_status\", must be one of #{validator.allowable_values}."
199
+ end
200
+ @registration_status = registration_status
201
+ end
202
+
203
+ # Checks equality by comparing each attribute.
204
+ # @param [Object] Object to be compared
205
+ def ==(o)
206
+ return true if self.equal?(o)
207
+ self.class == o.class &&
208
+ account_id == o.account_id &&
209
+ campaign_id == o.campaign_id &&
210
+ use_case == o.use_case &&
211
+ registration_status == o.registration_status &&
212
+ date_created == o.date_created &&
213
+ date_updated == o.date_updated &&
214
+ revision == o.revision
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [account_id, campaign_id, use_case, registration_status, date_created, date_updated, revision].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ new.build_from_hash(attributes)
234
+ end
235
+
236
+ # Builds the object from hash
237
+ # @param [Hash] attributes Model attributes in the form of hash
238
+ # @return [Object] Returns the model itself
239
+ def build_from_hash(attributes)
240
+ return nil unless attributes.is_a?(Hash)
241
+ self.class.openapi_types.each_pair do |key, type|
242
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
243
+ self.send("#{key}=", nil)
244
+ elsif type =~ /\AArray<(.*)>/i
245
+ # check to ensure the input is an array given that the attribute
246
+ # is documented as an array but the input is not
247
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
248
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
249
+ end
250
+ elsif !attributes[self.class.attribute_map[key]].nil?
251
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
252
+ end
253
+ end
254
+
255
+ self
256
+ end
257
+
258
+ # Deserializes the data based on type
259
+ # @param string type Data type
260
+ # @param string value Value to be deserialized
261
+ # @return [Object] Deserialized data
262
+ def _deserialize(type, value)
263
+ case type.to_sym
264
+ when :Time
265
+ Time.parse(value)
266
+ when :Date
267
+ Date.parse(value)
268
+ when :String
269
+ value.to_s
270
+ when :Integer
271
+ value.to_i
272
+ when :Float
273
+ value.to_f
274
+ when :Boolean
275
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
276
+ true
277
+ else
278
+ false
279
+ end
280
+ when :Object
281
+ # generic object (usually a Hash), return directly
282
+ value
283
+ when /\AArray<(?<inner_type>.+)>\z/
284
+ inner_type = Regexp.last_match[:inner_type]
285
+ value.map { |v| _deserialize(inner_type, v) }
286
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
287
+ k_type = Regexp.last_match[:k_type]
288
+ v_type = Regexp.last_match[:v_type]
289
+ {}.tap do |hash|
290
+ value.each do |k, v|
291
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
292
+ end
293
+ end
294
+ else # model
295
+ # models (e.g. Pet) or oneOf
296
+ klass = Freeclimb.const_get(type)
297
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
298
+ end
299
+ end
300
+
301
+ # Returns the string representation of the object
302
+ # @return [String] String presentation of the object
303
+ def to_s
304
+ to_hash.to_s
305
+ end
306
+
307
+ # to_body is an alias to to_hash (backward compatibility)
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_body
310
+ to_hash
311
+ end
312
+
313
+ # Returns the object in the form of hash
314
+ # @return [Hash] Returns the object in the form of hash
315
+ def to_hash
316
+ hash = {}
317
+ self.class.attribute_map.each_pair do |attr, param|
318
+ value = self.send(attr)
319
+ if value.nil?
320
+ is_nullable = self.class.openapi_nullable.include?(attr)
321
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
322
+ end
323
+
324
+ hash[param] = _to_hash(value)
325
+ end
326
+ hash
327
+ end
328
+
329
+ # Outputs non-array value in the form of hash
330
+ # For object, use to_hash. Otherwise, just return the value
331
+ # @param [Object] value Any valid value
332
+ # @return [Hash] Returns the value in the form of hash
333
+ def _to_hash(value)
334
+ if value.is_a?(Array)
335
+ value.compact.map { |v| _to_hash(v) }
336
+ elsif value.is_a?(Hash)
337
+ {}.tap do |hash|
338
+ value.each { |k, v| hash[k] = _to_hash(v) }
339
+ end
340
+ elsif value.respond_to? :to_hash
341
+ value.to_hash
342
+ else
343
+ value
344
+ end
345
+ end
346
+
347
+ end
348
+
349
+ end