mparticle 1.0.5 → 1.0.6
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 +4 -4
- data/docs/CCPAConsentState.md +10 -0
- data/docs/ConsentState.md +4 -3
- data/example/main.rb +10 -2
- data/lib/mparticle.rb +1 -0
- data/lib/mparticle/models/ccpa_consent_state.rb +233 -0
- data/lib/mparticle/models/consent_state.rb +9 -0
- data/lib/mparticle/version.rb +1 -1
- data/mparticle-1.0.5.gem +0 -0
- data/mparticle.gemspec +1 -1
- data/spec/models/ccpa_consent_state_spec.rb +34 -0
- data/spec/models/consent_state_spec.rb +5 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9762788a48567b16db7faaf386973958808cfabeca373df4269b1a45a3906641
|
4
|
+
data.tar.gz: f1ef718e0e8454bfb1eb8589b9133be95b462f6d8edf4d8f4ceec3a0f1592645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d13b1ea200c1df11fbb53e2dd152eca13f7bc5b3b90d615f7a9452782b083e80f55c910c70a21bd483bee55aaecf442e83b06a4e463ec1a553552c5c2be2950
|
7
|
+
data.tar.gz: 71421fb7806a281311039f53d627df412953e91151feeb66b80dc3d61edd32eb1bbc05f129901187f055799ca200c239b916b51b8a02b8e05199b927fdd403b6
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# mParticle.CCPAConsentState
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ------------------------- | ----------- | ----------- | ----- |
|
7
|
+
| **consented** | **Boolean** | | |
|
8
|
+
| **timestamp_unixtime_ms** | **Number** | | |
|
9
|
+
| **location** | **String** | | |
|
10
|
+
| **hardware_id** | **String** | | |
|
data/docs/ConsentState.md
CHANGED
data/example/main.rb
CHANGED
@@ -51,6 +51,13 @@ commerce_event = {
|
|
51
51
|
batch.events = [MParticle::SessionStartEvent.new, app_event, MParticle::SessionEndEvent.new]
|
52
52
|
batch.user_identities = user_identities
|
53
53
|
|
54
|
+
ccpa_consent_state = MParticle::CCPAConsentState.new
|
55
|
+
ccpa_consent_state.document = 'document.agreement.v3'
|
56
|
+
ccpa_consent_state.consented = true
|
57
|
+
ccpa_consent_state.timestamp_unixtime_ms = Time.now.to_i
|
58
|
+
ccpa_consent_state.location = 'mparticle.test/signup'
|
59
|
+
ccpa_consent_state.hardware_id = 'IDFA:a5d96n32-224a-3b11-1088-a202695bc710'
|
60
|
+
|
54
61
|
gdpr_consent_state = MParticle::GDPRConsentState.new
|
55
62
|
gdpr_consent_state.document = 'document_agreement.v2'
|
56
63
|
gdpr_consent_state.consented = true
|
@@ -60,8 +67,9 @@ gdpr_consent_state.hardware_id = 'IDFA:a5d934n0-232f-4afc-2e9a-3832d95zc702'
|
|
60
67
|
|
61
68
|
consent_state = MParticle::ConsentState.new
|
62
69
|
# Make sure this purpose matches your consent purpose in
|
63
|
-
#
|
64
|
-
# https://docs.mparticle.com/guides/consent-management
|
70
|
+
# Workspace Settings > Workspace > Regulations
|
71
|
+
# https://docs.mparticle.com/guides/consent-management/
|
72
|
+
consent_state.ccpa = { 'data_sale_opt_out' => ccpa_consent_state }
|
65
73
|
consent_state.gdpr = { 'document_agreement' => gdpr_consent_state }
|
66
74
|
batch.consent_state = consent_state
|
67
75
|
|
data/lib/mparticle.rb
CHANGED
@@ -13,6 +13,7 @@ require 'mparticle/models/application_state_transition_event'
|
|
13
13
|
require 'mparticle/models/attribution_info'
|
14
14
|
require 'mparticle/models/batch'
|
15
15
|
require 'mparticle/models/breadcrumb_event'
|
16
|
+
require 'mparticle/models/ccpa_consent_state'
|
16
17
|
require 'mparticle/models/commerce_event'
|
17
18
|
require 'mparticle/models/consent_state'
|
18
19
|
require 'mparticle/models/crash_report_event'
|
@@ -0,0 +1,233 @@
|
|
1
|
+
module MParticle
|
2
|
+
class CCPAConsentState
|
3
|
+
attr_accessor :document
|
4
|
+
attr_accessor :consented
|
5
|
+
attr_accessor :timestamp_unixtime_ms
|
6
|
+
attr_accessor :location
|
7
|
+
attr_accessor :hardware_id
|
8
|
+
|
9
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
10
|
+
def self.attribute_map
|
11
|
+
{
|
12
|
+
:'document' => 'document',
|
13
|
+
:'consented' => 'consented',
|
14
|
+
:'timestamp_unixtime_ms' => 'timestamp_unixtime_ms',
|
15
|
+
:'location' => 'location',
|
16
|
+
:'hardware_id' => 'hardware_id',
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
# Attribute type mapping.
|
21
|
+
def self.swagger_types
|
22
|
+
{
|
23
|
+
:'document' => 'String',
|
24
|
+
:'consented' => 'Boolean',
|
25
|
+
:'timestamp_unixtime_ms' => 'Integer',
|
26
|
+
:'location' => 'String',
|
27
|
+
:'hardware_id' => 'String',
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Initializes the object
|
32
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
33
|
+
def initialize(attributes = {})
|
34
|
+
return unless attributes.is_a?(Hash)
|
35
|
+
|
36
|
+
# convert string to symbol for hash key
|
37
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
38
|
+
|
39
|
+
if attributes.has_key?(:'document')
|
40
|
+
self.document = attributes[:'document']
|
41
|
+
end
|
42
|
+
|
43
|
+
if attributes.has_key?(:'consented')
|
44
|
+
self.consented = attributes[:'consented']
|
45
|
+
end
|
46
|
+
|
47
|
+
if attributes.has_key?(:'timestamp_unixtime_ms')
|
48
|
+
self.timestamp_unixtime_ms = attributes[:'timestamp_unixtime_ms']
|
49
|
+
end
|
50
|
+
|
51
|
+
if attributes.has_key?(:'location')
|
52
|
+
self.location = attributes[:'location']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'hardware_id')
|
56
|
+
self.hardware_id = attributes[:'hardware_id']
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
61
|
+
# @return Array for valid properies with the reasons
|
62
|
+
def list_invalid_properties
|
63
|
+
invalid_properties = Array.new
|
64
|
+
|
65
|
+
if @document.nil?
|
66
|
+
invalid_properties.push("invalid value for 'document', document cannot be nil.")
|
67
|
+
end
|
68
|
+
|
69
|
+
if @consented.nil?
|
70
|
+
invalid_properties.push("invalid value for 'consented', consented cannot be nil.")
|
71
|
+
end
|
72
|
+
|
73
|
+
if @timestamp_unixtime_ms.nil?
|
74
|
+
invalid_properties.push("invalid value for 'timestamp_unixtime_ms', timestamp_unixtime_ms cannot be nil.")
|
75
|
+
end
|
76
|
+
|
77
|
+
if @location.nil?
|
78
|
+
invalid_properties.push("invalid value for 'location', location cannot be nil.")
|
79
|
+
end
|
80
|
+
|
81
|
+
if @hardware_id.nil?
|
82
|
+
invalid_properties.push("invalid value for 'hardware_id', hardware_id cannot be nil.")
|
83
|
+
end
|
84
|
+
|
85
|
+
return invalid_properties
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check to see if the all the properties in the model are valid
|
89
|
+
# @return true if the model is valid
|
90
|
+
def valid?
|
91
|
+
return false if @document.nil?
|
92
|
+
return false if @consented.nil?
|
93
|
+
return false if @timestamp_unixtime_ms.nil?
|
94
|
+
return false if @location.nil?
|
95
|
+
return false if @hardware_id.nil?
|
96
|
+
return true
|
97
|
+
end
|
98
|
+
|
99
|
+
# Checks equality by comparing each attribute.
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def ==(o)
|
102
|
+
return true if self.equal?(o)
|
103
|
+
self.class == o.class &&
|
104
|
+
document == o.document &&
|
105
|
+
consented == o.consented &&
|
106
|
+
timestamp_unixtime_ms == o.timestamp_unixtime_ms &&
|
107
|
+
location == o.location &&
|
108
|
+
hardware_id == o.hardware_id
|
109
|
+
end
|
110
|
+
|
111
|
+
# @see the `==` method
|
112
|
+
# @param [Object] Object to be compared
|
113
|
+
def eql?(o)
|
114
|
+
self == o
|
115
|
+
end
|
116
|
+
|
117
|
+
# Calculates hash code according to all attributes.
|
118
|
+
# @return [Fixnum] Hash code
|
119
|
+
def hash
|
120
|
+
[
|
121
|
+
document,
|
122
|
+
consented,
|
123
|
+
timestamp_unixtime_ms,
|
124
|
+
location,
|
125
|
+
hardware_id,
|
126
|
+
].hash
|
127
|
+
end
|
128
|
+
|
129
|
+
# Builds the object from hash
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
+
# @return [Object] Returns the model itself
|
132
|
+
def build_from_hash(attributes)
|
133
|
+
return nil unless attributes.is_a?(Hash)
|
134
|
+
self.class.swagger_types.each_pair do |key, type|
|
135
|
+
if type =~ /\AArray<(.*)>/i
|
136
|
+
# check to ensure the input is an array given that the the attribute
|
137
|
+
# is documented as an array but the input is not
|
138
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
139
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
140
|
+
end
|
141
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
142
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
143
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
144
|
+
end
|
145
|
+
|
146
|
+
self
|
147
|
+
end
|
148
|
+
|
149
|
+
# Deserializes the data based on type
|
150
|
+
# @param string type Data type
|
151
|
+
# @param string value Value to be deserialized
|
152
|
+
# @return [Object] Deserialized data
|
153
|
+
def _deserialize(type, value)
|
154
|
+
case type.to_sym
|
155
|
+
when :DateTime
|
156
|
+
DateTime.parse(value)
|
157
|
+
when :Date
|
158
|
+
Date.parse(value)
|
159
|
+
when :String
|
160
|
+
value.to_s
|
161
|
+
when :Integer
|
162
|
+
value.to_i
|
163
|
+
when :Float
|
164
|
+
value.to_f
|
165
|
+
when :BOOLEAN
|
166
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
167
|
+
true
|
168
|
+
else
|
169
|
+
false
|
170
|
+
end
|
171
|
+
when :Object
|
172
|
+
# generic object (usually a Hash), return directly
|
173
|
+
value
|
174
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
175
|
+
inner_type = Regexp.last_match[:inner_type]
|
176
|
+
value.map { |v| _deserialize(inner_type, v) }
|
177
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
178
|
+
k_type = Regexp.last_match[:k_type]
|
179
|
+
v_type = Regexp.last_match[:v_type]
|
180
|
+
{}.tap do |hash|
|
181
|
+
value.each do |k, v|
|
182
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
else # model
|
186
|
+
temp_model = MParticle.const_get(type).new
|
187
|
+
temp_model.build_from_hash(value)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns the string representation of the object
|
192
|
+
# @return [String] String presentation of the object
|
193
|
+
def to_s
|
194
|
+
to_hash.to_s
|
195
|
+
end
|
196
|
+
|
197
|
+
# to_body is an alias to to_hash (backward compatibility)
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_body
|
200
|
+
to_hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the object in the form of hash
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_hash
|
206
|
+
hash = {}
|
207
|
+
self.class.attribute_map.each_pair do |attr, param|
|
208
|
+
value = self.send(attr)
|
209
|
+
next if value.nil?
|
210
|
+
hash[param] = _to_hash(value)
|
211
|
+
end
|
212
|
+
hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Outputs non-array value in the form of hash
|
216
|
+
# For object, use to_hash. Otherwise, just return the value
|
217
|
+
# @param [Object] value Any valid value
|
218
|
+
# @return [Hash] Returns the value in the form of hash
|
219
|
+
def _to_hash(value)
|
220
|
+
if value.is_a?(Array)
|
221
|
+
value.compact.map{ |v| _to_hash(v) }
|
222
|
+
elsif value.is_a?(Hash)
|
223
|
+
{}.tap do |hash|
|
224
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
225
|
+
end
|
226
|
+
elsif value.respond_to? :to_hash
|
227
|
+
value.to_hash
|
228
|
+
else
|
229
|
+
value
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
@@ -3,11 +3,13 @@ require 'date'
|
|
3
3
|
module MParticle
|
4
4
|
class ConsentState
|
5
5
|
attr_accessor :gdpr
|
6
|
+
attr_accessor :ccpa
|
6
7
|
|
7
8
|
# Attribute mapping from ruby-style variable name to JSON key.
|
8
9
|
def self.attribute_map
|
9
10
|
{
|
10
11
|
:'gdpr' => 'gdpr',
|
12
|
+
:'ccpa' => 'ccpa',
|
11
13
|
}
|
12
14
|
end
|
13
15
|
|
@@ -15,6 +17,7 @@ module MParticle
|
|
15
17
|
def self.swagger_types
|
16
18
|
{
|
17
19
|
:'gdpr' => 'Hash',
|
20
|
+
:'ccpa' => 'Hash',
|
18
21
|
}
|
19
22
|
end
|
20
23
|
|
@@ -31,6 +34,12 @@ module MParticle
|
|
31
34
|
else
|
32
35
|
self.gdpr = {}
|
33
36
|
end
|
37
|
+
|
38
|
+
if attributes.has_key?(:'ccpa')
|
39
|
+
self.ccpa = attributes[:'ccpa']
|
40
|
+
else
|
41
|
+
self.ccpa = {}
|
42
|
+
end
|
34
43
|
end
|
35
44
|
|
36
45
|
# Show invalid properties with the reasons. Usually used together with valid?
|
data/lib/mparticle/version.rb
CHANGED
data/mparticle-1.0.5.gem
ADDED
Binary file
|
data/mparticle.gemspec
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'mparticle'
|
2
|
+
|
3
|
+
describe 'CCPAConsentState' do
|
4
|
+
it 'should create an instance of CCPAConsentState' do
|
5
|
+
model = MParticle::CCPAConsentState.new
|
6
|
+
expect(model).to be_an_instance_of MParticle::CCPAConsentState
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should have the property consented (base name: "consented")' do
|
10
|
+
model = MParticle::CCPAConsentState.new
|
11
|
+
model.consented = true
|
12
|
+
expect(model.consented).to eq true
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have the property timestamp_unixtime_ms {base name: "timestamp_unixtime_ms" }' do
|
16
|
+
now = Time.now.to_i
|
17
|
+
model = MParticle::CCPAConsentState.new
|
18
|
+
model.timestamp_unixtime_ms = now
|
19
|
+
expect(model.timestamp_unixtime_ms).to eq now
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should have the property location {base name: "location" }' do
|
23
|
+
model = MParticle::CCPAConsentState.new
|
24
|
+
model.location = 'dtmgbank.com/signup'
|
25
|
+
expect(model.location).to eq 'dtmgbank.com/signup'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have the property hardware_id {base name: "hardware_id" }' do
|
29
|
+
model = MParticle::CCPAConsentState.new
|
30
|
+
model.hardware_id = 'IDFA:a5d934n0-232f-4afc-2e9a-3832d95zc702'
|
31
|
+
expect(model.hardware_id).to eq 'IDFA:a5d934n0-232f-4afc-2e9a-3832d95zc702'
|
32
|
+
end
|
33
|
+
|
34
|
+
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.
|
4
|
+
version: 1.0.6
|
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-
|
11
|
+
date: 2020-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- docs/AttributionInfo.md
|
69
69
|
- docs/Batch.md
|
70
70
|
- docs/BreadcrumbEvent.md
|
71
|
+
- docs/CCPAConsentState.md
|
71
72
|
- docs/CommerceEvent.md
|
72
73
|
- docs/ConsentState.md
|
73
74
|
- docs/CrashReportEvent.md
|
@@ -110,6 +111,7 @@ files:
|
|
110
111
|
- lib/mparticle/models/attribution_info.rb
|
111
112
|
- lib/mparticle/models/batch.rb
|
112
113
|
- lib/mparticle/models/breadcrumb_event.rb
|
114
|
+
- lib/mparticle/models/ccpa_consent_state.rb
|
113
115
|
- lib/mparticle/models/commerce_event.rb
|
114
116
|
- lib/mparticle/models/consent_state.rb
|
115
117
|
- lib/mparticle/models/crash_report_event.rb
|
@@ -139,8 +141,10 @@ files:
|
|
139
141
|
- lib/mparticle/models/user_identities.rb
|
140
142
|
- lib/mparticle/version.rb
|
141
143
|
- mparticle-1.0.4.gem
|
144
|
+
- mparticle-1.0.5.gem
|
142
145
|
- mparticle.gemspec
|
143
146
|
- spec/models/app_event_spec.rb
|
147
|
+
- spec/models/ccpa_consent_state_spec.rb
|
144
148
|
- spec/models/commerce_event_spec.rb
|
145
149
|
- spec/models/consent_state_spec.rb
|
146
150
|
- spec/models/gdpr_consent_state_spec.rb
|