bombbomb 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE +201 -0
- data/README.md +139 -0
- data/Rakefile +3 -0
- data/bombbomb.gemspec +55 -0
- data/docs/BBWebHook.md +11 -0
- data/docs/InlineResponse200.md +9 -0
- data/docs/InlineResponse200Items.md +11 -0
- data/docs/JerichoConfiguration.md +18 -0
- data/docs/JerichoPerformance.md +18 -0
- data/docs/OAuthClient.md +13 -0
- data/docs/PromptsApi.md +169 -0
- data/docs/String.md +7 -0
- data/docs/TeamsApi.md +290 -0
- data/docs/UtilitiesApi.md +204 -0
- data/docs/VideoEmailPrompt.md +25 -0
- data/docs/WebhooksApi.md +207 -0
- data/git_push.sh +67 -0
- data/lib/bombbomb.rb +62 -0
- data/lib/bombbomb/api/prompts_api.rb +217 -0
- data/lib/bombbomb/api/teams_api.rb +346 -0
- data/lib/bombbomb/api/utilities_api.rb +258 -0
- data/lib/bombbomb/api/webhooks_api.rb +254 -0
- data/lib/bombbomb/api_client.rb +379 -0
- data/lib/bombbomb/api_error.rb +47 -0
- data/lib/bombbomb/configuration.rb +214 -0
- data/lib/bombbomb/models/bb_web_hook.rb +230 -0
- data/lib/bombbomb/models/inline_response_200.rb +210 -0
- data/lib/bombbomb/models/inline_response_200_items.rb +226 -0
- data/lib/bombbomb/models/jericho_configuration.rb +299 -0
- data/lib/bombbomb/models/jericho_performance.rb +300 -0
- data/lib/bombbomb/models/o_auth_client.rb +250 -0
- data/lib/bombbomb/models/string.rb +190 -0
- data/lib/bombbomb/models/video_email_prompt.rb +379 -0
- data/lib/bombbomb/version.rb +26 -0
- data/spec/api/prompts_api_spec.rb +84 -0
- data/spec/api/teams_api_spec.rb +113 -0
- data/spec/api/utilities_api_spec.rb +93 -0
- data/spec/api/webhooks_api_spec.rb +92 -0
- data/spec/api_client_spec.rb +237 -0
- data/spec/configuration_spec.rb +53 -0
- data/spec/models/bb_web_hook_spec.rb +71 -0
- data/spec/models/inline_response_200_items_spec.rb +71 -0
- data/spec/models/inline_response_200_spec.rb +59 -0
- data/spec/models/jericho_configuration_spec.rb +113 -0
- data/spec/models/jericho_performance_spec.rb +113 -0
- data/spec/models/o_auth_client_spec.rb +83 -0
- data/spec/models/string_spec.rb +47 -0
- data/spec/models/video_email_prompt_spec.rb +155 -0
- data/spec/spec_helper.rb +122 -0
- metadata +288 -0
@@ -0,0 +1,299 @@
|
|
1
|
+
=begin
|
2
|
+
#BombBomb
|
3
|
+
|
4
|
+
#We make it easy to build relationships using simple videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
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
|
+
|
28
|
+
class JerichoConfiguration
|
29
|
+
attr_accessor :id
|
30
|
+
|
31
|
+
attr_accessor :client_group_id
|
32
|
+
|
33
|
+
# When the email should be sent.
|
34
|
+
attr_accessor :send_date
|
35
|
+
|
36
|
+
# Determines whether this is a static or prompted send.
|
37
|
+
attr_accessor :is_prompt
|
38
|
+
|
39
|
+
# Static send: The Email to send on behalf of the group members.
|
40
|
+
attr_accessor :email_id
|
41
|
+
|
42
|
+
# Video Prompt: The subject line prompting the user to record a video.
|
43
|
+
attr_accessor :prompt_subject
|
44
|
+
|
45
|
+
# Video Prompt: The HTML body of the email prompting the user to record a video.
|
46
|
+
attr_accessor :prompt_body
|
47
|
+
|
48
|
+
# Video Prompt: The subject line of the final sent email
|
49
|
+
attr_accessor :email_subject
|
50
|
+
|
51
|
+
# Video Prompt: The HTML body of the final sent email.
|
52
|
+
attr_accessor :email_body
|
53
|
+
|
54
|
+
# Video Prompt: Whether to send the final email if no video was recorded.
|
55
|
+
attr_accessor :send_without_video
|
56
|
+
|
57
|
+
# The state of the send.
|
58
|
+
attr_accessor :status
|
59
|
+
|
60
|
+
|
61
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
62
|
+
def self.attribute_map
|
63
|
+
{
|
64
|
+
:'id' => :'id',
|
65
|
+
:'client_group_id' => :'clientGroupId',
|
66
|
+
:'send_date' => :'sendDate',
|
67
|
+
:'is_prompt' => :'isPrompt',
|
68
|
+
:'email_id' => :'emailId',
|
69
|
+
:'prompt_subject' => :'promptSubject',
|
70
|
+
:'prompt_body' => :'promptBody',
|
71
|
+
:'email_subject' => :'emailSubject',
|
72
|
+
:'email_body' => :'emailBody',
|
73
|
+
:'send_without_video' => :'sendWithoutVideo',
|
74
|
+
:'status' => :'status'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# Attribute type mapping.
|
79
|
+
def self.swagger_types
|
80
|
+
{
|
81
|
+
:'id' => :'String',
|
82
|
+
:'client_group_id' => :'String',
|
83
|
+
:'send_date' => :'DateTime',
|
84
|
+
:'is_prompt' => :'BOOLEAN',
|
85
|
+
:'email_id' => :'String',
|
86
|
+
:'prompt_subject' => :'String',
|
87
|
+
:'prompt_body' => :'String',
|
88
|
+
:'email_subject' => :'String',
|
89
|
+
:'email_body' => :'String',
|
90
|
+
:'send_without_video' => :'BOOLEAN',
|
91
|
+
:'status' => :'String'
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
# Initializes the object
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
def initialize(attributes = {})
|
98
|
+
return unless attributes.is_a?(Hash)
|
99
|
+
|
100
|
+
# convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
102
|
+
|
103
|
+
if attributes.has_key?(:'id')
|
104
|
+
self.id = attributes[:'id']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'clientGroupId')
|
108
|
+
self.client_group_id = attributes[:'clientGroupId']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'sendDate')
|
112
|
+
self.send_date = attributes[:'sendDate']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'isPrompt')
|
116
|
+
self.is_prompt = attributes[:'isPrompt']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.has_key?(:'emailId')
|
120
|
+
self.email_id = attributes[:'emailId']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.has_key?(:'promptSubject')
|
124
|
+
self.prompt_subject = attributes[:'promptSubject']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'promptBody')
|
128
|
+
self.prompt_body = attributes[:'promptBody']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'emailSubject')
|
132
|
+
self.email_subject = attributes[:'emailSubject']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.has_key?(:'emailBody')
|
136
|
+
self.email_body = attributes[:'emailBody']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.has_key?(:'sendWithoutVideo')
|
140
|
+
self.send_without_video = attributes[:'sendWithoutVideo']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'status')
|
144
|
+
self.status = attributes[:'status']
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
150
|
+
# @return Array for valid properies with the reasons
|
151
|
+
def list_invalid_properties
|
152
|
+
invalid_properties = Array.new
|
153
|
+
return invalid_properties
|
154
|
+
end
|
155
|
+
|
156
|
+
# Check to see if the all the properties in the model are valid
|
157
|
+
# @return true if the model is valid
|
158
|
+
def valid?
|
159
|
+
return false if @is_prompt.nil?
|
160
|
+
return true
|
161
|
+
end
|
162
|
+
|
163
|
+
# Checks equality by comparing each attribute.
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def ==(o)
|
166
|
+
return true if self.equal?(o)
|
167
|
+
self.class == o.class &&
|
168
|
+
id == o.id &&
|
169
|
+
client_group_id == o.client_group_id &&
|
170
|
+
send_date == o.send_date &&
|
171
|
+
is_prompt == o.is_prompt &&
|
172
|
+
email_id == o.email_id &&
|
173
|
+
prompt_subject == o.prompt_subject &&
|
174
|
+
prompt_body == o.prompt_body &&
|
175
|
+
email_subject == o.email_subject &&
|
176
|
+
email_body == o.email_body &&
|
177
|
+
send_without_video == o.send_without_video &&
|
178
|
+
status == o.status
|
179
|
+
end
|
180
|
+
|
181
|
+
# @see the `==` method
|
182
|
+
# @param [Object] Object to be compared
|
183
|
+
def eql?(o)
|
184
|
+
self == o
|
185
|
+
end
|
186
|
+
|
187
|
+
# Calculates hash code according to all attributes.
|
188
|
+
# @return [Fixnum] Hash code
|
189
|
+
def hash
|
190
|
+
[id, client_group_id, send_date, is_prompt, email_id, prompt_subject, prompt_body, email_subject, email_body, send_without_video, status].hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Builds the object from hash
|
194
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
195
|
+
# @return [Object] Returns the model itself
|
196
|
+
def build_from_hash(attributes)
|
197
|
+
return nil unless attributes.is_a?(Hash)
|
198
|
+
self.class.swagger_types.each_pair do |key, type|
|
199
|
+
if type =~ /^Array<(.*)>/i
|
200
|
+
# check to ensure the input is an array given that the the attribute
|
201
|
+
# is documented as an array but the input is not
|
202
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
203
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
204
|
+
end
|
205
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
206
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
207
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
208
|
+
end
|
209
|
+
|
210
|
+
self
|
211
|
+
end
|
212
|
+
|
213
|
+
# Deserializes the data based on type
|
214
|
+
# @param string type Data type
|
215
|
+
# @param string value Value to be deserialized
|
216
|
+
# @return [Object] Deserialized data
|
217
|
+
def _deserialize(type, value)
|
218
|
+
case type.to_sym
|
219
|
+
when :DateTime
|
220
|
+
DateTime.parse(value)
|
221
|
+
when :Date
|
222
|
+
Date.parse(value)
|
223
|
+
when :String
|
224
|
+
value.to_s
|
225
|
+
when :Integer
|
226
|
+
value.to_i
|
227
|
+
when :Float
|
228
|
+
value.to_f
|
229
|
+
when :BOOLEAN
|
230
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
231
|
+
true
|
232
|
+
else
|
233
|
+
false
|
234
|
+
end
|
235
|
+
when :Object
|
236
|
+
# generic object (usually a Hash), return directly
|
237
|
+
value
|
238
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
239
|
+
inner_type = Regexp.last_match[:inner_type]
|
240
|
+
value.map { |v| _deserialize(inner_type, v) }
|
241
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
242
|
+
k_type = Regexp.last_match[:k_type]
|
243
|
+
v_type = Regexp.last_match[:v_type]
|
244
|
+
{}.tap do |hash|
|
245
|
+
value.each do |k, v|
|
246
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
else # model
|
250
|
+
temp_model = BombBomb.const_get(type).new
|
251
|
+
temp_model.build_from_hash(value)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
# Returns the string representation of the object
|
256
|
+
# @return [String] String presentation of the object
|
257
|
+
def to_s
|
258
|
+
to_hash.to_s
|
259
|
+
end
|
260
|
+
|
261
|
+
# to_body is an alias to to_hash (backward compatibility)
|
262
|
+
# @return [Hash] Returns the object in the form of hash
|
263
|
+
def to_body
|
264
|
+
to_hash
|
265
|
+
end
|
266
|
+
|
267
|
+
# Returns the object in the form of hash
|
268
|
+
# @return [Hash] Returns the object in the form of hash
|
269
|
+
def to_hash
|
270
|
+
hash = {}
|
271
|
+
self.class.attribute_map.each_pair do |attr, param|
|
272
|
+
value = self.send(attr)
|
273
|
+
next if value.nil?
|
274
|
+
hash[param] = _to_hash(value)
|
275
|
+
end
|
276
|
+
hash
|
277
|
+
end
|
278
|
+
|
279
|
+
# Outputs non-array value in the form of hash
|
280
|
+
# For object, use to_hash. Otherwise, just return the value
|
281
|
+
# @param [Object] value Any valid value
|
282
|
+
# @return [Hash] Returns the value in the form of hash
|
283
|
+
def _to_hash(value)
|
284
|
+
if value.is_a?(Array)
|
285
|
+
value.compact.map{ |v| _to_hash(v) }
|
286
|
+
elsif value.is_a?(Hash)
|
287
|
+
{}.tap do |hash|
|
288
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
289
|
+
end
|
290
|
+
elsif value.respond_to? :to_hash
|
291
|
+
value.to_hash
|
292
|
+
else
|
293
|
+
value
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
end
|
298
|
+
|
299
|
+
end
|
@@ -0,0 +1,300 @@
|
|
1
|
+
=begin
|
2
|
+
#BombBomb
|
3
|
+
|
4
|
+
#We make it easy to build relationships using simple videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
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
|
+
# Reports on the aggregate performance of a Jericho send
|
28
|
+
class JerichoPerformance
|
29
|
+
# The number of emails sent
|
30
|
+
attr_accessor :sent
|
31
|
+
|
32
|
+
# The unique number of people that viewed the email
|
33
|
+
attr_accessor :unique_views
|
34
|
+
|
35
|
+
# The unique number of people that visited the landing page
|
36
|
+
attr_accessor :unique_landing_page_views
|
37
|
+
|
38
|
+
# The total number of people that visisted the landing page
|
39
|
+
attr_accessor :landing_page_views
|
40
|
+
|
41
|
+
# The number of emails delivered, likely less than sent due to bounces, and other common delivery issues
|
42
|
+
attr_accessor :delivered
|
43
|
+
|
44
|
+
# The number of emails that bounced as undeliverable
|
45
|
+
attr_accessor :bounce
|
46
|
+
|
47
|
+
# The total number of times the emails were viewed
|
48
|
+
attr_accessor :open
|
49
|
+
|
50
|
+
# The total number of times links in the emails were clicked
|
51
|
+
attr_accessor :click
|
52
|
+
|
53
|
+
# The total number of times videos in the emails were played
|
54
|
+
attr_accessor :video_play
|
55
|
+
|
56
|
+
# The number of recipients that marked the message as abusive
|
57
|
+
attr_accessor :abuse_complaints
|
58
|
+
|
59
|
+
# The total number of contacts submitted to be sent, may be more than was sent to
|
60
|
+
attr_accessor :contacts
|
61
|
+
|
62
|
+
|
63
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
64
|
+
def self.attribute_map
|
65
|
+
{
|
66
|
+
:'sent' => :'sent',
|
67
|
+
:'unique_views' => :'uniqueViews',
|
68
|
+
:'unique_landing_page_views' => :'uniqueLandingPageViews',
|
69
|
+
:'landing_page_views' => :'landingPageViews',
|
70
|
+
:'delivered' => :'delivered',
|
71
|
+
:'bounce' => :'bounce',
|
72
|
+
:'open' => :'open',
|
73
|
+
:'click' => :'click',
|
74
|
+
:'video_play' => :'videoPlay',
|
75
|
+
:'abuse_complaints' => :'abuseComplaints',
|
76
|
+
:'contacts' => :'contacts'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# Attribute type mapping.
|
81
|
+
def self.swagger_types
|
82
|
+
{
|
83
|
+
:'sent' => :'Integer',
|
84
|
+
:'unique_views' => :'Integer',
|
85
|
+
:'unique_landing_page_views' => :'Integer',
|
86
|
+
:'landing_page_views' => :'Integer',
|
87
|
+
:'delivered' => :'Integer',
|
88
|
+
:'bounce' => :'Integer',
|
89
|
+
:'open' => :'Integer',
|
90
|
+
:'click' => :'Integer',
|
91
|
+
:'video_play' => :'Integer',
|
92
|
+
:'abuse_complaints' => :'Integer',
|
93
|
+
:'contacts' => :'Integer'
|
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?(:'sent')
|
106
|
+
self.sent = attributes[:'sent']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'uniqueViews')
|
110
|
+
self.unique_views = attributes[:'uniqueViews']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'uniqueLandingPageViews')
|
114
|
+
self.unique_landing_page_views = attributes[:'uniqueLandingPageViews']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'landingPageViews')
|
118
|
+
self.landing_page_views = attributes[:'landingPageViews']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'delivered')
|
122
|
+
self.delivered = attributes[:'delivered']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'bounce')
|
126
|
+
self.bounce = attributes[:'bounce']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'open')
|
130
|
+
self.open = attributes[:'open']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'click')
|
134
|
+
self.click = attributes[:'click']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'videoPlay')
|
138
|
+
self.video_play = attributes[:'videoPlay']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'abuseComplaints')
|
142
|
+
self.abuse_complaints = attributes[:'abuseComplaints']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.has_key?(:'contacts')
|
146
|
+
self.contacts = attributes[:'contacts']
|
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
|
+
sent == o.sent &&
|
170
|
+
unique_views == o.unique_views &&
|
171
|
+
unique_landing_page_views == o.unique_landing_page_views &&
|
172
|
+
landing_page_views == o.landing_page_views &&
|
173
|
+
delivered == o.delivered &&
|
174
|
+
bounce == o.bounce &&
|
175
|
+
open == o.open &&
|
176
|
+
click == o.click &&
|
177
|
+
video_play == o.video_play &&
|
178
|
+
abuse_complaints == o.abuse_complaints &&
|
179
|
+
contacts == o.contacts
|
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
|
+
[sent, unique_views, unique_landing_page_views, landing_page_views, delivered, bounce, open, click, video_play, abuse_complaints, contacts].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
|