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,257 @@
1
+ require 'date'
2
+
3
+ module MParticle
4
+
5
+ class UserIdentities
6
+ attr_accessor :other
7
+
8
+ attr_accessor :customerid
9
+
10
+ attr_accessor :facebook
11
+
12
+ attr_accessor :twitter
13
+
14
+ attr_accessor :google
15
+
16
+ attr_accessor :microsoft
17
+
18
+ attr_accessor :yahoo
19
+
20
+ attr_accessor :email
21
+
22
+ attr_accessor :_alias
23
+
24
+ attr_accessor :facebook_custom_audience_id
25
+
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'other' => :'other',
31
+ :'customerid' => :'customerid',
32
+ :'facebook' => :'facebook',
33
+ :'twitter' => :'twitter',
34
+ :'google' => :'google',
35
+ :'microsoft' => :'microsoft',
36
+ :'yahoo' => :'yahoo',
37
+ :'email' => :'email',
38
+ :'_alias' => :'alias',
39
+ :'facebook_custom_audience_id' => :'facebook_custom_audience_id'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'other' => :'String',
47
+ :'customerid' => :'String',
48
+ :'facebook' => :'String',
49
+ :'twitter' => :'String',
50
+ :'google' => :'String',
51
+ :'microsoft' => :'String',
52
+ :'yahoo' => :'String',
53
+ :'email' => :'String',
54
+ :'_alias' => :'String',
55
+ :'facebook_custom_audience_id' => :'String'
56
+ }
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
66
+
67
+ if attributes.has_key?(:'other')
68
+ self.other = attributes[:'other']
69
+ end
70
+
71
+ if attributes.has_key?(:'customerid')
72
+ self.customerid = attributes[:'customerid']
73
+ end
74
+
75
+ if attributes.has_key?(:'facebook')
76
+ self.facebook = attributes[:'facebook']
77
+ end
78
+
79
+ if attributes.has_key?(:'twitter')
80
+ self.twitter = attributes[:'twitter']
81
+ end
82
+
83
+ if attributes.has_key?(:'google')
84
+ self.google = attributes[:'google']
85
+ end
86
+
87
+ if attributes.has_key?(:'microsoft')
88
+ self.microsoft = attributes[:'microsoft']
89
+ end
90
+
91
+ if attributes.has_key?(:'yahoo')
92
+ self.yahoo = attributes[:'yahoo']
93
+ end
94
+
95
+ if attributes.has_key?(:'email')
96
+ self.email = attributes[:'email']
97
+ end
98
+
99
+ if attributes.has_key?(:'alias')
100
+ self._alias = attributes[:'alias']
101
+ end
102
+
103
+ if attributes.has_key?(:'facebook_custom_audience_id')
104
+ self.facebook_custom_audience_id = attributes[:'facebook_custom_audience_id']
105
+ end
106
+
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properies with the reasons
111
+ def list_invalid_properties
112
+ invalid_properties = Array.new
113
+ return invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ return true
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ other == o.other &&
128
+ customerid == o.customerid &&
129
+ facebook == o.facebook &&
130
+ twitter == o.twitter &&
131
+ google == o.google &&
132
+ microsoft == o.microsoft &&
133
+ yahoo == o.yahoo &&
134
+ email == o.email &&
135
+ _alias == o._alias &&
136
+ facebook_custom_audience_id == o.facebook_custom_audience_id
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Fixnum] Hash code
147
+ def hash
148
+ [other, customerid, facebook, twitter, google, microsoft, yahoo, email, _alias, facebook_custom_audience_id].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.swagger_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :BOOLEAN
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ temp_model = MParticle.const_get(type).new
209
+ temp_model.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ next if value.nil?
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map{ |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end
@@ -0,0 +1,3 @@
1
+ module MParticle
2
+ VERSION = "1.0.0"
3
+ end
data/lib/mparticle.rb ADDED
@@ -0,0 +1,61 @@
1
+ # Common files
2
+ require 'mparticle/api_client'
3
+ require 'mparticle/api_error'
4
+ require 'mparticle/version'
5
+ require 'mparticle/configuration'
6
+
7
+ # Models
8
+ require 'mparticle/models/api_response'
9
+ require 'mparticle/models/api_response_errors'
10
+ require 'mparticle/models/app_event'
11
+ require 'mparticle/models/application_information'
12
+ require 'mparticle/models/application_state_transition_event'
13
+ require 'mparticle/models/attribution_info'
14
+ require 'mparticle/models/batch'
15
+ require 'mparticle/models/breadcrumb_event'
16
+ require 'mparticle/models/commerce_event'
17
+ require 'mparticle/models/crash_report_event'
18
+ require 'mparticle/models/device_current_state'
19
+ require 'mparticle/models/device_information'
20
+ require 'mparticle/models/event_base'
21
+ require 'mparticle/models/event_data'
22
+ require 'mparticle/models/first_run_event'
23
+ require 'mparticle/models/geo_location'
24
+ require 'mparticle/models/media_info'
25
+ require 'mparticle/models/network_performance_event'
26
+ require 'mparticle/models/opt_out_event'
27
+ require 'mparticle/models/product'
28
+ require 'mparticle/models/product_action'
29
+ require 'mparticle/models/product_impression'
30
+ require 'mparticle/models/profile_event'
31
+ require 'mparticle/models/promotion'
32
+ require 'mparticle/models/promotion_action'
33
+ require 'mparticle/models/push_message_event'
34
+ require 'mparticle/models/push_registration_event'
35
+ require 'mparticle/models/screen_view_event'
36
+ require 'mparticle/models/session_end_event'
37
+ require 'mparticle/models/session_start_event'
38
+ require 'mparticle/models/shopping_cart'
39
+ require 'mparticle/models/source_information'
40
+ require 'mparticle/models/user_identities'
41
+
42
+ # APIs
43
+ require 'mparticle/api/events_api'
44
+
45
+ module MParticle
46
+ class << self
47
+ # Customize default settings for the SDK using block.
48
+ # mParticle.configure do |config|
49
+ # config.api_key = "REPLACE WITH API KEY"
50
+ # config.apiScret = "REPLACE WITH API SECRET"
51
+ # end
52
+ # If no block given, return the default Configuration object.
53
+ def configure
54
+ if block_given?
55
+ yield(Configuration.default)
56
+ else
57
+ Configuration.default
58
+ end
59
+ end
60
+ end
61
+ end
data/mparticle.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "mparticle"
3
+ s.version = "1.0.0"
4
+ s.platform = Gem::Platform::RUBY
5
+ s.authors = ["mParticle Inc."]
6
+ s.email = ["support@mparticle.com"]
7
+ s.homepage = "https://www.mparticle.com"
8
+ s.summary = "Ruby client for the mParticle platform"
9
+ s.description = "Use this client to send your data into the mParticle platform."
10
+ s.license = "Apache-2.0"
11
+ s.required_ruby_version = ">= 1.9"
12
+
13
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
14
+ s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'
15
+
16
+ s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
17
+ s.executables = []
18
+ s.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mparticle
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - mParticle Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: json
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '1.8'
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: 1.8.3
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '1.8'
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: 1.8.3
53
+ description: Use this client to send your data into the mParticle platform.
54
+ email:
55
+ - support@mparticle.com
56
+ executables: []
57
+ extensions: []
58
+ extra_rdoc_files: []
59
+ files:
60
+ - README.md
61
+ - docs/ApiResponse.md
62
+ - docs/ApiResponseErrors.md
63
+ - docs/AppEvent.md
64
+ - docs/ApplicationInformation.md
65
+ - docs/ApplicationStateTransitionEvent.md
66
+ - docs/AttributionInfo.md
67
+ - docs/Batch.md
68
+ - docs/BreadcrumbEvent.md
69
+ - docs/CommerceEvent.md
70
+ - docs/CrashReportEvent.md
71
+ - docs/DeviceCurrentState.md
72
+ - docs/DeviceInformation.md
73
+ - docs/EventBase.md
74
+ - docs/EventData.md
75
+ - docs/EventsApi.md
76
+ - docs/FirstRunEvent.md
77
+ - docs/GeoLocation.md
78
+ - docs/MediaInfo.md
79
+ - docs/NetworkPerformanceEvent.md
80
+ - docs/OptOutEvent.md
81
+ - docs/Product.md
82
+ - docs/ProductAction.md
83
+ - docs/ProductImpression.md
84
+ - docs/ProfileEvent.md
85
+ - docs/Promotion.md
86
+ - docs/PromotionAction.md
87
+ - docs/PushMessageEvent.md
88
+ - docs/PushRegistrationEvent.md
89
+ - docs/ScreenViewEvent.md
90
+ - docs/SessionEndEvent.md
91
+ - docs/SessionStartEvent.md
92
+ - docs/ShoppingCart.md
93
+ - docs/SourceInformation.md
94
+ - docs/UserIdentities.md
95
+ - example/main.rb
96
+ - lib/.DS_Store
97
+ - lib/mparticle.rb
98
+ - lib/mparticle/.DS_Store
99
+ - lib/mparticle/api/events_api.rb
100
+ - lib/mparticle/api_client.rb
101
+ - lib/mparticle/api_error.rb
102
+ - lib/mparticle/configuration.rb
103
+ - lib/mparticle/models/api_response.rb
104
+ - lib/mparticle/models/api_response_errors.rb
105
+ - lib/mparticle/models/app_event.rb
106
+ - lib/mparticle/models/application_information.rb
107
+ - lib/mparticle/models/application_state_transition_event.rb
108
+ - lib/mparticle/models/attribution_info.rb
109
+ - lib/mparticle/models/batch.rb
110
+ - lib/mparticle/models/breadcrumb_event.rb
111
+ - lib/mparticle/models/commerce_event.rb
112
+ - lib/mparticle/models/crash_report_event.rb
113
+ - lib/mparticle/models/device_current_state.rb
114
+ - lib/mparticle/models/device_information.rb
115
+ - lib/mparticle/models/event_base.rb
116
+ - lib/mparticle/models/event_data.rb
117
+ - lib/mparticle/models/first_run_event.rb
118
+ - lib/mparticle/models/geo_location.rb
119
+ - lib/mparticle/models/media_info.rb
120
+ - lib/mparticle/models/network_performance_event.rb
121
+ - lib/mparticle/models/opt_out_event.rb
122
+ - lib/mparticle/models/product.rb
123
+ - lib/mparticle/models/product_action.rb
124
+ - lib/mparticle/models/product_impression.rb
125
+ - lib/mparticle/models/profile_event.rb
126
+ - lib/mparticle/models/promotion.rb
127
+ - lib/mparticle/models/promotion_action.rb
128
+ - lib/mparticle/models/push_message_event.rb
129
+ - lib/mparticle/models/push_registration_event.rb
130
+ - lib/mparticle/models/screen_view_event.rb
131
+ - lib/mparticle/models/session_end_event.rb
132
+ - lib/mparticle/models/session_start_event.rb
133
+ - lib/mparticle/models/shopping_cart.rb
134
+ - lib/mparticle/models/source_information.rb
135
+ - lib/mparticle/models/user_identities.rb
136
+ - lib/mparticle/version.rb
137
+ - mparticle.gemspec
138
+ homepage: https://www.mparticle.com
139
+ licenses:
140
+ - Apache-2.0
141
+ metadata: {}
142
+ post_install_message:
143
+ rdoc_options: []
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '1.9'
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ requirements: []
157
+ rubyforge_project:
158
+ rubygems_version: 2.0.14.1
159
+ signing_key:
160
+ specification_version: 4
161
+ summary: Ruby client for the mParticle platform
162
+ test_files: []
163
+ has_rdoc: