mparticle 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +73 -0
  3. data/docs/ApiResponse.md +8 -0
  4. data/docs/ApiResponseErrors.md +9 -0
  5. data/docs/AppEvent.md +18 -0
  6. data/docs/ApplicationInformation.md +11 -0
  7. data/docs/ApplicationStateTransitionEvent.md +20 -0
  8. data/docs/AttributionInfo.md +10 -0
  9. data/docs/Batch.md +18 -0
  10. data/docs/BreadcrumbEvent.md +17 -0
  11. data/docs/CommerceEvent.md +22 -0
  12. data/docs/CrashReportEvent.md +26 -0
  13. data/docs/DeviceCurrentState.md +23 -0
  14. data/docs/DeviceInformation.md +41 -0
  15. data/docs/EventBase.md +9 -0
  16. data/docs/EventData.md +15 -0
  17. data/docs/EventsApi.md +124 -0
  18. data/docs/FirstRunEvent.md +15 -0
  19. data/docs/GeoLocation.md +10 -0
  20. data/docs/MediaInfo.md +15 -0
  21. data/docs/NetworkPerformanceEvent.md +22 -0
  22. data/docs/OptOutEvent.md +16 -0
  23. data/docs/Product.md +19 -0
  24. data/docs/ProductAction.md +19 -0
  25. data/docs/ProductImpression.md +9 -0
  26. data/docs/ProfileEvent.md +18 -0
  27. data/docs/Promotion.md +11 -0
  28. data/docs/PromotionAction.md +9 -0
  29. data/docs/PushMessageEvent.md +22 -0
  30. data/docs/PushRegistrationEvent.md +17 -0
  31. data/docs/ScreenViewEvent.md +17 -0
  32. data/docs/SessionEndEvent.md +16 -0
  33. data/docs/SessionStartEvent.md +15 -0
  34. data/docs/ShoppingCart.md +8 -0
  35. data/docs/SourceInformation.md +11 -0
  36. data/docs/UserIdentities.md +17 -0
  37. data/example/main.rb +32 -0
  38. data/lib/.DS_Store +0 -0
  39. data/lib/mparticle/.DS_Store +0 -0
  40. data/lib/mparticle/api/events_api.rb +129 -0
  41. data/lib/mparticle/api_client.rb +398 -0
  42. data/lib/mparticle/api_error.rb +26 -0
  43. data/lib/mparticle/configuration.rb +160 -0
  44. data/lib/mparticle/models/api_response.rb +178 -0
  45. data/lib/mparticle/models/api_response_errors.rb +185 -0
  46. data/lib/mparticle/models/app_event.rb +311 -0
  47. data/lib/mparticle/models/application_information.rb +203 -0
  48. data/lib/mparticle/models/application_state_transition_event.rb +352 -0
  49. data/lib/mparticle/models/attribution_info.rb +209 -0
  50. data/lib/mparticle/models/batch.rb +348 -0
  51. data/lib/mparticle/models/breadcrumb_event.rb +269 -0
  52. data/lib/mparticle/models/commerce_event.rb +306 -0
  53. data/lib/mparticle/models/crash_report_event.rb +362 -0
  54. data/lib/mparticle/models/device_current_state.rb +356 -0
  55. data/lib/mparticle/models/device_information.rb +506 -0
  56. data/lib/mparticle/models/event_base.rb +228 -0
  57. data/lib/mparticle/models/event_data.rb +241 -0
  58. data/lib/mparticle/models/first_run_event.rb +241 -0
  59. data/lib/mparticle/models/geo_location.rb +204 -0
  60. data/lib/mparticle/models/media_info.rb +296 -0
  61. data/lib/mparticle/models/network_performance_event.rb +334 -0
  62. data/lib/mparticle/models/opt_out_event.rb +255 -0
  63. data/lib/mparticle/models/product.rb +297 -0
  64. data/lib/mparticle/models/product_action.rb +330 -0
  65. data/lib/mparticle/models/product_impression.rb +197 -0
  66. data/lib/mparticle/models/profile_event.rb +316 -0
  67. data/lib/mparticle/models/promotion.rb +223 -0
  68. data/lib/mparticle/models/promotion_action.rb +230 -0
  69. data/lib/mparticle/models/push_message_event.rb +369 -0
  70. data/lib/mparticle/models/push_registration_event.rb +269 -0
  71. data/lib/mparticle/models/screen_view_event.rb +264 -0
  72. data/lib/mparticle/models/session_end_event.rb +255 -0
  73. data/lib/mparticle/models/session_start_event.rb +241 -0
  74. data/lib/mparticle/models/shopping_cart.rb +183 -0
  75. data/lib/mparticle/models/source_information.rb +246 -0
  76. data/lib/mparticle/models/user_identities.rb +257 -0
  77. data/lib/mparticle/version.rb +3 -0
  78. data/lib/mparticle.rb +61 -0
  79. data/mparticle.gemspec +19 -0
  80. metadata +163 -0
@@ -0,0 +1,362 @@
1
+ require 'date'
2
+
3
+ module MParticle
4
+
5
+ class CrashReportEvent
6
+ attr_accessor :timestamp_unixtime_ms
7
+
8
+ attr_accessor :event_id
9
+
10
+ attr_accessor :source_message_id
11
+
12
+ attr_accessor :session_id
13
+
14
+ attr_accessor :session_uuid
15
+
16
+ attr_accessor :custom_attributes
17
+
18
+ attr_accessor :location
19
+
20
+ attr_accessor :device_current_state
21
+
22
+ attr_accessor :breadcrumbs
23
+
24
+ attr_accessor :class_name
25
+
26
+ attr_accessor :severity
27
+
28
+ attr_accessor :message
29
+
30
+ attr_accessor :stack_trace
31
+
32
+ attr_accessor :exception_handled
33
+
34
+ attr_accessor :topmost_context
35
+
36
+ attr_accessor :pl_crash_report_file_base64
37
+
38
+ attr_accessor :ios_image_base_address
39
+
40
+ attr_accessor :ios_image_size
41
+
42
+ attr_accessor :session_number
43
+
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'timestamp_unixtime_ms' => :'timestamp_unixtime_ms',
49
+ :'event_id' => :'event_id',
50
+ :'source_message_id' => :'source_message_id',
51
+ :'session_id' => :'session_id',
52
+ :'session_uuid' => :'session_uuid',
53
+ :'custom_attributes' => :'custom_attributes',
54
+ :'location' => :'location',
55
+ :'device_current_state' => :'device_current_state',
56
+ :'breadcrumbs' => :'breadcrumbs',
57
+ :'class_name' => :'class_name',
58
+ :'severity' => :'severity',
59
+ :'message' => :'message',
60
+ :'stack_trace' => :'stack_trace',
61
+ :'exception_handled' => :'exception_handled',
62
+ :'topmost_context' => :'topmost_context',
63
+ :'pl_crash_report_file_base64' => :'pl_crash_report_file_base64',
64
+ :'ios_image_base_address' => :'ios_image_base_address',
65
+ :'ios_image_size' => :'ios_image_size',
66
+ :'session_number' => :'session_number'
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.swagger_types
72
+ {
73
+ :'timestamp_unixtime_ms' => :'Integer',
74
+ :'event_id' => :'Integer',
75
+ :'source_message_id' => :'String',
76
+ :'session_id' => :'Integer',
77
+ :'session_uuid' => :'String',
78
+ :'custom_attributes' => :'Hash<String, String>',
79
+ :'location' => :'GeoLocation',
80
+ :'device_current_state' => :'DeviceCurrentState',
81
+ :'breadcrumbs' => :'Array<BreadcrumbEvent>',
82
+ :'class_name' => :'String',
83
+ :'severity' => :'String',
84
+ :'message' => :'String',
85
+ :'stack_trace' => :'String',
86
+ :'exception_handled' => :'BOOLEAN',
87
+ :'topmost_context' => :'String',
88
+ :'pl_crash_report_file_base64' => :'String',
89
+ :'ios_image_base_address' => :'Integer',
90
+ :'ios_image_size' => :'Integer',
91
+ :'session_number' => :'Integer'
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?(:'timestamp_unixtime_ms')
104
+ self.timestamp_unixtime_ms = attributes[:'timestamp_unixtime_ms']
105
+ end
106
+
107
+ if attributes.has_key?(:'event_id')
108
+ self.event_id = attributes[:'event_id']
109
+ end
110
+
111
+ if attributes.has_key?(:'source_message_id')
112
+ self.source_message_id = attributes[:'source_message_id']
113
+ end
114
+
115
+ if attributes.has_key?(:'session_id')
116
+ self.session_id = attributes[:'session_id']
117
+ end
118
+
119
+ if attributes.has_key?(:'session_uuid')
120
+ self.session_uuid = attributes[:'session_uuid']
121
+ end
122
+
123
+ if attributes.has_key?(:'custom_attributes')
124
+ if (value = attributes[:'custom_attributes']).is_a?(Array)
125
+ self.custom_attributes = value
126
+ end
127
+ end
128
+
129
+ if attributes.has_key?(:'location')
130
+ self.location = attributes[:'location']
131
+ end
132
+
133
+ if attributes.has_key?(:'device_current_state')
134
+ self.device_current_state = attributes[:'device_current_state']
135
+ end
136
+
137
+ if attributes.has_key?(:'breadcrumbs')
138
+ if (value = attributes[:'breadcrumbs']).is_a?(Array)
139
+ self.breadcrumbs = value
140
+ end
141
+ end
142
+
143
+ if attributes.has_key?(:'class_name')
144
+ self.class_name = attributes[:'class_name']
145
+ end
146
+
147
+ if attributes.has_key?(:'severity')
148
+ self.severity = attributes[:'severity']
149
+ end
150
+
151
+ if attributes.has_key?(:'message')
152
+ self.message = attributes[:'message']
153
+ end
154
+
155
+ if attributes.has_key?(:'stack_trace')
156
+ self.stack_trace = attributes[:'stack_trace']
157
+ end
158
+
159
+ if attributes.has_key?(:'exception_handled')
160
+ self.exception_handled = attributes[:'exception_handled']
161
+ end
162
+
163
+ if attributes.has_key?(:'topmost_context')
164
+ self.topmost_context = attributes[:'topmost_context']
165
+ end
166
+
167
+ if attributes.has_key?(:'pl_crash_report_file_base64')
168
+ self.pl_crash_report_file_base64 = attributes[:'pl_crash_report_file_base64']
169
+ end
170
+
171
+ if attributes.has_key?(:'ios_image_base_address')
172
+ self.ios_image_base_address = attributes[:'ios_image_base_address']
173
+ end
174
+
175
+ if attributes.has_key?(:'ios_image_size')
176
+ self.ios_image_size = attributes[:'ios_image_size']
177
+ end
178
+
179
+ if attributes.has_key?(:'session_number')
180
+ self.session_number = attributes[:'session_number']
181
+ end
182
+
183
+ end
184
+
185
+ # Show invalid properties with the reasons. Usually used together with valid?
186
+ # @return Array for valid properies with the reasons
187
+ def list_invalid_properties
188
+ invalid_properties = Array.new
189
+ if @class_name.nil?
190
+ invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
191
+ end
192
+
193
+ if @message.nil?
194
+ invalid_properties.push("invalid value for 'message', message cannot be nil.")
195
+ end
196
+
197
+ if @stack_trace.nil?
198
+ invalid_properties.push("invalid value for 'stack_trace', stack_trace cannot be nil.")
199
+ end
200
+
201
+ if @exception_handled.nil?
202
+ invalid_properties.push("invalid value for 'exception_handled', exception_handled cannot be nil.")
203
+ end
204
+
205
+ return invalid_properties
206
+ end
207
+
208
+ # Check to see if the all the properties in the model are valid
209
+ # @return true if the model is valid
210
+ def valid?
211
+ return false if @class_name.nil?
212
+ return false if @message.nil?
213
+ return false if @stack_trace.nil?
214
+ return false if @exception_handled.nil?
215
+ return true
216
+ end
217
+
218
+ # Checks equality by comparing each attribute.
219
+ # @param [Object] Object to be compared
220
+ def ==(o)
221
+ return true if self.equal?(o)
222
+ self.class == o.class &&
223
+ timestamp_unixtime_ms == o.timestamp_unixtime_ms &&
224
+ event_id == o.event_id &&
225
+ source_message_id == o.source_message_id &&
226
+ session_id == o.session_id &&
227
+ session_uuid == o.session_uuid &&
228
+ custom_attributes == o.custom_attributes &&
229
+ location == o.location &&
230
+ device_current_state == o.device_current_state &&
231
+ breadcrumbs == o.breadcrumbs &&
232
+ class_name == o.class_name &&
233
+ severity == o.severity &&
234
+ message == o.message &&
235
+ stack_trace == o.stack_trace &&
236
+ exception_handled == o.exception_handled &&
237
+ topmost_context == o.topmost_context &&
238
+ pl_crash_report_file_base64 == o.pl_crash_report_file_base64 &&
239
+ ios_image_base_address == o.ios_image_base_address &&
240
+ ios_image_size == o.ios_image_size &&
241
+ session_number == o.session_number
242
+ end
243
+
244
+ # @see the `==` method
245
+ # @param [Object] Object to be compared
246
+ def eql?(o)
247
+ self == o
248
+ end
249
+
250
+ # Calculates hash code according to all attributes.
251
+ # @return [Fixnum] Hash code
252
+ def hash
253
+ [timestamp_unixtime_ms, event_id, source_message_id, session_id, session_uuid, custom_attributes, location, device_current_state, breadcrumbs, class_name, severity, message, stack_trace, exception_handled, topmost_context, pl_crash_report_file_base64, ios_image_base_address, ios_image_size, session_number].hash
254
+ end
255
+
256
+ # Builds the object from hash
257
+ # @param [Hash] attributes Model attributes in the form of hash
258
+ # @return [Object] Returns the model itself
259
+ def build_from_hash(attributes)
260
+ return nil unless attributes.is_a?(Hash)
261
+ self.class.swagger_types.each_pair do |key, type|
262
+ if type =~ /\AArray<(.*)>/i
263
+ # check to ensure the input is an array given that the the attribute
264
+ # is documented as an array but the input is not
265
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
266
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
267
+ end
268
+ elsif !attributes[self.class.attribute_map[key]].nil?
269
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
270
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
271
+ end
272
+
273
+ self
274
+ end
275
+
276
+ # Deserializes the data based on type
277
+ # @param string type Data type
278
+ # @param string value Value to be deserialized
279
+ # @return [Object] Deserialized data
280
+ def _deserialize(type, value)
281
+ case type.to_sym
282
+ when :DateTime
283
+ DateTime.parse(value)
284
+ when :Date
285
+ Date.parse(value)
286
+ when :String
287
+ value.to_s
288
+ when :Integer
289
+ value.to_i
290
+ when :Float
291
+ value.to_f
292
+ when :BOOLEAN
293
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
294
+ true
295
+ else
296
+ false
297
+ end
298
+ when :Object
299
+ # generic object (usually a Hash), return directly
300
+ value
301
+ when /\AArray<(?<inner_type>.+)>\z/
302
+ inner_type = Regexp.last_match[:inner_type]
303
+ value.map { |v| _deserialize(inner_type, v) }
304
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
305
+ k_type = Regexp.last_match[:k_type]
306
+ v_type = Regexp.last_match[:v_type]
307
+ {}.tap do |hash|
308
+ value.each do |k, v|
309
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
310
+ end
311
+ end
312
+ else # model
313
+ temp_model = MParticle.const_get(type).new
314
+ temp_model.build_from_hash(value)
315
+ end
316
+ end
317
+
318
+ # Returns the string representation of the object
319
+ # @return [String] String presentation of the object
320
+ def to_s
321
+ to_hash.to_s
322
+ end
323
+
324
+ # to_body is an alias to to_hash (backward compatibility)
325
+ # @return [Hash] Returns the object in the form of hash
326
+ def to_body
327
+ to_hash
328
+ end
329
+
330
+ # Returns the object in the form of hash
331
+ # @return [Hash] Returns the object in the form of hash
332
+ def to_hash
333
+ hash = {}
334
+ self.class.attribute_map.each_pair do |attr, param|
335
+ value = self.send(attr)
336
+ next if value.nil?
337
+ hash[param] = _to_hash(value)
338
+ end
339
+ hash
340
+ end
341
+
342
+ # Outputs non-array value in the form of hash
343
+ # For object, use to_hash. Otherwise, just return the value
344
+ # @param [Object] value Any valid value
345
+ # @return [Hash] Returns the value in the form of hash
346
+ def _to_hash(value)
347
+ if value.is_a?(Array)
348
+ value.compact.map{ |v| _to_hash(v) }
349
+ elsif value.is_a?(Hash)
350
+ {}.tap do |hash|
351
+ value.each { |k, v| hash[k] = _to_hash(v) }
352
+ end
353
+ elsif value.respond_to? :to_hash
354
+ value.to_hash
355
+ else
356
+ value
357
+ end
358
+ end
359
+
360
+ end
361
+
362
+ end