bombbomb 2.0.831 → 2.0.20679

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +13 -5
  2. data/README.md +31 -147
  3. data/Rakefile +3 -8
  4. data/bombbomb.gemspec +17 -8
  5. data/docs/InlineResponse200.md +1 -1
  6. data/docs/JerichoConfiguration.md +1 -7
  7. data/docs/JerichoPerformance.md +0 -4
  8. data/docs/PromptsApi.md +6 -712
  9. data/docs/TeamsApi.md +62 -1144
  10. data/docs/UtilitiesApi.md +4 -4
  11. data/docs/VideoEmailPrompt.md +10 -24
  12. data/docs/WebhooksApi.md +4 -45
  13. data/git_push.sh +13 -1
  14. data/lib/bombbomb.rb +14 -30
  15. data/lib/bombbomb/api/prompts_api.rb +42 -833
  16. data/lib/bombbomb/api/teams_api.rb +157 -1331
  17. data/lib/bombbomb/api/utilities_api.rb +44 -23
  18. data/lib/bombbomb/api/webhooks_api.rb +43 -68
  19. data/lib/bombbomb/api_client.rb +45 -55
  20. data/lib/bombbomb/api_error.rb +18 -9
  21. data/lib/bombbomb/configuration.rb +13 -8
  22. data/lib/bombbomb/models/bb_web_hook.rb +17 -6
  23. data/lib/bombbomb/models/inline_response_200.rb +18 -7
  24. data/lib/bombbomb/models/inline_response_200_items.rb +1 -1
  25. data/lib/bombbomb/models/jericho_configuration.rb +22 -75
  26. data/lib/bombbomb/models/jericho_performance.rb +21 -50
  27. data/lib/bombbomb/models/o_auth_client.rb +17 -6
  28. data/lib/bombbomb/models/string.rb +17 -6
  29. data/lib/bombbomb/models/video_email_prompt.rb +90 -214
  30. data/lib/bombbomb/version.rb +14 -3
  31. data/spec/models/{team_public_representation_spec.rb → inline_response_200_items_spec.rb} +14 -8
  32. metadata +56 -168
  33. data/Gemfile +0 -7
  34. data/docs/AccountsApi.md +0 -384
  35. data/docs/AutomationsApi.md +0 -167
  36. data/docs/ClientGroupAssetMetaData.md +0 -11
  37. data/docs/ContactsApi.md +0 -436
  38. data/docs/Curriculum.md +0 -15
  39. data/docs/CurriculumApi.md +0 -109
  40. data/docs/CurriculumUserProgress.md +0 -12
  41. data/docs/CurriculumWithProgress.md +0 -15
  42. data/docs/EmailsApi.md +0 -633
  43. data/docs/FilesApi.md +0 -272
  44. data/docs/FormsApi.md +0 -60
  45. data/docs/HostedDoc.md +0 -13
  46. data/docs/IntegrationsApi.md +0 -285
  47. data/docs/ListsApi.md +0 -265
  48. data/docs/OrdersApi.md +0 -60
  49. data/docs/PromptBot.md +0 -22
  50. data/docs/PromptBotBot.md +0 -18
  51. data/docs/PromptMonthlyPerformance.md +0 -11
  52. data/docs/PromptOverview.md +0 -11
  53. data/docs/PromptSocialPrompt.md +0 -20
  54. data/docs/SignUploadRequest.md +0 -9
  55. data/docs/SignUploadResponse.md +0 -9
  56. data/docs/SocialsApi.md +0 -653
  57. data/docs/TeamPublicRepresentation.md +0 -10
  58. data/docs/UsersApi.md +0 -100
  59. data/docs/VideoEncodingStatusResponse.md +0 -10
  60. data/docs/VideoPublicRepresentation.md +0 -18
  61. data/docs/VideoRecorderMethodResponse.md +0 -15
  62. data/docs/VideosApi.md +0 -287
  63. data/lib/bombbomb/api/accounts_api.rb +0 -432
  64. data/lib/bombbomb/api/automations_api.rb +0 -191
  65. data/lib/bombbomb/api/contacts_api.rb +0 -470
  66. data/lib/bombbomb/api/curriculum_api.rb +0 -124
  67. data/lib/bombbomb/api/emails_api.rb +0 -673
  68. data/lib/bombbomb/api/files_api.rb +0 -302
  69. data/lib/bombbomb/api/forms_api.rb +0 -77
  70. data/lib/bombbomb/api/integrations_api.rb +0 -308
  71. data/lib/bombbomb/api/lists_api.rb +0 -295
  72. data/lib/bombbomb/api/orders_api.rb +0 -78
  73. data/lib/bombbomb/api/socials_api.rb +0 -714
  74. data/lib/bombbomb/api/users_api.rb +0 -119
  75. data/lib/bombbomb/api/videos_api.rb +0 -326
  76. data/lib/bombbomb/models/client_group_asset_meta_data.rb +0 -215
  77. data/lib/bombbomb/models/curriculum.rb +0 -261
  78. data/lib/bombbomb/models/curriculum_user_progress.rb +0 -229
  79. data/lib/bombbomb/models/curriculum_with_progress.rb +0 -261
  80. data/lib/bombbomb/models/hosted_doc.rb +0 -239
  81. data/lib/bombbomb/models/prompt_bot.rb +0 -329
  82. data/lib/bombbomb/models/prompt_bot_bot.rb +0 -300
  83. data/lib/bombbomb/models/prompt_monthly_performance.rb +0 -219
  84. data/lib/bombbomb/models/prompt_overview.rb +0 -219
  85. data/lib/bombbomb/models/prompt_social_prompt.rb +0 -311
  86. data/lib/bombbomb/models/sign_upload_request.rb +0 -199
  87. data/lib/bombbomb/models/sign_upload_response.rb +0 -199
  88. data/lib/bombbomb/models/team_public_representation.rb +0 -209
  89. data/lib/bombbomb/models/video_encoding_status_response.rb +0 -209
  90. data/lib/bombbomb/models/video_public_representation.rb +0 -291
  91. data/lib/bombbomb/models/video_recorder_method_response.rb +0 -259
  92. data/spec/api/accounts_api_spec.rb +0 -96
  93. data/spec/api/automations_api_spec.rb +0 -71
  94. data/spec/api/contacts_api_spec.rb +0 -58
  95. data/spec/api/curriculum_api_spec.rb +0 -69
  96. data/spec/api/emails_api_spec.rb +0 -104
  97. data/spec/api/files_api_spec.rb +0 -58
  98. data/spec/api/forms_api_spec.rb +0 -58
  99. data/spec/api/integrations_api_spec.rb +0 -58
  100. data/spec/api/lists_api_spec.rb +0 -83
  101. data/spec/api/orders_api_spec.rb +0 -58
  102. data/spec/api/socials_api_spec.rb +0 -135
  103. data/spec/api/users_api_spec.rb +0 -57
  104. data/spec/api/videos_api_spec.rb +0 -86
  105. data/spec/models/client_group_asset_meta_data_spec.rb +0 -60
  106. data/spec/models/curriculum_spec.rb +0 -95
  107. data/spec/models/curriculum_user_progress_spec.rb +0 -77
  108. data/spec/models/curriculum_with_progress_spec.rb +0 -95
  109. data/spec/models/hosted_doc_spec.rb +0 -83
  110. data/spec/models/prompt_bot_spec.rb +0 -137
  111. data/spec/models/prompt_monthly_performance_spec.rb +0 -60
  112. data/spec/models/prompt_overview_spec.rb +0 -60
  113. data/spec/models/prompt_social_prompt_spec.rb +0 -125
  114. data/spec/models/sign_upload_request_spec.rb +0 -59
  115. data/spec/models/sign_upload_response_spec.rb +0 -59
  116. data/spec/models/video_encoding_status_response_spec.rb +0 -65
  117. data/spec/models/video_public_representation_spec.rb +0 -113
  118. data/spec/models/video_recorder_method_response_spec.rb +0 -95
@@ -1,329 +0,0 @@
1
- =begin
2
- #BombBomb
3
-
4
- #We make it easy to build relationships using simple videos.
5
-
6
- OpenAPI spec version: 2.0.831
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module BombBomb
16
- # The Prompt\\Bot class
17
- class PromptBot
18
- # The identifier of the prompt bot. Read Only.
19
- attr_accessor :id
20
-
21
- # The prompt bot's owner. Read Only.
22
- attr_accessor :user_id
23
-
24
- # The default email being sent to contacts in the prompt bot list.
25
- attr_accessor :email_id
26
-
27
- # The list to attach the Prompt Bot to.
28
- attr_accessor :list_id
29
-
30
- # The name of the bot.
31
- attr_accessor :name
32
-
33
- # The custom contact field value column used for this bot.
34
- attr_accessor :contact_field_value_column
35
-
36
- # The status of the prompt bot. Read Only.
37
- attr_accessor :status
38
-
39
- # when the bot started
40
- attr_accessor :start_date
41
-
42
- # when the bot should finish
43
- attr_accessor :end_date
44
-
45
- # The type of bot.
46
- attr_accessor :bot_type_id
47
-
48
- # The template id used to generate the default email.
49
- attr_accessor :template_id
50
-
51
- # The video that was added to the prompt.
52
- attr_accessor :video_id
53
-
54
- # The content to use in the email.
55
- attr_accessor :content
56
-
57
- # The subject of the default email.
58
- attr_accessor :subject
59
-
60
- # Set when generated as a default by a bot.
61
- attr_accessor :generated_by
62
-
63
-
64
- # Attribute mapping from ruby-style variable name to JSON key.
65
- def self.attribute_map
66
- {
67
- :'id' => :'id',
68
- :'user_id' => :'userId',
69
- :'email_id' => :'emailId',
70
- :'list_id' => :'listId',
71
- :'name' => :'name',
72
- :'contact_field_value_column' => :'contactFieldValueColumn',
73
- :'status' => :'status',
74
- :'start_date' => :'startDate',
75
- :'end_date' => :'endDate',
76
- :'bot_type_id' => :'botTypeId',
77
- :'template_id' => :'templateId',
78
- :'video_id' => :'videoId',
79
- :'content' => :'content',
80
- :'subject' => :'subject',
81
- :'generated_by' => :'generatedBy'
82
- }
83
- end
84
-
85
- # Attribute type mapping.
86
- def self.swagger_types
87
- {
88
- :'id' => :'String',
89
- :'user_id' => :'String',
90
- :'email_id' => :'String',
91
- :'list_id' => :'String',
92
- :'name' => :'String',
93
- :'contact_field_value_column' => :'String',
94
- :'status' => :'Integer',
95
- :'start_date' => :'DateTime',
96
- :'end_date' => :'DateTime',
97
- :'bot_type_id' => :'String',
98
- :'template_id' => :'String',
99
- :'video_id' => :'String',
100
- :'content' => :'String',
101
- :'subject' => :'String',
102
- :'generated_by' => :'String'
103
- }
104
- end
105
-
106
- # Initializes the object
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- def initialize(attributes = {})
109
- return unless attributes.is_a?(Hash)
110
-
111
- # convert string to symbol for hash key
112
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
113
-
114
- if attributes.has_key?(:'id')
115
- self.id = attributes[:'id']
116
- end
117
-
118
- if attributes.has_key?(:'userId')
119
- self.user_id = attributes[:'userId']
120
- end
121
-
122
- if attributes.has_key?(:'emailId')
123
- self.email_id = attributes[:'emailId']
124
- end
125
-
126
- if attributes.has_key?(:'listId')
127
- self.list_id = attributes[:'listId']
128
- end
129
-
130
- if attributes.has_key?(:'name')
131
- self.name = attributes[:'name']
132
- end
133
-
134
- if attributes.has_key?(:'contactFieldValueColumn')
135
- self.contact_field_value_column = attributes[:'contactFieldValueColumn']
136
- end
137
-
138
- if attributes.has_key?(:'status')
139
- self.status = attributes[:'status']
140
- end
141
-
142
- if attributes.has_key?(:'startDate')
143
- self.start_date = attributes[:'startDate']
144
- end
145
-
146
- if attributes.has_key?(:'endDate')
147
- self.end_date = attributes[:'endDate']
148
- end
149
-
150
- if attributes.has_key?(:'botTypeId')
151
- self.bot_type_id = attributes[:'botTypeId']
152
- end
153
-
154
- if attributes.has_key?(:'templateId')
155
- self.template_id = attributes[:'templateId']
156
- end
157
-
158
- if attributes.has_key?(:'videoId')
159
- self.video_id = attributes[:'videoId']
160
- end
161
-
162
- if attributes.has_key?(:'content')
163
- self.content = attributes[:'content']
164
- end
165
-
166
- if attributes.has_key?(:'subject')
167
- self.subject = attributes[:'subject']
168
- end
169
-
170
- if attributes.has_key?(:'generatedBy')
171
- self.generated_by = attributes[:'generatedBy']
172
- end
173
-
174
- end
175
-
176
- # Show invalid properties with the reasons. Usually used together with valid?
177
- # @return Array for valid properties with the reasons
178
- def list_invalid_properties
179
- invalid_properties = Array.new
180
- return invalid_properties
181
- end
182
-
183
- # Check to see if the all the properties in the model are valid
184
- # @return true if the model is valid
185
- def valid?
186
- return true
187
- end
188
-
189
- # Checks equality by comparing each attribute.
190
- # @param [Object] Object to be compared
191
- def ==(o)
192
- return true if self.equal?(o)
193
- self.class == o.class &&
194
- id == o.id &&
195
- user_id == o.user_id &&
196
- email_id == o.email_id &&
197
- list_id == o.list_id &&
198
- name == o.name &&
199
- contact_field_value_column == o.contact_field_value_column &&
200
- status == o.status &&
201
- start_date == o.start_date &&
202
- end_date == o.end_date &&
203
- bot_type_id == o.bot_type_id &&
204
- template_id == o.template_id &&
205
- video_id == o.video_id &&
206
- content == o.content &&
207
- subject == o.subject &&
208
- generated_by == o.generated_by
209
- end
210
-
211
- # @see the `==` method
212
- # @param [Object] Object to be compared
213
- def eql?(o)
214
- self == o
215
- end
216
-
217
- # Calculates hash code according to all attributes.
218
- # @return [Fixnum] Hash code
219
- def hash
220
- [id, user_id, email_id, list_id, name, contact_field_value_column, status, start_date, end_date, bot_type_id, template_id, video_id, content, subject, generated_by].hash
221
- end
222
-
223
- # Builds the object from hash
224
- # @param [Hash] attributes Model attributes in the form of hash
225
- # @return [Object] Returns the model itself
226
- def build_from_hash(attributes)
227
- return nil unless attributes.is_a?(Hash)
228
- self.class.swagger_types.each_pair do |key, type|
229
- if type =~ /\AArray<(.*)>/i
230
- # check to ensure the input is an array given that the the attribute
231
- # is documented as an array but the input is not
232
- if attributes[self.class.attribute_map[key]].is_a?(Array)
233
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
234
- end
235
- elsif !attributes[self.class.attribute_map[key]].nil?
236
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
- end # or else data not found in attributes(hash), not an issue as the data can be optional
238
- end
239
-
240
- self
241
- end
242
-
243
- # Deserializes the data based on type
244
- # @param string type Data type
245
- # @param string value Value to be deserialized
246
- # @return [Object] Deserialized data
247
- def _deserialize(type, value)
248
- case type.to_sym
249
- when :DateTime
250
- DateTime.parse(value)
251
- when :Date
252
- Date.parse(value)
253
- when :String
254
- value.to_s
255
- when :Integer
256
- value.to_i
257
- when :Float
258
- value.to_f
259
- when :BOOLEAN
260
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
261
- true
262
- else
263
- false
264
- end
265
- when :Object
266
- # generic object (usually a Hash), return directly
267
- value
268
- when /\AArray<(?<inner_type>.+)>\z/
269
- inner_type = Regexp.last_match[:inner_type]
270
- value.map { |v| _deserialize(inner_type, v) }
271
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
272
- k_type = Regexp.last_match[:k_type]
273
- v_type = Regexp.last_match[:v_type]
274
- {}.tap do |hash|
275
- value.each do |k, v|
276
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
- end
278
- end
279
- else # model
280
- temp_model = BombBomb.const_get(type).new
281
- temp_model.build_from_hash(value)
282
- end
283
- end
284
-
285
- # Returns the string representation of the object
286
- # @return [String] String presentation of the object
287
- def to_s
288
- to_hash.to_s
289
- end
290
-
291
- # to_body is an alias to to_hash (backward compatibility)
292
- # @return [Hash] Returns the object in the form of hash
293
- def to_body
294
- to_hash
295
- end
296
-
297
- # Returns the object in the form of hash
298
- # @return [Hash] Returns the object in the form of hash
299
- def to_hash
300
- hash = {}
301
- self.class.attribute_map.each_pair do |attr, param|
302
- value = self.send(attr)
303
- next if value.nil?
304
- hash[param] = _to_hash(value)
305
- end
306
- hash
307
- end
308
-
309
- # Outputs non-array value in the form of hash
310
- # For object, use to_hash. Otherwise, just return the value
311
- # @param [Object] value Any valid value
312
- # @return [Hash] Returns the value in the form of hash
313
- def _to_hash(value)
314
- if value.is_a?(Array)
315
- value.compact.map{ |v| _to_hash(v) }
316
- elsif value.is_a?(Hash)
317
- {}.tap do |hash|
318
- value.each { |k, v| hash[k] = _to_hash(v) }
319
- end
320
- elsif value.respond_to? :to_hash
321
- value.to_hash
322
- else
323
- value
324
- end
325
- end
326
-
327
- end
328
-
329
- end
@@ -1,300 +0,0 @@
1
- =begin
2
- #BombBomb
3
-
4
- #We make it easy to build relationships using simple videos.
5
-
6
- OpenAPI spec version: 2.0.22196
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
- Licensed under the Apache License, Version 2.0 (the "License");
11
- you may not use this file except in compliance with the License.
12
- You may obtain a copy of the License at
13
-
14
- http://www.apache.org/licenses/LICENSE-2.0
15
-
16
- Unless required by applicable law or agreed to in writing, software
17
- distributed under the License is distributed on an "AS IS" BASIS,
18
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- See the License for the specific language governing permissions and
20
- limitations under the License.
21
-
22
- =end
23
-
24
- require 'date'
25
-
26
- module BombBomb
27
- # The PromptBot\\Bot class
28
- class PromptBotBot
29
- # The identifier of the prompt bot. Read Only.
30
- attr_accessor :id
31
-
32
- # The prompt bot's owner. Read Only.
33
- attr_accessor :user_id
34
-
35
- # The default email being sent to contacts in the prompt bot list.
36
- attr_accessor :email_id
37
-
38
- # The list to attach the Prompt Bot to.
39
- attr_accessor :list_id
40
-
41
- # The prompt subject.
42
- attr_accessor :prompt_subject
43
-
44
- # The prompt body.
45
- attr_accessor :prompt_body
46
-
47
- # The status of the prompt bot. Read Only.
48
- attr_accessor :status
49
-
50
- # when the bot started
51
- attr_accessor :start_date
52
-
53
- # when the bot should finish
54
- attr_accessor :end_date
55
-
56
- # The type of bot.
57
- attr_accessor :bot_type_id
58
-
59
- # The template id used to generate the default email.
60
- attr_accessor :template_id
61
-
62
-
63
- # Attribute mapping from ruby-style variable name to JSON key.
64
- def self.attribute_map
65
- {
66
- :'id' => :'id',
67
- :'user_id' => :'userId',
68
- :'email_id' => :'emailId',
69
- :'list_id' => :'listId',
70
- :'prompt_subject' => :'promptSubject',
71
- :'prompt_body' => :'promptBody',
72
- :'status' => :'status',
73
- :'start_date' => :'startDate',
74
- :'end_date' => :'endDate',
75
- :'bot_type_id' => :'botTypeId',
76
- :'template_id' => :'templateId'
77
- }
78
- end
79
-
80
- # Attribute type mapping.
81
- def self.swagger_types
82
- {
83
- :'id' => :'String',
84
- :'user_id' => :'String',
85
- :'email_id' => :'String',
86
- :'list_id' => :'String',
87
- :'prompt_subject' => :'String',
88
- :'prompt_body' => :'String',
89
- :'status' => :'String',
90
- :'start_date' => :'DateTime',
91
- :'end_date' => :'DateTime',
92
- :'bot_type_id' => :'String',
93
- :'template_id' => :'String'
94
- }
95
- end
96
-
97
- # Initializes the object
98
- # @param [Hash] attributes Model attributes in the form of hash
99
- def initialize(attributes = {})
100
- return unless attributes.is_a?(Hash)
101
-
102
- # convert string to symbol for hash key
103
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
104
-
105
- if attributes.has_key?(:'id')
106
- self.id = attributes[:'id']
107
- end
108
-
109
- if attributes.has_key?(:'userId')
110
- self.user_id = attributes[:'userId']
111
- end
112
-
113
- if attributes.has_key?(:'emailId')
114
- self.email_id = attributes[:'emailId']
115
- end
116
-
117
- if attributes.has_key?(:'listId')
118
- self.list_id = attributes[:'listId']
119
- end
120
-
121
- if attributes.has_key?(:'promptSubject')
122
- self.prompt_subject = attributes[:'promptSubject']
123
- end
124
-
125
- if attributes.has_key?(:'promptBody')
126
- self.prompt_body = attributes[:'promptBody']
127
- end
128
-
129
- if attributes.has_key?(:'status')
130
- self.status = attributes[:'status']
131
- end
132
-
133
- if attributes.has_key?(:'startDate')
134
- self.start_date = attributes[:'startDate']
135
- end
136
-
137
- if attributes.has_key?(:'endDate')
138
- self.end_date = attributes[:'endDate']
139
- end
140
-
141
- if attributes.has_key?(:'botTypeId')
142
- self.bot_type_id = attributes[:'botTypeId']
143
- end
144
-
145
- if attributes.has_key?(:'templateId')
146
- self.template_id = attributes[:'templateId']
147
- end
148
-
149
- end
150
-
151
- # Show invalid properties with the reasons. Usually used together with valid?
152
- # @return Array for valid properies with the reasons
153
- def list_invalid_properties
154
- invalid_properties = Array.new
155
- return invalid_properties
156
- end
157
-
158
- # Check to see if the all the properties in the model are valid
159
- # @return true if the model is valid
160
- def valid?
161
- return true
162
- end
163
-
164
- # Checks equality by comparing each attribute.
165
- # @param [Object] Object to be compared
166
- def ==(o)
167
- return true if self.equal?(o)
168
- self.class == o.class &&
169
- id == o.id &&
170
- user_id == o.user_id &&
171
- email_id == o.email_id &&
172
- list_id == o.list_id &&
173
- prompt_subject == o.prompt_subject &&
174
- prompt_body == o.prompt_body &&
175
- status == o.status &&
176
- start_date == o.start_date &&
177
- end_date == o.end_date &&
178
- bot_type_id == o.bot_type_id &&
179
- template_id == o.template_id
180
- end
181
-
182
- # @see the `==` method
183
- # @param [Object] Object to be compared
184
- def eql?(o)
185
- self == o
186
- end
187
-
188
- # Calculates hash code according to all attributes.
189
- # @return [Fixnum] Hash code
190
- def hash
191
- [id, user_id, email_id, list_id, prompt_subject, prompt_body, status, start_date, end_date, bot_type_id, template_id].hash
192
- end
193
-
194
- # Builds the object from hash
195
- # @param [Hash] attributes Model attributes in the form of hash
196
- # @return [Object] Returns the model itself
197
- def build_from_hash(attributes)
198
- return nil unless attributes.is_a?(Hash)
199
- self.class.swagger_types.each_pair do |key, type|
200
- if type =~ /^Array<(.*)>/i
201
- # check to ensure the input is an array given that the the attribute
202
- # is documented as an array but the input is not
203
- if attributes[self.class.attribute_map[key]].is_a?(Array)
204
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
205
- end
206
- elsif !attributes[self.class.attribute_map[key]].nil?
207
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
208
- end # or else data not found in attributes(hash), not an issue as the data can be optional
209
- end
210
-
211
- self
212
- end
213
-
214
- # Deserializes the data based on type
215
- # @param string type Data type
216
- # @param string value Value to be deserialized
217
- # @return [Object] Deserialized data
218
- def _deserialize(type, value)
219
- case type.to_sym
220
- when :DateTime
221
- DateTime.parse(value)
222
- when :Date
223
- Date.parse(value)
224
- when :String
225
- value.to_s
226
- when :Integer
227
- value.to_i
228
- when :Float
229
- value.to_f
230
- when :BOOLEAN
231
- if value.to_s =~ /^(true|t|yes|y|1)$/i
232
- true
233
- else
234
- false
235
- end
236
- when :Object
237
- # generic object (usually a Hash), return directly
238
- value
239
- when /\AArray<(?<inner_type>.+)>\z/
240
- inner_type = Regexp.last_match[:inner_type]
241
- value.map { |v| _deserialize(inner_type, v) }
242
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
243
- k_type = Regexp.last_match[:k_type]
244
- v_type = Regexp.last_match[:v_type]
245
- {}.tap do |hash|
246
- value.each do |k, v|
247
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
- end
249
- end
250
- else # model
251
- temp_model = BombBomb.const_get(type).new
252
- temp_model.build_from_hash(value)
253
- end
254
- end
255
-
256
- # Returns the string representation of the object
257
- # @return [String] String presentation of the object
258
- def to_s
259
- to_hash.to_s
260
- end
261
-
262
- # to_body is an alias to to_hash (backward compatibility)
263
- # @return [Hash] Returns the object in the form of hash
264
- def to_body
265
- to_hash
266
- end
267
-
268
- # Returns the object in the form of hash
269
- # @return [Hash] Returns the object in the form of hash
270
- def to_hash
271
- hash = {}
272
- self.class.attribute_map.each_pair do |attr, param|
273
- value = self.send(attr)
274
- next if value.nil?
275
- hash[param] = _to_hash(value)
276
- end
277
- hash
278
- end
279
-
280
- # Outputs non-array value in the form of hash
281
- # For object, use to_hash. Otherwise, just return the value
282
- # @param [Object] value Any valid value
283
- # @return [Hash] Returns the value in the form of hash
284
- def _to_hash(value)
285
- if value.is_a?(Array)
286
- value.compact.map{ |v| _to_hash(v) }
287
- elsif value.is_a?(Hash)
288
- {}.tap do |hash|
289
- value.each { |k, v| hash[k] = _to_hash(v) }
290
- end
291
- elsif value.respond_to? :to_hash
292
- value.to_hash
293
- else
294
- value
295
- end
296
- end
297
-
298
- end
299
-
300
- end