bombbomb 2.0.831 → 2.0.20679
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +31 -147
- data/Rakefile +3 -8
- data/bombbomb.gemspec +17 -8
- data/docs/InlineResponse200.md +1 -1
- data/docs/JerichoConfiguration.md +1 -7
- data/docs/JerichoPerformance.md +0 -4
- data/docs/PromptsApi.md +6 -712
- data/docs/TeamsApi.md +62 -1144
- data/docs/UtilitiesApi.md +4 -4
- data/docs/VideoEmailPrompt.md +10 -24
- data/docs/WebhooksApi.md +4 -45
- data/git_push.sh +13 -1
- data/lib/bombbomb.rb +14 -30
- data/lib/bombbomb/api/prompts_api.rb +42 -833
- data/lib/bombbomb/api/teams_api.rb +157 -1331
- data/lib/bombbomb/api/utilities_api.rb +44 -23
- data/lib/bombbomb/api/webhooks_api.rb +43 -68
- data/lib/bombbomb/api_client.rb +45 -55
- data/lib/bombbomb/api_error.rb +18 -9
- data/lib/bombbomb/configuration.rb +13 -8
- data/lib/bombbomb/models/bb_web_hook.rb +17 -6
- data/lib/bombbomb/models/inline_response_200.rb +18 -7
- data/lib/bombbomb/models/inline_response_200_items.rb +1 -1
- data/lib/bombbomb/models/jericho_configuration.rb +22 -75
- data/lib/bombbomb/models/jericho_performance.rb +21 -50
- data/lib/bombbomb/models/o_auth_client.rb +17 -6
- data/lib/bombbomb/models/string.rb +17 -6
- data/lib/bombbomb/models/video_email_prompt.rb +90 -214
- data/lib/bombbomb/version.rb +14 -3
- data/spec/models/{team_public_representation_spec.rb → inline_response_200_items_spec.rb} +14 -8
- metadata +56 -168
- data/Gemfile +0 -7
- data/docs/AccountsApi.md +0 -384
- data/docs/AutomationsApi.md +0 -167
- data/docs/ClientGroupAssetMetaData.md +0 -11
- data/docs/ContactsApi.md +0 -436
- data/docs/Curriculum.md +0 -15
- data/docs/CurriculumApi.md +0 -109
- data/docs/CurriculumUserProgress.md +0 -12
- data/docs/CurriculumWithProgress.md +0 -15
- data/docs/EmailsApi.md +0 -633
- data/docs/FilesApi.md +0 -272
- data/docs/FormsApi.md +0 -60
- data/docs/HostedDoc.md +0 -13
- data/docs/IntegrationsApi.md +0 -285
- data/docs/ListsApi.md +0 -265
- data/docs/OrdersApi.md +0 -60
- data/docs/PromptBot.md +0 -22
- data/docs/PromptBotBot.md +0 -18
- data/docs/PromptMonthlyPerformance.md +0 -11
- data/docs/PromptOverview.md +0 -11
- data/docs/PromptSocialPrompt.md +0 -20
- data/docs/SignUploadRequest.md +0 -9
- data/docs/SignUploadResponse.md +0 -9
- data/docs/SocialsApi.md +0 -653
- data/docs/TeamPublicRepresentation.md +0 -10
- data/docs/UsersApi.md +0 -100
- data/docs/VideoEncodingStatusResponse.md +0 -10
- data/docs/VideoPublicRepresentation.md +0 -18
- data/docs/VideoRecorderMethodResponse.md +0 -15
- data/docs/VideosApi.md +0 -287
- data/lib/bombbomb/api/accounts_api.rb +0 -432
- data/lib/bombbomb/api/automations_api.rb +0 -191
- data/lib/bombbomb/api/contacts_api.rb +0 -470
- data/lib/bombbomb/api/curriculum_api.rb +0 -124
- data/lib/bombbomb/api/emails_api.rb +0 -673
- data/lib/bombbomb/api/files_api.rb +0 -302
- data/lib/bombbomb/api/forms_api.rb +0 -77
- data/lib/bombbomb/api/integrations_api.rb +0 -308
- data/lib/bombbomb/api/lists_api.rb +0 -295
- data/lib/bombbomb/api/orders_api.rb +0 -78
- data/lib/bombbomb/api/socials_api.rb +0 -714
- data/lib/bombbomb/api/users_api.rb +0 -119
- data/lib/bombbomb/api/videos_api.rb +0 -326
- data/lib/bombbomb/models/client_group_asset_meta_data.rb +0 -215
- data/lib/bombbomb/models/curriculum.rb +0 -261
- data/lib/bombbomb/models/curriculum_user_progress.rb +0 -229
- data/lib/bombbomb/models/curriculum_with_progress.rb +0 -261
- data/lib/bombbomb/models/hosted_doc.rb +0 -239
- data/lib/bombbomb/models/prompt_bot.rb +0 -329
- data/lib/bombbomb/models/prompt_bot_bot.rb +0 -300
- data/lib/bombbomb/models/prompt_monthly_performance.rb +0 -219
- data/lib/bombbomb/models/prompt_overview.rb +0 -219
- data/lib/bombbomb/models/prompt_social_prompt.rb +0 -311
- data/lib/bombbomb/models/sign_upload_request.rb +0 -199
- data/lib/bombbomb/models/sign_upload_response.rb +0 -199
- data/lib/bombbomb/models/team_public_representation.rb +0 -209
- data/lib/bombbomb/models/video_encoding_status_response.rb +0 -209
- data/lib/bombbomb/models/video_public_representation.rb +0 -291
- data/lib/bombbomb/models/video_recorder_method_response.rb +0 -259
- data/spec/api/accounts_api_spec.rb +0 -96
- data/spec/api/automations_api_spec.rb +0 -71
- data/spec/api/contacts_api_spec.rb +0 -58
- data/spec/api/curriculum_api_spec.rb +0 -69
- data/spec/api/emails_api_spec.rb +0 -104
- data/spec/api/files_api_spec.rb +0 -58
- data/spec/api/forms_api_spec.rb +0 -58
- data/spec/api/integrations_api_spec.rb +0 -58
- data/spec/api/lists_api_spec.rb +0 -83
- data/spec/api/orders_api_spec.rb +0 -58
- data/spec/api/socials_api_spec.rb +0 -135
- data/spec/api/users_api_spec.rb +0 -57
- data/spec/api/videos_api_spec.rb +0 -86
- data/spec/models/client_group_asset_meta_data_spec.rb +0 -60
- data/spec/models/curriculum_spec.rb +0 -95
- data/spec/models/curriculum_user_progress_spec.rb +0 -77
- data/spec/models/curriculum_with_progress_spec.rb +0 -95
- data/spec/models/hosted_doc_spec.rb +0 -83
- data/spec/models/prompt_bot_spec.rb +0 -137
- data/spec/models/prompt_monthly_performance_spec.rb +0 -60
- data/spec/models/prompt_overview_spec.rb +0 -60
- data/spec/models/prompt_social_prompt_spec.rb +0 -125
- data/spec/models/sign_upload_request_spec.rb +0 -59
- data/spec/models/sign_upload_response_spec.rb +0 -59
- data/spec/models/video_encoding_status_response_spec.rb +0 -65
- data/spec/models/video_public_representation_spec.rb +0 -113
- data/spec/models/video_recorder_method_response_spec.rb +0 -95
@@ -1,261 +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 Curriculum class
|
17
|
-
class Curriculum
|
18
|
-
# Id
|
19
|
-
attr_accessor :id
|
20
|
-
|
21
|
-
# Name
|
22
|
-
attr_accessor :name
|
23
|
-
|
24
|
-
# HTML formatted intro
|
25
|
-
attr_accessor :html_intro
|
26
|
-
|
27
|
-
# URI of header image
|
28
|
-
attr_accessor :img_url
|
29
|
-
|
30
|
-
# Number of curriculum items
|
31
|
-
attr_accessor :item_count
|
32
|
-
|
33
|
-
# Render method for curriculum
|
34
|
-
attr_accessor :render_as
|
35
|
-
|
36
|
-
# Globally visible
|
37
|
-
attr_accessor :visible_to_all_users
|
38
|
-
|
39
|
-
# Collection of User Progress for Curriculum
|
40
|
-
attr_accessor :progress
|
41
|
-
|
42
|
-
|
43
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
44
|
-
def self.attribute_map
|
45
|
-
{
|
46
|
-
:'id' => :'id',
|
47
|
-
:'name' => :'name',
|
48
|
-
:'html_intro' => :'htmlIntro',
|
49
|
-
:'img_url' => :'imgUrl',
|
50
|
-
:'item_count' => :'itemCount',
|
51
|
-
:'render_as' => :'renderAs',
|
52
|
-
:'visible_to_all_users' => :'visibleToAllUsers',
|
53
|
-
:'progress' => :'progress'
|
54
|
-
}
|
55
|
-
end
|
56
|
-
|
57
|
-
# Attribute type mapping.
|
58
|
-
def self.swagger_types
|
59
|
-
{
|
60
|
-
:'id' => :'String',
|
61
|
-
:'name' => :'String',
|
62
|
-
:'html_intro' => :'String',
|
63
|
-
:'img_url' => :'String',
|
64
|
-
:'item_count' => :'Integer',
|
65
|
-
:'render_as' => :'String',
|
66
|
-
:'visible_to_all_users' => :'BOOLEAN',
|
67
|
-
:'progress' => :'Array<CurriculumUserProgress>'
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
# Initializes the object
|
72
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
-
def initialize(attributes = {})
|
74
|
-
return unless attributes.is_a?(Hash)
|
75
|
-
|
76
|
-
# convert string to symbol for hash key
|
77
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
78
|
-
|
79
|
-
if attributes.has_key?(:'id')
|
80
|
-
self.id = attributes[:'id']
|
81
|
-
end
|
82
|
-
|
83
|
-
if attributes.has_key?(:'name')
|
84
|
-
self.name = attributes[:'name']
|
85
|
-
end
|
86
|
-
|
87
|
-
if attributes.has_key?(:'htmlIntro')
|
88
|
-
self.html_intro = attributes[:'htmlIntro']
|
89
|
-
end
|
90
|
-
|
91
|
-
if attributes.has_key?(:'imgUrl')
|
92
|
-
self.img_url = attributes[:'imgUrl']
|
93
|
-
end
|
94
|
-
|
95
|
-
if attributes.has_key?(:'itemCount')
|
96
|
-
self.item_count = attributes[:'itemCount']
|
97
|
-
end
|
98
|
-
|
99
|
-
if attributes.has_key?(:'renderAs')
|
100
|
-
self.render_as = attributes[:'renderAs']
|
101
|
-
end
|
102
|
-
|
103
|
-
if attributes.has_key?(:'visibleToAllUsers')
|
104
|
-
self.visible_to_all_users = attributes[:'visibleToAllUsers']
|
105
|
-
end
|
106
|
-
|
107
|
-
if attributes.has_key?(:'progress')
|
108
|
-
if (value = attributes[:'progress']).is_a?(Array)
|
109
|
-
self.progress = value
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
116
|
-
# @return Array for valid properties with the reasons
|
117
|
-
def list_invalid_properties
|
118
|
-
invalid_properties = Array.new
|
119
|
-
return invalid_properties
|
120
|
-
end
|
121
|
-
|
122
|
-
# Check to see if the all the properties in the model are valid
|
123
|
-
# @return true if the model is valid
|
124
|
-
def valid?
|
125
|
-
return true
|
126
|
-
end
|
127
|
-
|
128
|
-
# Checks equality by comparing each attribute.
|
129
|
-
# @param [Object] Object to be compared
|
130
|
-
def ==(o)
|
131
|
-
return true if self.equal?(o)
|
132
|
-
self.class == o.class &&
|
133
|
-
id == o.id &&
|
134
|
-
name == o.name &&
|
135
|
-
html_intro == o.html_intro &&
|
136
|
-
img_url == o.img_url &&
|
137
|
-
item_count == o.item_count &&
|
138
|
-
render_as == o.render_as &&
|
139
|
-
visible_to_all_users == o.visible_to_all_users &&
|
140
|
-
progress == o.progress
|
141
|
-
end
|
142
|
-
|
143
|
-
# @see the `==` method
|
144
|
-
# @param [Object] Object to be compared
|
145
|
-
def eql?(o)
|
146
|
-
self == o
|
147
|
-
end
|
148
|
-
|
149
|
-
# Calculates hash code according to all attributes.
|
150
|
-
# @return [Fixnum] Hash code
|
151
|
-
def hash
|
152
|
-
[id, name, html_intro, img_url, item_count, render_as, visible_to_all_users, progress].hash
|
153
|
-
end
|
154
|
-
|
155
|
-
# Builds the object from hash
|
156
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
157
|
-
# @return [Object] Returns the model itself
|
158
|
-
def build_from_hash(attributes)
|
159
|
-
return nil unless attributes.is_a?(Hash)
|
160
|
-
self.class.swagger_types.each_pair do |key, type|
|
161
|
-
if type =~ /\AArray<(.*)>/i
|
162
|
-
# check to ensure the input is an array given that the the attribute
|
163
|
-
# is documented as an array but the input is not
|
164
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
165
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
166
|
-
end
|
167
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
168
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
169
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
170
|
-
end
|
171
|
-
|
172
|
-
self
|
173
|
-
end
|
174
|
-
|
175
|
-
# Deserializes the data based on type
|
176
|
-
# @param string type Data type
|
177
|
-
# @param string value Value to be deserialized
|
178
|
-
# @return [Object] Deserialized data
|
179
|
-
def _deserialize(type, value)
|
180
|
-
case type.to_sym
|
181
|
-
when :DateTime
|
182
|
-
DateTime.parse(value)
|
183
|
-
when :Date
|
184
|
-
Date.parse(value)
|
185
|
-
when :String
|
186
|
-
value.to_s
|
187
|
-
when :Integer
|
188
|
-
value.to_i
|
189
|
-
when :Float
|
190
|
-
value.to_f
|
191
|
-
when :BOOLEAN
|
192
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
193
|
-
true
|
194
|
-
else
|
195
|
-
false
|
196
|
-
end
|
197
|
-
when :Object
|
198
|
-
# generic object (usually a Hash), return directly
|
199
|
-
value
|
200
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
201
|
-
inner_type = Regexp.last_match[:inner_type]
|
202
|
-
value.map { |v| _deserialize(inner_type, v) }
|
203
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
204
|
-
k_type = Regexp.last_match[:k_type]
|
205
|
-
v_type = Regexp.last_match[:v_type]
|
206
|
-
{}.tap do |hash|
|
207
|
-
value.each do |k, v|
|
208
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
else # model
|
212
|
-
temp_model = BombBomb.const_get(type).new
|
213
|
-
temp_model.build_from_hash(value)
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
# Returns the string representation of the object
|
218
|
-
# @return [String] String presentation of the object
|
219
|
-
def to_s
|
220
|
-
to_hash.to_s
|
221
|
-
end
|
222
|
-
|
223
|
-
# to_body is an alias to to_hash (backward compatibility)
|
224
|
-
# @return [Hash] Returns the object in the form of hash
|
225
|
-
def to_body
|
226
|
-
to_hash
|
227
|
-
end
|
228
|
-
|
229
|
-
# Returns the object in the form of hash
|
230
|
-
# @return [Hash] Returns the object in the form of hash
|
231
|
-
def to_hash
|
232
|
-
hash = {}
|
233
|
-
self.class.attribute_map.each_pair do |attr, param|
|
234
|
-
value = self.send(attr)
|
235
|
-
next if value.nil?
|
236
|
-
hash[param] = _to_hash(value)
|
237
|
-
end
|
238
|
-
hash
|
239
|
-
end
|
240
|
-
|
241
|
-
# Outputs non-array value in the form of hash
|
242
|
-
# For object, use to_hash. Otherwise, just return the value
|
243
|
-
# @param [Object] value Any valid value
|
244
|
-
# @return [Hash] Returns the value in the form of hash
|
245
|
-
def _to_hash(value)
|
246
|
-
if value.is_a?(Array)
|
247
|
-
value.compact.map{ |v| _to_hash(v) }
|
248
|
-
elsif value.is_a?(Hash)
|
249
|
-
{}.tap do |hash|
|
250
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
251
|
-
end
|
252
|
-
elsif value.respond_to? :to_hash
|
253
|
-
value.to_hash
|
254
|
-
else
|
255
|
-
value
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
end
|
260
|
-
|
261
|
-
end
|
@@ -1,229 +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 CurriculumUserProgress class
|
17
|
-
class CurriculumUserProgress
|
18
|
-
# Id
|
19
|
-
attr_accessor :id
|
20
|
-
|
21
|
-
# User Id
|
22
|
-
attr_accessor :user_id
|
23
|
-
|
24
|
-
# Curriculum Item Id
|
25
|
-
attr_accessor :curriculum_item_id
|
26
|
-
|
27
|
-
# Curriculum Id
|
28
|
-
attr_accessor :curriculum_id
|
29
|
-
|
30
|
-
# When the final email is scheduled to be sent
|
31
|
-
attr_accessor :completed_date
|
32
|
-
|
33
|
-
|
34
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
-
def self.attribute_map
|
36
|
-
{
|
37
|
-
:'id' => :'id',
|
38
|
-
:'user_id' => :'userId',
|
39
|
-
:'curriculum_item_id' => :'curriculumItemId',
|
40
|
-
:'curriculum_id' => :'curriculumId',
|
41
|
-
:'completed_date' => :'completedDate'
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
# Attribute type mapping.
|
46
|
-
def self.swagger_types
|
47
|
-
{
|
48
|
-
:'id' => :'String',
|
49
|
-
:'user_id' => :'String',
|
50
|
-
:'curriculum_item_id' => :'String',
|
51
|
-
:'curriculum_id' => :'String',
|
52
|
-
:'completed_date' => :'DateTime'
|
53
|
-
}
|
54
|
-
end
|
55
|
-
|
56
|
-
# Initializes the object
|
57
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
-
def initialize(attributes = {})
|
59
|
-
return unless attributes.is_a?(Hash)
|
60
|
-
|
61
|
-
# convert string to symbol for hash key
|
62
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
63
|
-
|
64
|
-
if attributes.has_key?(:'id')
|
65
|
-
self.id = attributes[:'id']
|
66
|
-
end
|
67
|
-
|
68
|
-
if attributes.has_key?(:'userId')
|
69
|
-
self.user_id = attributes[:'userId']
|
70
|
-
end
|
71
|
-
|
72
|
-
if attributes.has_key?(:'curriculumItemId')
|
73
|
-
self.curriculum_item_id = attributes[:'curriculumItemId']
|
74
|
-
end
|
75
|
-
|
76
|
-
if attributes.has_key?(:'curriculumId')
|
77
|
-
self.curriculum_id = attributes[:'curriculumId']
|
78
|
-
end
|
79
|
-
|
80
|
-
if attributes.has_key?(:'completedDate')
|
81
|
-
self.completed_date = attributes[:'completedDate']
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
-
# @return Array for valid properties with the reasons
|
88
|
-
def list_invalid_properties
|
89
|
-
invalid_properties = Array.new
|
90
|
-
return invalid_properties
|
91
|
-
end
|
92
|
-
|
93
|
-
# Check to see if the all the properties in the model are valid
|
94
|
-
# @return true if the model is valid
|
95
|
-
def valid?
|
96
|
-
return true
|
97
|
-
end
|
98
|
-
|
99
|
-
# Checks equality by comparing each attribute.
|
100
|
-
# @param [Object] Object to be compared
|
101
|
-
def ==(o)
|
102
|
-
return true if self.equal?(o)
|
103
|
-
self.class == o.class &&
|
104
|
-
id == o.id &&
|
105
|
-
user_id == o.user_id &&
|
106
|
-
curriculum_item_id == o.curriculum_item_id &&
|
107
|
-
curriculum_id == o.curriculum_id &&
|
108
|
-
completed_date == o.completed_date
|
109
|
-
end
|
110
|
-
|
111
|
-
# @see the `==` method
|
112
|
-
# @param [Object] Object to be compared
|
113
|
-
def eql?(o)
|
114
|
-
self == o
|
115
|
-
end
|
116
|
-
|
117
|
-
# Calculates hash code according to all attributes.
|
118
|
-
# @return [Fixnum] Hash code
|
119
|
-
def hash
|
120
|
-
[id, user_id, curriculum_item_id, curriculum_id, completed_date].hash
|
121
|
-
end
|
122
|
-
|
123
|
-
# Builds the object from hash
|
124
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
-
# @return [Object] Returns the model itself
|
126
|
-
def build_from_hash(attributes)
|
127
|
-
return nil unless attributes.is_a?(Hash)
|
128
|
-
self.class.swagger_types.each_pair do |key, type|
|
129
|
-
if type =~ /\AArray<(.*)>/i
|
130
|
-
# check to ensure the input is an array given that the the attribute
|
131
|
-
# is documented as an array but the input is not
|
132
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
133
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
134
|
-
end
|
135
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
136
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
137
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
138
|
-
end
|
139
|
-
|
140
|
-
self
|
141
|
-
end
|
142
|
-
|
143
|
-
# Deserializes the data based on type
|
144
|
-
# @param string type Data type
|
145
|
-
# @param string value Value to be deserialized
|
146
|
-
# @return [Object] Deserialized data
|
147
|
-
def _deserialize(type, value)
|
148
|
-
case type.to_sym
|
149
|
-
when :DateTime
|
150
|
-
DateTime.parse(value)
|
151
|
-
when :Date
|
152
|
-
Date.parse(value)
|
153
|
-
when :String
|
154
|
-
value.to_s
|
155
|
-
when :Integer
|
156
|
-
value.to_i
|
157
|
-
when :Float
|
158
|
-
value.to_f
|
159
|
-
when :BOOLEAN
|
160
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
161
|
-
true
|
162
|
-
else
|
163
|
-
false
|
164
|
-
end
|
165
|
-
when :Object
|
166
|
-
# generic object (usually a Hash), return directly
|
167
|
-
value
|
168
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
169
|
-
inner_type = Regexp.last_match[:inner_type]
|
170
|
-
value.map { |v| _deserialize(inner_type, v) }
|
171
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
172
|
-
k_type = Regexp.last_match[:k_type]
|
173
|
-
v_type = Regexp.last_match[:v_type]
|
174
|
-
{}.tap do |hash|
|
175
|
-
value.each do |k, v|
|
176
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
else # model
|
180
|
-
temp_model = BombBomb.const_get(type).new
|
181
|
-
temp_model.build_from_hash(value)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
# Returns the string representation of the object
|
186
|
-
# @return [String] String presentation of the object
|
187
|
-
def to_s
|
188
|
-
to_hash.to_s
|
189
|
-
end
|
190
|
-
|
191
|
-
# to_body is an alias to to_hash (backward compatibility)
|
192
|
-
# @return [Hash] Returns the object in the form of hash
|
193
|
-
def to_body
|
194
|
-
to_hash
|
195
|
-
end
|
196
|
-
|
197
|
-
# Returns the object in the form of hash
|
198
|
-
# @return [Hash] Returns the object in the form of hash
|
199
|
-
def to_hash
|
200
|
-
hash = {}
|
201
|
-
self.class.attribute_map.each_pair do |attr, param|
|
202
|
-
value = self.send(attr)
|
203
|
-
next if value.nil?
|
204
|
-
hash[param] = _to_hash(value)
|
205
|
-
end
|
206
|
-
hash
|
207
|
-
end
|
208
|
-
|
209
|
-
# Outputs non-array value in the form of hash
|
210
|
-
# For object, use to_hash. Otherwise, just return the value
|
211
|
-
# @param [Object] value Any valid value
|
212
|
-
# @return [Hash] Returns the value in the form of hash
|
213
|
-
def _to_hash(value)
|
214
|
-
if value.is_a?(Array)
|
215
|
-
value.compact.map{ |v| _to_hash(v) }
|
216
|
-
elsif value.is_a?(Hash)
|
217
|
-
{}.tap do |hash|
|
218
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
219
|
-
end
|
220
|
-
elsif value.respond_to? :to_hash
|
221
|
-
value.to_hash
|
222
|
-
else
|
223
|
-
value
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|
228
|
-
|
229
|
-
end
|