mparticle 1.0.5 → 1.0.10

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.
@@ -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?
@@ -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
@@ -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.5"
2
+ VERSION = "1.0.8"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "mparticle"
3
- s.version = "1.0.5"
3
+ s.version = "1.0.10"
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,20 @@
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
+ end
@@ -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