mparticle 1.0.6 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9762788a48567b16db7faaf386973958808cfabeca373df4269b1a45a3906641
4
- data.tar.gz: f1ef718e0e8454bfb1eb8589b9133be95b462f6d8edf4d8f4ceec3a0f1592645
3
+ metadata.gz: 2e643f74d5e885c07ad75683d3051bbab37e1736d423d013a03c9d69ac57eaea
4
+ data.tar.gz: cdc2cc3d1adb8a2455cbe51eb081a2c3ce81ee72377ae7dac48fd88357ec5f0f
5
5
  SHA512:
6
- metadata.gz: 1d13b1ea200c1df11fbb53e2dd152eca13f7bc5b3b90d615f7a9452782b083e80f55c910c70a21bd483bee55aaecf442e83b06a4e463ec1a553552c5c2be2950
7
- data.tar.gz: 71421fb7806a281311039f53d627df412953e91151feeb66b80dc3d61edd32eb1bbc05f129901187f055799ca200c239b916b51b8a02b8e05199b927fdd403b6
6
+ metadata.gz: 412958414338ad3f126b1e57078c350d748593c5917f53252f1abaf3b8500d11a7cfd04e9cbe022cffc260d6ed908798e20bba1464d9ca84716bde3c35025816
7
+ data.tar.gz: a57f039027d6d5106a9d63e2de08eabdbd99e18a9121bcc0178b7327a4566f939560abd1e9a1a6c2fb6e4c0aec6c1d02e33f063fa79dc941a73385bb8f8d4685
data/README.md CHANGED
@@ -41,6 +41,11 @@ api_instance = MParticle::EventsApi.new(config)
41
41
 
42
42
  batch = MParticle::Batch.new
43
43
  batch.environment = 'development'
44
+ batch.context = MParticle::BatchContext.new
45
+
46
+ batch.context.data_plan = MParticle::DataPlanContext.new
47
+ batch.context.data_plan.plan_id = 'my_plan_id'
48
+ batch.context.data_plan.plan_version = 1
44
49
 
45
50
  user_identities = MParticle::UserIdentities.new
46
51
  user_identities.customerid = '12345'
data/docs/Batch.md CHANGED
@@ -18,3 +18,6 @@
18
18
  | **api_key** | **String** | | [optional] |
19
19
  | **mpid** | **Integer** | | [optional] |
20
20
  | **mp_deviceid** | **String** | | [optional] |
21
+ | **timestamp_unixtime_ms** | **Integer** | | [optional] |
22
+ | **context** | [**BatchContext**](BatchContext.md) | | [optional] |
23
+ | **integration_attributes** | **Hash<Integer,Hash<String,String>>** | | [optional] |
@@ -35,6 +35,8 @@ Name | Type | Description | Notes
35
35
  **has_nfc** | **BOOLEAN** | | [optional]
36
36
  **bluetooth_enabled** | **BOOLEAN** | | [optional]
37
37
  **bluetooth_version** | **String** | | [optional]
38
+ **att_timestamp_unixtime_ms** | **Integer** | | [optional]
39
+ **att_authorization_status** | **String** | | [optional]
38
40
  **ios_idfv** | **String** | | [optional]
39
41
  **android_advertising_id** | **String** | | [optional]
40
42
 
@@ -13,5 +13,17 @@ Name | Type | Description | Notes
13
13
  **email** | **String** | | [optional]
14
14
  **_alias** | **String** | | [optional]
15
15
  **facebook_custom_audience_id** | **String** | | [optional]
16
+ **other_id_2** | **String** | | [optional]
17
+ **other_id_3** | **String** | | [optional]
18
+ **other_id_4** | **String** | | [optional]
19
+ **other_id_5** | **String** | | [optional]
20
+ **other_id_6** | **String** | | [optional]
21
+ **other_id_7** | **String** | | [optional]
22
+ **other_id_8** | **String** | | [optional]
23
+ **other_id_9** | **String** | | [optional]
24
+ **other_id_10** | **String** | | [optional]
25
+ **mobile_number** | **String** | | [optional]
26
+ **phone_number_2** | **String** | | [optional]
27
+ **phone_number_3** | **String** | | [optional]
16
28
 
17
29
 
data/example/main.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  # load the gem
4
4
  require 'mparticle'
5
+ require 'date'
5
6
  config = MParticle::Configuration.new
6
7
  config.api_key = 'REPLACE WITH API KEY'
7
8
  config.api_secret = 'REPLACE WITH API SECRET'
@@ -10,8 +11,13 @@ config.api_secret = 'REPLACE WITH API SECRET'
10
11
  api_instance = MParticle::EventsApi.new(config)
11
12
 
12
13
  batch = MParticle::Batch.new
14
+ batch.timestamp_unixtime_ms = DateTime.now.strftime('%Q').to_i
13
15
  batch.environment = 'development'
14
16
 
17
+ batch.device_info = MParticle::DeviceInformation.new
18
+ batch.device_info.att_timestamp_unixtime_ms = DateTime.now.strftime('%Q').to_i
19
+ batch.device_info.att_authorization_status = 'authorized'
20
+
15
21
  user_identities = MParticle::UserIdentities.new
16
22
  user_identities.customerid = '12345'
17
23
 
@@ -54,14 +60,14 @@ batch.user_identities = user_identities
54
60
  ccpa_consent_state = MParticle::CCPAConsentState.new
55
61
  ccpa_consent_state.document = 'document.agreement.v3'
56
62
  ccpa_consent_state.consented = true
57
- ccpa_consent_state.timestamp_unixtime_ms = Time.now.to_i
63
+ ccpa_consent_state.timestamp_unixtime_ms = (Time.now.to_f * 1000).to_i
58
64
  ccpa_consent_state.location = 'mparticle.test/signup'
59
65
  ccpa_consent_state.hardware_id = 'IDFA:a5d96n32-224a-3b11-1088-a202695bc710'
60
66
 
61
67
  gdpr_consent_state = MParticle::GDPRConsentState.new
62
68
  gdpr_consent_state.document = 'document_agreement.v2'
63
69
  gdpr_consent_state.consented = true
64
- gdpr_consent_state.timestamp_unixtime_ms = Time.now.to_i
70
+ gdpr_consent_state.timestamp_unixtime_ms = (Time.now.to_f * 1000).to_i
65
71
  gdpr_consent_state.location = 'dtmgbank.com/signup'
66
72
  gdpr_consent_state.hardware_id = 'IDFA:a5d934n0-232f-4afc-2e9a-3832d95zc702'
67
73
 
@@ -86,5 +92,5 @@ begin
86
92
  # wait for the thread, otherwise process may exit too early
87
93
  thread.join
88
94
  rescue MParticle::ApiError => e
89
- puts "Exception when calling mParticle: #{e}"
95
+ puts "Exception when calling mParticle: #{e.code}"
90
96
  end
data/lib/mparticle.rb CHANGED
@@ -41,6 +41,8 @@ require 'mparticle/models/session_start_event'
41
41
  require 'mparticle/models/shopping_cart'
42
42
  require 'mparticle/models/source_information'
43
43
  require 'mparticle/models/user_identities'
44
+ require 'mparticle/models/batch_context'
45
+ require 'mparticle/models/data_plan_context'
44
46
 
45
47
  # APIs
46
48
  require 'mparticle/api/events_api'
@@ -19,7 +19,7 @@ module MParticle
19
19
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
20
20
  def initialize(config)
21
21
  @config = config
22
- @user_agent = "mParticle Ruby client/1.0.3"
22
+ @user_agent = "mParticle Ruby client/1.1.0"
23
23
  @default_headers = {
24
24
  'Content-Type' => "application/json",
25
25
  'User-Agent' => @user_agent
@@ -31,6 +31,12 @@ module MParticle
31
31
 
32
32
  attr_accessor :mp_deviceid
33
33
 
34
+ attr_accessor :timestamp_unixtime_ms
35
+
36
+ attr_accessor :context
37
+
38
+ attr_accessor :integration_attributes
39
+
34
40
  class EnumAttributeValidator
35
41
  attr_reader :datatype
36
42
  attr_reader :allowable_values
@@ -109,7 +115,10 @@ module MParticle
109
115
  :'user_identities' => :'user_identities',
110
116
  :'api_key' => :'api_key',
111
117
  :'mpid' => :'mpid',
112
- :'mp_deviceid' => :'mp_deviceid'
118
+ :'mp_deviceid' => :'mp_deviceid',
119
+ :'timestamp_unixtime_ms' => :'timestamp_unixtime_ms',
120
+ :'context' => :'context',
121
+ :'integration_attributes' => :'integration_attributes'
113
122
  }
114
123
  end
115
124
 
@@ -128,7 +137,11 @@ module MParticle
128
137
  :'user_identities' => :'UserIdentities',
129
138
  :'api_key' => :'String',
130
139
  :'mpid' => :'Integer',
131
- :'mp_deviceid' => :'String'
140
+ :'mp_deviceid' => :'String',
141
+ :'timestamp_unixtime_ms' => :'Integer',
142
+ :'consent_state' => :'ConsentState',
143
+ :'context' => :'BatchContext',
144
+ :'integration_attributes' => :'Hash<Integer,Hash<String,String>>'
132
145
  }
133
146
  end
134
147
 
@@ -196,6 +209,22 @@ module MParticle
196
209
  self.mp_deviceid = attributes[:'mp_deviceid']
197
210
  end
198
211
 
212
+ if attributes.has_key?(:'timestamp_unixtime_ms')
213
+ self.timestamp_unixtime_ms = attributes[:'timestamp_unixtime_ms']
214
+ end
215
+
216
+ if attributes.has_key?(:'consent_state')
217
+ self.consent_state = attributes[:'consent_state']
218
+ end
219
+
220
+ if attributes.has_key?(:'context')
221
+ self.context = attributes[:'context']
222
+ end
223
+
224
+ if attributes.has_key?(:'integration_attributes')
225
+ self.integration_attributes = attributes[:'integration_attributes']
226
+ end
227
+
199
228
  end
200
229
 
201
230
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -245,7 +274,9 @@ module MParticle
245
274
  user_identities == o.user_identities &&
246
275
  api_key == o.api_key &&
247
276
  mpid == o.mpid &&
248
- mp_deviceid == o.mp_deviceid
277
+ mp_deviceid == o.mp_deviceid &&
278
+ timestamp_unixtime_ms == o.timestamp_unixtime_ms &&
279
+ integration_attributes == o.integration_attributes
249
280
  end
250
281
 
251
282
  # @see the `==` method
@@ -257,7 +288,7 @@ module MParticle
257
288
  # Calculates hash code according to all attributes.
258
289
  # @return [Fixnum] Hash code
259
290
  def hash
260
- [events, source_request_id, environment, ip, schema_version, device_info, application_info, user_attributes, deleted_user_attributes, user_identities, api_key, mpid, mp_deviceid].hash
291
+ [events, source_request_id, environment, ip, schema_version, device_info, application_info, user_attributes, deleted_user_attributes, user_identities, api_key, mpid, mp_deviceid, timestamp_unixtime_ms, integration_attributes].hash
261
292
  end
262
293
 
263
294
  # Builds the object from hash
@@ -0,0 +1,177 @@
1
+ require 'date'
2
+
3
+ module MParticle
4
+
5
+ class BatchContext
6
+ attr_accessor :data_plan
7
+
8
+
9
+ # Attribute mapping from ruby-style variable name to JSON key.
10
+ def self.attribute_map
11
+ {
12
+ :'data_plan' => :'data_plan'
13
+ }
14
+ end
15
+
16
+ # Attribute type mapping.
17
+ def self.swagger_types
18
+ {
19
+ :'data_plan' => :'DataPlanContext'
20
+ }
21
+ end
22
+
23
+ # Initializes the object
24
+ # @param [Hash] attributes Model attributes in the form of hash
25
+ def initialize(attributes = {})
26
+ return unless attributes.is_a?(Hash)
27
+
28
+ # convert string to symbol for hash key
29
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
30
+
31
+ if attributes.has_key?(:'data_plan')
32
+ self.data_plan = attributes[:'data_plan']
33
+ end
34
+
35
+ end
36
+
37
+ # Show invalid properties with the reasons. Usually used together with valid?
38
+ # @return Array for valid properies with the reasons
39
+ def list_invalid_properties
40
+ invalid_properties = Array.new
41
+ return invalid_properties
42
+ end
43
+
44
+ # Check to see if the all the properties in the model are valid
45
+ # @return true if the model is valid
46
+ def valid?
47
+ return true
48
+ end
49
+
50
+ # Checks equality by comparing each attribute.
51
+ # @param [Object] Object to be compared
52
+ def ==(o)
53
+ return true if self.equal?(o)
54
+ self.class == o.class &&
55
+ data_plan == o.data_plan
56
+
57
+ end
58
+
59
+ # @see the `==` method
60
+ # @param [Object] Object to be compared
61
+ def eql?(o)
62
+ self == o
63
+ end
64
+
65
+ # Calculates hash code according to all attributes.
66
+ # @return [Fixnum] Hash code
67
+ def hash
68
+ [data_plan].hash
69
+ end
70
+
71
+ # Builds the object from hash
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ # @return [Object] Returns the model itself
74
+ def build_from_hash(attributes)
75
+ return nil unless attributes.is_a?(Hash)
76
+ self.class.swagger_types.each_pair do |key, type|
77
+ if type =~ /\AArray<(.*)>/i
78
+ # check to ensure the input is an array given that the the attribute
79
+ # is documented as an array but the input is not
80
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
81
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
82
+ end
83
+ elsif !attributes[self.class.attribute_map[key]].nil?
84
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
85
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
86
+ end
87
+
88
+ self
89
+ end
90
+
91
+ # Deserializes the data based on type
92
+ # @param string type Data type
93
+ # @param string value Value to be deserialized
94
+ # @return [Object] Deserialized data
95
+ def _deserialize(type, value)
96
+ case type.to_sym
97
+ when :DateTime
98
+ DateTime.parse(value)
99
+ when :Date
100
+ Date.parse(value)
101
+ when :String
102
+ value.to_s
103
+ when :Integer
104
+ value.to_i
105
+ when :Float
106
+ value.to_f
107
+ when :BOOLEAN
108
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
109
+ true
110
+ else
111
+ false
112
+ end
113
+ when :Object
114
+ # generic object (usually a Hash), return directly
115
+ value
116
+ when /\AArray<(?<inner_type>.+)>\z/
117
+ inner_type = Regexp.last_match[:inner_type]
118
+ value.map { |v| _deserialize(inner_type, v) }
119
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
120
+ k_type = Regexp.last_match[:k_type]
121
+ v_type = Regexp.last_match[:v_type]
122
+ {}.tap do |hash|
123
+ value.each do |k, v|
124
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
125
+ end
126
+ end
127
+ else # model
128
+ temp_model = MParticle.const_get(type).new
129
+ temp_model.build_from_hash(value)
130
+ end
131
+ end
132
+
133
+ # Returns the string representation of the object
134
+ # @return [String] String presentation of the object
135
+ def to_s
136
+ to_hash.to_s
137
+ end
138
+
139
+ # to_body is an alias to to_hash (backward compatibility)
140
+ # @return [Hash] Returns the object in the form of hash
141
+ def to_body
142
+ to_hash
143
+ end
144
+
145
+ # Returns the object in the form of hash
146
+ # @return [Hash] Returns the object in the form of hash
147
+ def to_hash
148
+ hash = {}
149
+ self.class.attribute_map.each_pair do |attr, param|
150
+ value = self.send(attr)
151
+ next if value.nil?
152
+ hash[param] = _to_hash(value)
153
+ end
154
+ hash
155
+ end
156
+
157
+ # Outputs non-array value in the form of hash
158
+ # For object, use to_hash. Otherwise, just return the value
159
+ # @param [Object] value Any valid value
160
+ # @return [Hash] Returns the value in the form of hash
161
+ def _to_hash(value)
162
+ if value.is_a?(Array)
163
+ value.compact.map{ |v| _to_hash(v) }
164
+ elsif value.is_a?(Hash)
165
+ {}.tap do |hash|
166
+ value.each { |k, v| hash[k] = _to_hash(v) }
167
+ end
168
+ elsif value.respond_to? :to_hash
169
+ value.to_hash
170
+ else
171
+ value
172
+ end
173
+ end
174
+
175
+ end
176
+
177
+ end
@@ -0,0 +1,186 @@
1
+ require 'date'
2
+
3
+ module MParticle
4
+
5
+ class DataPlanContext
6
+ attr_accessor :plan_id
7
+
8
+ attr_accessor :plan_version
9
+
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+ :'plan_id' => :'plan_id',
15
+ :'plan_version' => :'plan_version'
16
+ }
17
+ end
18
+
19
+ # Attribute type mapping.
20
+ def self.swagger_types
21
+ {
22
+ :'plan_id' => :'String',
23
+ :'plan_version' => :'Integer'
24
+ }
25
+ end
26
+
27
+ # Initializes the object
28
+ # @param [Hash] attributes Model attributes in the form of hash
29
+ def initialize(attributes = {})
30
+ return unless attributes.is_a?(Hash)
31
+
32
+ # convert string to symbol for hash key
33
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
34
+
35
+ if attributes.has_key?(:'plan_id')
36
+ self.plan_id = attributes[:'plan_id']
37
+ end
38
+
39
+ if attributes.has_key?(:'plan_version')
40
+ self.plan_version = attributes[:'plan_version']
41
+ end
42
+
43
+ end
44
+
45
+ # Show invalid properties with the reasons. Usually used together with valid?
46
+ # @return Array for valid properies with the reasons
47
+ def list_invalid_properties
48
+ invalid_properties = Array.new
49
+ return invalid_properties
50
+ end
51
+
52
+ # Check to see if the all the properties in the model are valid
53
+ # @return true if the model is valid
54
+ def valid?
55
+ return true
56
+ end
57
+
58
+ # Checks equality by comparing each attribute.
59
+ # @param [Object] Object to be compared
60
+ def ==(o)
61
+ return true if self.equal?(o)
62
+ self.class == o.class &&
63
+ plan_id == o.plan_id &&
64
+ plan_version == o.plan_version
65
+
66
+ end
67
+
68
+ # @see the `==` method
69
+ # @param [Object] Object to be compared
70
+ def eql?(o)
71
+ self == o
72
+ end
73
+
74
+ # Calculates hash code according to all attributes.
75
+ # @return [Fixnum] Hash code
76
+ def hash
77
+ [plan_id, plan_version].hash
78
+ end
79
+
80
+ # Builds the object from hash
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ # @return [Object] Returns the model itself
83
+ def build_from_hash(attributes)
84
+ return nil unless attributes.is_a?(Hash)
85
+ self.class.swagger_types.each_pair do |key, type|
86
+ if type =~ /\AArray<(.*)>/i
87
+ # check to ensure the input is an array given that the the attribute
88
+ # is documented as an array but the input is not
89
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
90
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
91
+ end
92
+ elsif !attributes[self.class.attribute_map[key]].nil?
93
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
94
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
95
+ end
96
+
97
+ self
98
+ end
99
+
100
+ # Deserializes the data based on type
101
+ # @param string type Data type
102
+ # @param string value Value to be deserialized
103
+ # @return [Object] Deserialized data
104
+ def _deserialize(type, value)
105
+ case type.to_sym
106
+ when :DateTime
107
+ DateTime.parse(value)
108
+ when :Date
109
+ Date.parse(value)
110
+ when :String
111
+ value.to_s
112
+ when :Integer
113
+ value.to_i
114
+ when :Float
115
+ value.to_f
116
+ when :BOOLEAN
117
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
118
+ true
119
+ else
120
+ false
121
+ end
122
+ when :Object
123
+ # generic object (usually a Hash), return directly
124
+ value
125
+ when /\AArray<(?<inner_type>.+)>\z/
126
+ inner_type = Regexp.last_match[:inner_type]
127
+ value.map { |v| _deserialize(inner_type, v) }
128
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
129
+ k_type = Regexp.last_match[:k_type]
130
+ v_type = Regexp.last_match[:v_type]
131
+ {}.tap do |hash|
132
+ value.each do |k, v|
133
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
134
+ end
135
+ end
136
+ else # model
137
+ temp_model = MParticle.const_get(type).new
138
+ temp_model.build_from_hash(value)
139
+ end
140
+ end
141
+
142
+ # Returns the string representation of the object
143
+ # @return [String] String presentation of the object
144
+ def to_s
145
+ to_hash.to_s
146
+ end
147
+
148
+ # to_body is an alias to to_hash (backward compatibility)
149
+ # @return [Hash] Returns the object in the form of hash
150
+ def to_body
151
+ to_hash
152
+ end
153
+
154
+ # Returns the object in the form of hash
155
+ # @return [Hash] Returns the object in the form of hash
156
+ def to_hash
157
+ hash = {}
158
+ self.class.attribute_map.each_pair do |attr, param|
159
+ value = self.send(attr)
160
+ next if value.nil?
161
+ hash[param] = _to_hash(value)
162
+ end
163
+ hash
164
+ end
165
+
166
+ # Outputs non-array value in the form of hash
167
+ # For object, use to_hash. Otherwise, just return the value
168
+ # @param [Object] value Any valid value
169
+ # @return [Hash] Returns the value in the form of hash
170
+ def _to_hash(value)
171
+ if value.is_a?(Array)
172
+ value.compact.map{ |v| _to_hash(v) }
173
+ elsif value.is_a?(Hash)
174
+ {}.tap do |hash|
175
+ value.each { |k, v| hash[k] = _to_hash(v) }
176
+ end
177
+ elsif value.respond_to? :to_hash
178
+ value.to_hash
179
+ else
180
+ value
181
+ end
182
+ end
183
+
184
+ end
185
+
186
+ end
@@ -67,6 +67,10 @@ module MParticle
67
67
 
68
68
  attr_accessor :bluetooth_version
69
69
 
70
+ attr_accessor :att_timestamp_unixtime_ms
71
+
72
+ attr_accessor :att_authorization_status
73
+
70
74
  attr_accessor :ios_idfv
71
75
 
72
76
  attr_accessor :android_advertising_id
@@ -128,6 +132,8 @@ module MParticle
128
132
  :'has_nfc' => :'has_nfc',
129
133
  :'bluetooth_enabled' => :'bluetooth_enabled',
130
134
  :'bluetooth_version' => :'bluetooth_version',
135
+ :'att_timestamp_unixtime_ms' => :'att_timestamp_unixtime_ms',
136
+ :'att_authorization_status' => :'att_authorization_status',
131
137
  :'ios_idfv' => :'ios_idfv',
132
138
  :'android_advertising_id' => :'android_advertising_id'
133
139
  }
@@ -168,6 +174,8 @@ module MParticle
168
174
  :'has_nfc' => :'BOOLEAN',
169
175
  :'bluetooth_enabled' => :'BOOLEAN',
170
176
  :'bluetooth_version' => :'String',
177
+ :'att_timestamp_unixtime_ms' => :'Integer',
178
+ :'att_authorization_status' => :'String',
171
179
  :'ios_idfv' => :'String',
172
180
  :'android_advertising_id' => :'String'
173
181
  }
@@ -309,6 +317,14 @@ module MParticle
309
317
  self.bluetooth_version = attributes[:'bluetooth_version']
310
318
  end
311
319
 
320
+ if attributes.has_key?(:'att_timestamp_unixtime_ms')
321
+ self.att_timestamp_unixtime_ms = attributes[:'att_timestamp_unixtime_ms']
322
+ end
323
+
324
+ if attributes.has_key?(:'att_authorization_status')
325
+ self.att_authorization_status = attributes[:'att_authorization_status']
326
+ end
327
+
312
328
  if attributes.has_key?(:'ios_idfv')
313
329
  self.ios_idfv = attributes[:'ios_idfv']
314
330
  end
@@ -330,7 +346,9 @@ module MParticle
330
346
  # @return true if the model is valid
331
347
  def valid?
332
348
  platform_validator = EnumAttributeValidator.new('String', ["Unknown", "iOS", "Android", "tvOS"])
349
+ att_validator = EnumAttributeValidator.new('String', ["authorized", "denied", "not_determined", "restricted"])
333
350
  return false unless platform_validator.valid?(@platform)
351
+ return false unless att_validator.valid?(@att_authorization_status)
334
352
  return true
335
353
  end
336
354
 
@@ -344,6 +362,16 @@ module MParticle
344
362
  @platform = platform
345
363
  end
346
364
 
365
+ # Custom attribute writer method checking allowed values (enum).
366
+ # @param [Object] att_authorization_status Object to be assigned
367
+ def att_authorization_status=(att_authorization_status)
368
+ validator = EnumAttributeValidator.new('String', ["authorized", "denied", "not_determined", "restricted"])
369
+ unless validator.valid?(att_authorization_status)
370
+ fail ArgumentError, "invalid value for 'att_authorization_status', must be one of #{validator.allowable_values}."
371
+ end
372
+ @att_authorization_status = att_authorization_status
373
+ end
374
+
347
375
  # Checks equality by comparing each attribute.
348
376
  # @param [Object] Object to be compared
349
377
  def ==(o)
@@ -381,6 +409,8 @@ module MParticle
381
409
  has_nfc == o.has_nfc &&
382
410
  bluetooth_enabled == o.bluetooth_enabled &&
383
411
  bluetooth_version == o.bluetooth_version &&
412
+ att_timestamp_unixtime_ms == o.att_timestamp_unixtime_ms &&
413
+ att_authorization_status == o.att_authorization_status &&
384
414
  ios_idfv == o.ios_idfv &&
385
415
  android_advertising_id == o.android_advertising_id
386
416
  end
@@ -394,7 +424,7 @@ module MParticle
394
424
  # Calculates hash code according to all attributes.
395
425
  # @return [Fixnum] Hash code
396
426
  def hash
397
- [brand, product, device, android_uuid, device_manufacturer, platform, os_version, device_model, screen_height, screen_width, screen_dpi, device_country, locale_language, locale_country, network_country, network_carrier, network_code, network_mobile_country_code, timezone_offset, build_identifier, http_header_user_agent, ios_advertising_id, push_token, cpu_architecture, is_tablet, push_notification_sound_enabled, push_notification_vibrate_enabled, radio_access_technology, supports_telephony, has_nfc, bluetooth_enabled, bluetooth_version, ios_idfv, android_advertising_id].hash
427
+ [brand, product, device, android_uuid, device_manufacturer, platform, os_version, device_model, screen_height, screen_width, screen_dpi, device_country, locale_language, locale_country, network_country, network_carrier, network_code, network_mobile_country_code, timezone_offset, build_identifier, http_header_user_agent, ios_advertising_id, push_token, cpu_architecture, is_tablet, push_notification_sound_enabled, push_notification_vibrate_enabled, radio_access_technology, supports_telephony, has_nfc, bluetooth_enabled, bluetooth_version, att_timestamp_unixtime_ms, att_authorization_status, ios_idfv, android_advertising_id].hash
398
428
  end
399
429
 
400
430
  # Builds the object from hash
@@ -23,6 +23,30 @@ module MParticle
23
23
 
24
24
  attr_accessor :facebook_custom_audience_id
25
25
 
26
+ attr_accessor :other_id_2
27
+
28
+ attr_accessor :other_id_3
29
+
30
+ attr_accessor :other_id_4
31
+
32
+ attr_accessor :other_id_5
33
+
34
+ attr_accessor :other_id_6
35
+
36
+ attr_accessor :other_id_7
37
+
38
+ attr_accessor :other_id_8
39
+
40
+ attr_accessor :other_id_9
41
+
42
+ attr_accessor :other_id_10
43
+
44
+ attr_accessor :mobile_number
45
+
46
+ attr_accessor :phone_number_2
47
+
48
+ attr_accessor :phone_number_3
49
+
26
50
 
27
51
  # Attribute mapping from ruby-style variable name to JSON key.
28
52
  def self.attribute_map
@@ -36,7 +60,19 @@ module MParticle
36
60
  :'yahoo' => :'yahoo',
37
61
  :'email' => :'email',
38
62
  :'_alias' => :'alias',
39
- :'facebook_custom_audience_id' => :'facebook_custom_audience_id'
63
+ :'facebook_custom_audience_id' => :'facebook_custom_audience_id',
64
+ :'other_id_2' => :'other_id_2',
65
+ :'other_id_3' => :'other_id_3',
66
+ :'other_id_4' => :'other_id_4',
67
+ :'other_id_5' => :'other_id_5',
68
+ :'other_id_6' => :'other_id_6',
69
+ :'other_id_7' => :'other_id_7',
70
+ :'other_id_8' => :'other_id_8',
71
+ :'other_id_9' => :'other_id_9',
72
+ :'other_id_10' => :'other_id_10',
73
+ :'mobile_number' => :'mobile_number',
74
+ :'phone_number_2' => :'phone_number_2',
75
+ :'phone_number_3' => :'phone_number_3'
40
76
  }
41
77
  end
42
78
 
@@ -52,7 +88,19 @@ module MParticle
52
88
  :'yahoo' => :'String',
53
89
  :'email' => :'String',
54
90
  :'_alias' => :'String',
55
- :'facebook_custom_audience_id' => :'String'
91
+ :'facebook_custom_audience_id' => :'String',
92
+ :'other_id_2' => :'String',
93
+ :'other_id_3' => :'String',
94
+ :'other_id_4' => :'String',
95
+ :'other_id_5' => :'String',
96
+ :'other_id_6' => :'String',
97
+ :'other_id_7' => :'String',
98
+ :'other_id_8' => :'String',
99
+ :'other_id_9' => :'String',
100
+ :'other_id_10' => :'String',
101
+ :'mobile_number' => :'String',
102
+ :'phone_number_2' => :'String',
103
+ :'phone_number_3' => :'String'
56
104
  }
57
105
  end
58
106
 
@@ -104,6 +152,54 @@ module MParticle
104
152
  self.facebook_custom_audience_id = attributes[:'facebook_custom_audience_id']
105
153
  end
106
154
 
155
+ if attributes.has_key?(:'other_id_2')
156
+ self.other_id_2 = attributes[:'other_id_2']
157
+ end
158
+
159
+ if attributes.has_key?(:'other_id_3')
160
+ self.other_id_3 = attributes[:'other_id_3']
161
+ end
162
+
163
+ if attributes.has_key?(:'other_id_4')
164
+ self.other_id_4 = attributes[:'other_id_4']
165
+ end
166
+
167
+ if attributes.has_key?(:'other_id_5')
168
+ self.other_id_5 = attributes[:'other_id_5']
169
+ end
170
+
171
+ if attributes.has_key?(:'other_id_6')
172
+ self.other_id_6 = attributes[:'other_id_6']
173
+ end
174
+
175
+ if attributes.has_key?(:'other_id_7')
176
+ self.other_id_7 = attributes[:'other_id_7']
177
+ end
178
+
179
+ if attributes.has_key?(:'other_id_8')
180
+ self.other_id_8 = attributes[:'other_id_8']
181
+ end
182
+
183
+ if attributes.has_key?(:'other_id_9')
184
+ self.other_id_9 = attributes[:'other_id_9']
185
+ end
186
+
187
+ if attributes.has_key?(:'other_id_10')
188
+ self.other_id_10 = attributes[:'other_id_10']
189
+ end
190
+
191
+ if attributes.has_key?(:'mobile_number')
192
+ self.mobile_number = attributes[:'mobile_number']
193
+ end
194
+
195
+ if attributes.has_key?(:'phone_number_2')
196
+ self.phone_number_2 = attributes[:'phone_number_2']
197
+ end
198
+
199
+ if attributes.has_key?(:'phone_number_3')
200
+ self.phone_number_3 = attributes[:'phone_number_3']
201
+ end
202
+
107
203
  end
108
204
 
109
205
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -133,7 +229,19 @@ module MParticle
133
229
  yahoo == o.yahoo &&
134
230
  email == o.email &&
135
231
  _alias == o._alias &&
136
- facebook_custom_audience_id == o.facebook_custom_audience_id
232
+ facebook_custom_audience_id == o.facebook_custom_audience_id &&
233
+ other_id_2 == o.other_id_2 &&
234
+ other_id_3 == o.other_id_3 &&
235
+ other_id_4 == o.other_id_4 &&
236
+ other_id_5 == o.other_id_5 &&
237
+ other_id_6 == o.other_id_6 &&
238
+ other_id_7 == o.other_id_7 &&
239
+ other_id_8 == o.other_id_8 &&
240
+ other_id_9 == o.other_id_9 &&
241
+ other_id_10 == o.other_id_10 &&
242
+ mobile_number == o.mobile_number &&
243
+ phone_number_2 == o.phone_number_2 &&
244
+ phone_number_3 == o.phone_number_3
137
245
  end
138
246
 
139
247
  # @see the `==` method
@@ -145,7 +253,7 @@ module MParticle
145
253
  # Calculates hash code according to all attributes.
146
254
  # @return [Fixnum] Hash code
147
255
  def hash
148
- [other, customerid, facebook, twitter, google, microsoft, yahoo, email, _alias, facebook_custom_audience_id].hash
256
+ [other, customerid, facebook, twitter, google, microsoft, yahoo, email, _alias, facebook_custom_audience_id, other_id_2, other_id_3, other_id_4, other_id_5, other_id_6, other_id_7, other_id_8, other_id_9, other_id_10, mobile_number, phone_number_2, phone_number_3].hash
149
257
  end
150
258
 
151
259
  # Builds the object from hash
@@ -1,3 +1,3 @@
1
1
  module MParticle
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.8"
3
3
  end
data/mparticle.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "mparticle"
3
- s.version = "1.0.6"
3
+ s.version = "1.1.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = ["mParticle Inc."]
6
6
  s.email = ["support@mparticle.com"]
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.required_ruby_version = ">= 1.9"
12
12
 
13
13
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
14
- s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'
14
+ s.add_runtime_dependency 'json', '~> 2.0', '>= 2.3.0'
15
15
 
16
16
  s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
17
17
  s.executables = []
@@ -0,0 +1,39 @@
1
+ require 'mparticle'
2
+ require 'json'
3
+
4
+ describe 'Batch' do
5
+ it 'should create an instance of Batch' do
6
+ model = MParticle::Batch.new
7
+ expect(model).to be_an_instance_of MParticle::Batch
8
+ end
9
+
10
+ it 'should set integration attributes on batch' do
11
+ batch_model = MParticle::Batch.new
12
+ batch_model.integration_attributes = { 123 => { "foo" => "bar"}, 456 => { "foo" => "baz" }}
13
+ expect(batch_model.integration_attributes[123]["foo"]).to eq 'bar'
14
+ expect(batch_model.integration_attributes[456]["foo"]).to eq 'baz'
15
+ puts batch_model.to_hash
16
+ json = batch_model.to_hash.to_json
17
+
18
+ end
19
+
20
+ it 'should have the property att_timestamp_unixtime_ms {base name: "att_timestamp_unixtime_ms" }' do
21
+ device_info = MParticle::DeviceInformation.new
22
+ now = (Time.now.to_f * 1000).to_i
23
+ device_info.att_timestamp_unixtime_ms = now
24
+ expect(device_info.att_timestamp_unixtime_ms).to eq now
25
+ puts device_info.to_hash
26
+ json = device_info.to_hash.to_json
27
+
28
+ end
29
+
30
+ it 'should have the property att_authorization_status {base name: "att_authorization_status" }' do
31
+ device_info = MParticle::DeviceInformation.new
32
+ device_info.att_authorization_status = 'authorized'
33
+ expect(device_info.att_authorization_status).to eq('authorized')
34
+ puts device_info.to_hash
35
+ json = device_info.to_hash.to_json
36
+
37
+ end
38
+
39
+ end
@@ -13,7 +13,7 @@ describe 'CCPAConsentState' do
13
13
  end
14
14
 
15
15
  it 'should have the property timestamp_unixtime_ms {base name: "timestamp_unixtime_ms" }' do
16
- now = Time.now.to_i
16
+ now = (Time.now.to_f * 1000).to_i
17
17
  model = MParticle::CCPAConsentState.new
18
18
  model.timestamp_unixtime_ms = now
19
19
  expect(model.timestamp_unixtime_ms).to eq now
@@ -0,0 +1,19 @@
1
+ require 'mparticle'
2
+
3
+ describe 'DataPlanContext' do
4
+ it 'should create an instance of DataPlanContext' do
5
+ model = MParticle::DataPlanContext.new
6
+ expect(model).to be_an_instance_of MParticle::DataPlanContext
7
+ end
8
+
9
+ it 'should set context on batch' do
10
+ batch_model = MParticle::Batch.new
11
+ batch_model.context = MParticle::BatchContext.new
12
+ batch_model.context.data_plan = MParticle::DataPlanContext.new
13
+ batch_model.context.data_plan.plan_id = 'foo_dp_id'
14
+ batch_model.context.data_plan.plan_version = 5
15
+ expect(batch_model.context.data_plan.plan_id).to eq('foo_dp_id')
16
+ expect(batch_model.context.data_plan.plan_version).to eq(5)
17
+ end
18
+
19
+ end
@@ -19,7 +19,7 @@ describe 'GDPRConsentState' do
19
19
  end
20
20
 
21
21
  it 'should have the property timestamp_unixtime_ms {base name: "timestamp_unixtime_ms" }' do
22
- now = Time.now.to_i
22
+ now = (Time.now.to_f * 1000).to_i
23
23
  model = MParticle::GDPRConsentState.new
24
24
  model.timestamp_unixtime_ms = now
25
25
  expect(model.timestamp_unixtime_ms).to eq now
@@ -0,0 +1,59 @@
1
+ require 'mparticle'
2
+
3
+ describe 'UserIdentities' do
4
+ it 'should create an instance of UserIdentities' do
5
+ model = MParticle::UserIdentities.new
6
+ expect(model).to be_an_instance_of MParticle::UserIdentities
7
+ end
8
+
9
+ it 'should set all identities' do
10
+ model = MParticle::UserIdentities.new
11
+ model.other = 'foo_other'
12
+ expect(model.other).to eq('foo_other')
13
+ model.customerid = 'foo_customerid'
14
+ expect(model.customerid).to eq('foo_customerid')
15
+ model.facebook = 'foo_facebook'
16
+ expect(model.facebook).to eq('foo_facebook')
17
+ model.twitter = 'foo_twitter'
18
+ expect(model.twitter).to eq('foo_twitter')
19
+ model.google = 'foo_google'
20
+ expect(model.google).to eq('foo_google')
21
+ model.microsoft = 'foo_microsoft'
22
+ expect(model.microsoft).to eq('foo_microsoft')
23
+ model.yahoo = 'foo_yahoo'
24
+ expect(model.yahoo).to eq('foo_yahoo')
25
+ model.email = 'foo_email'
26
+ expect(model.email).to eq('foo_email')
27
+ model._alias = 'foo_alias'
28
+ expect(model._alias).to eq('foo_alias')
29
+ model.facebook_custom_audience_id = 'foo_fbid'
30
+ expect(model.facebook_custom_audience_id).to eq('foo_fbid')
31
+ model.other_id_2 = 'foo_other_id_2'
32
+ expect(model.other_id_2).to eq('foo_other_id_2')
33
+ model.other_id_3 = 'foo_other_id_3'
34
+ expect(model.other_id_3).to eq('foo_other_id_3')
35
+ model.other_id_4 = 'foo_other_id_4'
36
+ expect(model.other_id_4).to eq('foo_other_id_4')
37
+ model.other_id_5 = 'foo_other_id_5'
38
+ expect(model.other_id_5).to eq('foo_other_id_5')
39
+ model.other_id_6 = 'foo_other_id_6'
40
+ expect(model.other_id_6).to eq('foo_other_id_6')
41
+ model.other_id_7 = 'foo_other_id_7'
42
+ expect(model.other_id_7).to eq('foo_other_id_7')
43
+ model.other_id_8 = 'foo_other_id_8'
44
+ expect(model.other_id_8).to eq('foo_other_id_8')
45
+ model.other_id_9 = 'foo_other_id_9'
46
+ expect(model.other_id_9).to eq('foo_other_id_9')
47
+ model.other_id_10 = 'foo_other_id_10'
48
+ expect(model.other_id_10).to eq('foo_other_id_10')
49
+ model.mobile_number = 'foo_mobile_number'
50
+ expect(model.mobile_number).to eq('foo_mobile_number')
51
+ model.phone_number_2 = 'foo_phone_number_2'
52
+ expect(model.phone_number_2).to eq('foo_phone_number_2')
53
+ model.phone_number_3 = 'foo_phone_number_3'
54
+ expect(model.phone_number_3).to eq('foo_phone_number_3')
55
+
56
+
57
+ end
58
+
59
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mparticle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mParticle Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-18 00:00:00.000000000 Z
11
+ date: 2021-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -36,20 +36,20 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.8'
39
+ version: '2.0'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.8.3
42
+ version: 2.3.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '1.8'
49
+ version: '2.0'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 1.8.3
52
+ version: 2.3.0
53
53
  description: Use this client to send your data into the mParticle platform.
54
54
  email:
55
55
  - support@mparticle.com
@@ -57,8 +57,6 @@ executables: []
57
57
  extensions: []
58
58
  extra_rdoc_files: []
59
59
  files:
60
- - Gemfile
61
- - Gemfile.lock
62
60
  - README.md
63
61
  - docs/ApiResponse.md
64
62
  - docs/ApiResponseErrors.md
@@ -110,11 +108,13 @@ files:
110
108
  - lib/mparticle/models/application_state_transition_event.rb
111
109
  - lib/mparticle/models/attribution_info.rb
112
110
  - lib/mparticle/models/batch.rb
111
+ - lib/mparticle/models/batch_context.rb
113
112
  - lib/mparticle/models/breadcrumb_event.rb
114
113
  - lib/mparticle/models/ccpa_consent_state.rb
115
114
  - lib/mparticle/models/commerce_event.rb
116
115
  - lib/mparticle/models/consent_state.rb
117
116
  - lib/mparticle/models/crash_report_event.rb
117
+ - lib/mparticle/models/data_plan_context.rb
118
118
  - lib/mparticle/models/device_current_state.rb
119
119
  - lib/mparticle/models/device_information.rb
120
120
  - lib/mparticle/models/event_base.rb
@@ -140,16 +140,17 @@ files:
140
140
  - lib/mparticle/models/source_information.rb
141
141
  - lib/mparticle/models/user_identities.rb
142
142
  - lib/mparticle/version.rb
143
- - mparticle-1.0.4.gem
144
- - mparticle-1.0.5.gem
145
143
  - mparticle.gemspec
146
144
  - spec/models/app_event_spec.rb
145
+ - spec/models/batch_spec.rb
147
146
  - spec/models/ccpa_consent_state_spec.rb
148
147
  - spec/models/commerce_event_spec.rb
149
148
  - spec/models/consent_state_spec.rb
149
+ - spec/models/data_plan_context_spec.rb
150
150
  - spec/models/gdpr_consent_state_spec.rb
151
151
  - spec/models/product_spec.rb
152
152
  - spec/models/screen_view_event_spec.rb
153
+ - spec/models/user_identities_spec.rb
153
154
  homepage: https://www.mparticle.com
154
155
  licenses:
155
156
  - Apache-2.0
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
- gem 'rspec', '3.9.0'
3
- gem 'typhoeus', '~> 1.0', '>= 1.0.1'
4
- gem 'json', '~> 1.8', '>= 1.8.3'
data/Gemfile.lock DELETED
@@ -1,34 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- diff-lcs (1.3)
5
- ethon (0.12.0)
6
- ffi (>= 1.3.0)
7
- ffi (1.11.3)
8
- json (1.8.6)
9
- rspec (3.9.0)
10
- rspec-core (~> 3.9.0)
11
- rspec-expectations (~> 3.9.0)
12
- rspec-mocks (~> 3.9.0)
13
- rspec-core (3.9.1)
14
- rspec-support (~> 3.9.1)
15
- rspec-expectations (3.9.0)
16
- diff-lcs (>= 1.2.0, < 2.0)
17
- rspec-support (~> 3.9.0)
18
- rspec-mocks (3.9.1)
19
- diff-lcs (>= 1.2.0, < 2.0)
20
- rspec-support (~> 3.9.0)
21
- rspec-support (3.9.2)
22
- typhoeus (1.3.1)
23
- ethon (>= 0.9.0)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- json (~> 1.8, >= 1.8.3)
30
- rspec (= 3.9.0)
31
- typhoeus (~> 1.0, >= 1.0.1)
32
-
33
- BUNDLED WITH
34
- 1.17.2
data/mparticle-1.0.4.gem DELETED
Binary file
data/mparticle-1.0.5.gem DELETED
Binary file