braze_api_client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/braze_api_client.gemspec +1 -1
- data/docs/RestApi.md +26 -26
- data/docs/UsersAliasNewResponse.md +20 -0
- data/docs/{IdentifierOneOf.md → UsersDeleteResponse.md} +4 -4
- data/docs/UsersExternalIdsRemoveResponse.md +22 -0
- data/docs/UsersExternalIdsRenameResponse.md +22 -0
- data/docs/UsersExternalIdsRenameResponseExternalIds.md +20 -0
- data/docs/UsersIdentifyResponse.md +20 -0
- data/lib/braze_api_client/api/rest_api.rb +25 -25
- data/lib/braze_api_client/api_client.rb +2 -2
- data/lib/braze_api_client/api_error.rb +1 -1
- data/lib/braze_api_client/configuration.rb +1 -1
- data/lib/braze_api_client/models/general_error.rb +1 -1
- data/lib/braze_api_client/models/{attributes_array.rb → users_alias_new_response.rb} +20 -18
- data/lib/braze_api_client/models/{events_array.rb → users_delete_response.rb} +11 -13
- data/lib/braze_api_client/models/{users_track_request.rb → users_external_ids_remove_response.rb} +32 -37
- data/lib/braze_api_client/models/{attributes_push_tokens.rb → users_external_ids_rename_response.rb} +27 -33
- data/lib/braze_api_client/models/{attributes_facebook.rb → users_external_ids_rename_response_external_ids.rb} +17 -28
- data/lib/braze_api_client/models/{attributes_current_location.rb → users_identify_response.rb} +17 -17
- data/lib/braze_api_client/models/users_track_response.rb +1 -1
- data/lib/braze_api_client/version.rb +2 -2
- data/lib/braze_api_client.rb +7 -14
- data/spec/api/rest_api_spec.rb +7 -7
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/general_error_spec.rb +1 -1
- data/spec/models/{attributes_current_location_spec.rb → users_alias_new_response_spec.rb} +9 -9
- data/spec/models/{identifier_one_of2_spec.rb → users_delete_response_spec.rb} +8 -8
- data/spec/models/{attributes_facebook_spec.rb → users_external_ids_remove_response_spec.rb} +10 -10
- data/spec/models/users_external_ids_rename_response_external_ids_spec.rb +40 -0
- data/spec/models/{attributes_push_tokens_spec.rb → users_external_ids_rename_response_spec.rb} +10 -10
- data/spec/models/users_identify_response_spec.rb +40 -0
- data/spec/models/users_track_response_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +26 -54
- data/docs/Attributes.md +0 -58
- data/docs/AttributesArray.md +0 -18
- data/docs/AttributesCurrentLocation.md +0 -20
- data/docs/AttributesFacebook.md +0 -22
- data/docs/AttributesPushTokens.md +0 -22
- data/docs/AttributesTwitter.md +0 -26
- data/docs/Event.md +0 -26
- data/docs/EventsArray.md +0 -18
- data/docs/Identifier.md +0 -51
- data/docs/IdentifierOneOf1.md +0 -18
- data/docs/IdentifierOneOf2.md +0 -18
- data/docs/UsersTrackRequest.md +0 -18
- data/lib/braze_api_client/models/attributes.rb +0 -458
- data/lib/braze_api_client/models/attributes_twitter.rb +0 -254
- data/lib/braze_api_client/models/event.rb +0 -264
- data/lib/braze_api_client/models/identifier.rb +0 -106
- data/lib/braze_api_client/models/identifier_one_of.rb +0 -223
- data/lib/braze_api_client/models/identifier_one_of1.rb +0 -223
- data/lib/braze_api_client/models/identifier_one_of2.rb +0 -223
- data/spec/models/attributes_array_spec.rb +0 -34
- data/spec/models/attributes_spec.rb +0 -166
- data/spec/models/attributes_twitter_spec.rb +0 -58
- data/spec/models/event_spec.rb +0 -58
- data/spec/models/events_array_spec.rb +0 -34
- data/spec/models/identifier_one_of1_spec.rb +0 -34
- data/spec/models/identifier_one_of_spec.rb +0 -34
- data/spec/models/identifier_spec.rb +0 -31
- data/spec/models/users_track_request_spec.rb +0 -34
@@ -1,223 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Braze
|
3
|
-
|
4
|
-
#Track users, send messages, export data, and more
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 0.1.0
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.2.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module BrazeClient
|
17
|
-
class IdentifierOneOf
|
18
|
-
attr_accessor :external_id
|
19
|
-
|
20
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
-
def self.attribute_map
|
22
|
-
{
|
23
|
-
:'external_id' => :'external_id'
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns all the JSON keys this model knows about
|
28
|
-
def self.acceptable_attributes
|
29
|
-
attribute_map.values
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute type mapping.
|
33
|
-
def self.openapi_types
|
34
|
-
{
|
35
|
-
:'external_id' => :'String'
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# List of attributes with nullable: true
|
40
|
-
def self.openapi_nullable
|
41
|
-
Set.new([
|
42
|
-
])
|
43
|
-
end
|
44
|
-
|
45
|
-
# Initializes the object
|
46
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
-
def initialize(attributes = {})
|
48
|
-
if (!attributes.is_a?(Hash))
|
49
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `BrazeClient::IdentifierOneOf` initialize method"
|
50
|
-
end
|
51
|
-
|
52
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `BrazeClient::IdentifierOneOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
-
end
|
57
|
-
h[k.to_sym] = v
|
58
|
-
}
|
59
|
-
|
60
|
-
if attributes.key?(:'external_id')
|
61
|
-
self.external_id = attributes[:'external_id']
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
-
# @return Array for valid properties with the reasons
|
67
|
-
def list_invalid_properties
|
68
|
-
invalid_properties = Array.new
|
69
|
-
if @external_id.nil?
|
70
|
-
invalid_properties.push('invalid value for "external_id", external_id cannot be nil.')
|
71
|
-
end
|
72
|
-
|
73
|
-
invalid_properties
|
74
|
-
end
|
75
|
-
|
76
|
-
# Check to see if the all the properties in the model are valid
|
77
|
-
# @return true if the model is valid
|
78
|
-
def valid?
|
79
|
-
return false if @external_id.nil?
|
80
|
-
true
|
81
|
-
end
|
82
|
-
|
83
|
-
# Checks equality by comparing each attribute.
|
84
|
-
# @param [Object] Object to be compared
|
85
|
-
def ==(o)
|
86
|
-
return true if self.equal?(o)
|
87
|
-
self.class == o.class &&
|
88
|
-
external_id == o.external_id
|
89
|
-
end
|
90
|
-
|
91
|
-
# @see the `==` method
|
92
|
-
# @param [Object] Object to be compared
|
93
|
-
def eql?(o)
|
94
|
-
self == o
|
95
|
-
end
|
96
|
-
|
97
|
-
# Calculates hash code according to all attributes.
|
98
|
-
# @return [Integer] Hash code
|
99
|
-
def hash
|
100
|
-
[external_id].hash
|
101
|
-
end
|
102
|
-
|
103
|
-
# Builds the object from hash
|
104
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
-
# @return [Object] Returns the model itself
|
106
|
-
def self.build_from_hash(attributes)
|
107
|
-
new.build_from_hash(attributes)
|
108
|
-
end
|
109
|
-
|
110
|
-
# Builds the object from hash
|
111
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
-
# @return [Object] Returns the model itself
|
113
|
-
def build_from_hash(attributes)
|
114
|
-
return nil unless attributes.is_a?(Hash)
|
115
|
-
self.class.openapi_types.each_pair do |key, type|
|
116
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
117
|
-
self.send("#{key}=", nil)
|
118
|
-
elsif type =~ /\AArray<(.*)>/i
|
119
|
-
# check to ensure the input is an array given that the attribute
|
120
|
-
# is documented as an array but the input is not
|
121
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
122
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
123
|
-
end
|
124
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
self
|
130
|
-
end
|
131
|
-
|
132
|
-
# Deserializes the data based on type
|
133
|
-
# @param string type Data type
|
134
|
-
# @param string value Value to be deserialized
|
135
|
-
# @return [Object] Deserialized data
|
136
|
-
def _deserialize(type, value)
|
137
|
-
case type.to_sym
|
138
|
-
when :Time
|
139
|
-
Time.parse(value)
|
140
|
-
when :Date
|
141
|
-
Date.parse(value)
|
142
|
-
when :String
|
143
|
-
value.to_s
|
144
|
-
when :Integer
|
145
|
-
value.to_i
|
146
|
-
when :Float
|
147
|
-
value.to_f
|
148
|
-
when :Boolean
|
149
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
-
true
|
151
|
-
else
|
152
|
-
false
|
153
|
-
end
|
154
|
-
when :Object
|
155
|
-
# generic object (usually a Hash), return directly
|
156
|
-
value
|
157
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
-
inner_type = Regexp.last_match[:inner_type]
|
159
|
-
value.map { |v| _deserialize(inner_type, v) }
|
160
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
-
k_type = Regexp.last_match[:k_type]
|
162
|
-
v_type = Regexp.last_match[:v_type]
|
163
|
-
{}.tap do |hash|
|
164
|
-
value.each do |k, v|
|
165
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
else # model
|
169
|
-
# models (e.g. Pet) or oneOf
|
170
|
-
klass = BrazeClient.const_get(type)
|
171
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
# Returns the string representation of the object
|
176
|
-
# @return [String] String presentation of the object
|
177
|
-
def to_s
|
178
|
-
to_hash.to_s
|
179
|
-
end
|
180
|
-
|
181
|
-
# to_body is an alias to to_hash (backward compatibility)
|
182
|
-
# @return [Hash] Returns the object in the form of hash
|
183
|
-
def to_body
|
184
|
-
to_hash
|
185
|
-
end
|
186
|
-
|
187
|
-
# Returns the object in the form of hash
|
188
|
-
# @return [Hash] Returns the object in the form of hash
|
189
|
-
def to_hash
|
190
|
-
hash = {}
|
191
|
-
self.class.attribute_map.each_pair do |attr, param|
|
192
|
-
value = self.send(attr)
|
193
|
-
if value.nil?
|
194
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
195
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
196
|
-
end
|
197
|
-
|
198
|
-
hash[param] = _to_hash(value)
|
199
|
-
end
|
200
|
-
hash
|
201
|
-
end
|
202
|
-
|
203
|
-
# Outputs non-array value in the form of hash
|
204
|
-
# For object, use to_hash. Otherwise, just return the value
|
205
|
-
# @param [Object] value Any valid value
|
206
|
-
# @return [Hash] Returns the value in the form of hash
|
207
|
-
def _to_hash(value)
|
208
|
-
if value.is_a?(Array)
|
209
|
-
value.compact.map { |v| _to_hash(v) }
|
210
|
-
elsif value.is_a?(Hash)
|
211
|
-
{}.tap do |hash|
|
212
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
-
end
|
214
|
-
elsif value.respond_to? :to_hash
|
215
|
-
value.to_hash
|
216
|
-
else
|
217
|
-
value
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
end
|
@@ -1,223 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Braze
|
3
|
-
|
4
|
-
#Track users, send messages, export data, and more
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 0.1.0
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.2.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module BrazeClient
|
17
|
-
class IdentifierOneOf1
|
18
|
-
attr_accessor :user_alias
|
19
|
-
|
20
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
-
def self.attribute_map
|
22
|
-
{
|
23
|
-
:'user_alias' => :'user_alias'
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns all the JSON keys this model knows about
|
28
|
-
def self.acceptable_attributes
|
29
|
-
attribute_map.values
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute type mapping.
|
33
|
-
def self.openapi_types
|
34
|
-
{
|
35
|
-
:'user_alias' => :'String'
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# List of attributes with nullable: true
|
40
|
-
def self.openapi_nullable
|
41
|
-
Set.new([
|
42
|
-
])
|
43
|
-
end
|
44
|
-
|
45
|
-
# Initializes the object
|
46
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
-
def initialize(attributes = {})
|
48
|
-
if (!attributes.is_a?(Hash))
|
49
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `BrazeClient::IdentifierOneOf1` initialize method"
|
50
|
-
end
|
51
|
-
|
52
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `BrazeClient::IdentifierOneOf1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
-
end
|
57
|
-
h[k.to_sym] = v
|
58
|
-
}
|
59
|
-
|
60
|
-
if attributes.key?(:'user_alias')
|
61
|
-
self.user_alias = attributes[:'user_alias']
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
-
# @return Array for valid properties with the reasons
|
67
|
-
def list_invalid_properties
|
68
|
-
invalid_properties = Array.new
|
69
|
-
if @user_alias.nil?
|
70
|
-
invalid_properties.push('invalid value for "user_alias", user_alias cannot be nil.')
|
71
|
-
end
|
72
|
-
|
73
|
-
invalid_properties
|
74
|
-
end
|
75
|
-
|
76
|
-
# Check to see if the all the properties in the model are valid
|
77
|
-
# @return true if the model is valid
|
78
|
-
def valid?
|
79
|
-
return false if @user_alias.nil?
|
80
|
-
true
|
81
|
-
end
|
82
|
-
|
83
|
-
# Checks equality by comparing each attribute.
|
84
|
-
# @param [Object] Object to be compared
|
85
|
-
def ==(o)
|
86
|
-
return true if self.equal?(o)
|
87
|
-
self.class == o.class &&
|
88
|
-
user_alias == o.user_alias
|
89
|
-
end
|
90
|
-
|
91
|
-
# @see the `==` method
|
92
|
-
# @param [Object] Object to be compared
|
93
|
-
def eql?(o)
|
94
|
-
self == o
|
95
|
-
end
|
96
|
-
|
97
|
-
# Calculates hash code according to all attributes.
|
98
|
-
# @return [Integer] Hash code
|
99
|
-
def hash
|
100
|
-
[user_alias].hash
|
101
|
-
end
|
102
|
-
|
103
|
-
# Builds the object from hash
|
104
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
-
# @return [Object] Returns the model itself
|
106
|
-
def self.build_from_hash(attributes)
|
107
|
-
new.build_from_hash(attributes)
|
108
|
-
end
|
109
|
-
|
110
|
-
# Builds the object from hash
|
111
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
-
# @return [Object] Returns the model itself
|
113
|
-
def build_from_hash(attributes)
|
114
|
-
return nil unless attributes.is_a?(Hash)
|
115
|
-
self.class.openapi_types.each_pair do |key, type|
|
116
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
117
|
-
self.send("#{key}=", nil)
|
118
|
-
elsif type =~ /\AArray<(.*)>/i
|
119
|
-
# check to ensure the input is an array given that the attribute
|
120
|
-
# is documented as an array but the input is not
|
121
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
122
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
123
|
-
end
|
124
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
self
|
130
|
-
end
|
131
|
-
|
132
|
-
# Deserializes the data based on type
|
133
|
-
# @param string type Data type
|
134
|
-
# @param string value Value to be deserialized
|
135
|
-
# @return [Object] Deserialized data
|
136
|
-
def _deserialize(type, value)
|
137
|
-
case type.to_sym
|
138
|
-
when :Time
|
139
|
-
Time.parse(value)
|
140
|
-
when :Date
|
141
|
-
Date.parse(value)
|
142
|
-
when :String
|
143
|
-
value.to_s
|
144
|
-
when :Integer
|
145
|
-
value.to_i
|
146
|
-
when :Float
|
147
|
-
value.to_f
|
148
|
-
when :Boolean
|
149
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
-
true
|
151
|
-
else
|
152
|
-
false
|
153
|
-
end
|
154
|
-
when :Object
|
155
|
-
# generic object (usually a Hash), return directly
|
156
|
-
value
|
157
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
-
inner_type = Regexp.last_match[:inner_type]
|
159
|
-
value.map { |v| _deserialize(inner_type, v) }
|
160
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
-
k_type = Regexp.last_match[:k_type]
|
162
|
-
v_type = Regexp.last_match[:v_type]
|
163
|
-
{}.tap do |hash|
|
164
|
-
value.each do |k, v|
|
165
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
else # model
|
169
|
-
# models (e.g. Pet) or oneOf
|
170
|
-
klass = BrazeClient.const_get(type)
|
171
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
# Returns the string representation of the object
|
176
|
-
# @return [String] String presentation of the object
|
177
|
-
def to_s
|
178
|
-
to_hash.to_s
|
179
|
-
end
|
180
|
-
|
181
|
-
# to_body is an alias to to_hash (backward compatibility)
|
182
|
-
# @return [Hash] Returns the object in the form of hash
|
183
|
-
def to_body
|
184
|
-
to_hash
|
185
|
-
end
|
186
|
-
|
187
|
-
# Returns the object in the form of hash
|
188
|
-
# @return [Hash] Returns the object in the form of hash
|
189
|
-
def to_hash
|
190
|
-
hash = {}
|
191
|
-
self.class.attribute_map.each_pair do |attr, param|
|
192
|
-
value = self.send(attr)
|
193
|
-
if value.nil?
|
194
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
195
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
196
|
-
end
|
197
|
-
|
198
|
-
hash[param] = _to_hash(value)
|
199
|
-
end
|
200
|
-
hash
|
201
|
-
end
|
202
|
-
|
203
|
-
# Outputs non-array value in the form of hash
|
204
|
-
# For object, use to_hash. Otherwise, just return the value
|
205
|
-
# @param [Object] value Any valid value
|
206
|
-
# @return [Hash] Returns the value in the form of hash
|
207
|
-
def _to_hash(value)
|
208
|
-
if value.is_a?(Array)
|
209
|
-
value.compact.map { |v| _to_hash(v) }
|
210
|
-
elsif value.is_a?(Hash)
|
211
|
-
{}.tap do |hash|
|
212
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
-
end
|
214
|
-
elsif value.respond_to? :to_hash
|
215
|
-
value.to_hash
|
216
|
-
else
|
217
|
-
value
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
end
|
@@ -1,223 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Braze
|
3
|
-
|
4
|
-
#Track users, send messages, export data, and more
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 0.1.0
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.2.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module BrazeClient
|
17
|
-
class IdentifierOneOf2
|
18
|
-
attr_accessor :braze_id
|
19
|
-
|
20
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
-
def self.attribute_map
|
22
|
-
{
|
23
|
-
:'braze_id' => :'braze_id'
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns all the JSON keys this model knows about
|
28
|
-
def self.acceptable_attributes
|
29
|
-
attribute_map.values
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute type mapping.
|
33
|
-
def self.openapi_types
|
34
|
-
{
|
35
|
-
:'braze_id' => :'String'
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# List of attributes with nullable: true
|
40
|
-
def self.openapi_nullable
|
41
|
-
Set.new([
|
42
|
-
])
|
43
|
-
end
|
44
|
-
|
45
|
-
# Initializes the object
|
46
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
-
def initialize(attributes = {})
|
48
|
-
if (!attributes.is_a?(Hash))
|
49
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `BrazeClient::IdentifierOneOf2` initialize method"
|
50
|
-
end
|
51
|
-
|
52
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `BrazeClient::IdentifierOneOf2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
-
end
|
57
|
-
h[k.to_sym] = v
|
58
|
-
}
|
59
|
-
|
60
|
-
if attributes.key?(:'braze_id')
|
61
|
-
self.braze_id = attributes[:'braze_id']
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
-
# @return Array for valid properties with the reasons
|
67
|
-
def list_invalid_properties
|
68
|
-
invalid_properties = Array.new
|
69
|
-
if @braze_id.nil?
|
70
|
-
invalid_properties.push('invalid value for "braze_id", braze_id cannot be nil.')
|
71
|
-
end
|
72
|
-
|
73
|
-
invalid_properties
|
74
|
-
end
|
75
|
-
|
76
|
-
# Check to see if the all the properties in the model are valid
|
77
|
-
# @return true if the model is valid
|
78
|
-
def valid?
|
79
|
-
return false if @braze_id.nil?
|
80
|
-
true
|
81
|
-
end
|
82
|
-
|
83
|
-
# Checks equality by comparing each attribute.
|
84
|
-
# @param [Object] Object to be compared
|
85
|
-
def ==(o)
|
86
|
-
return true if self.equal?(o)
|
87
|
-
self.class == o.class &&
|
88
|
-
braze_id == o.braze_id
|
89
|
-
end
|
90
|
-
|
91
|
-
# @see the `==` method
|
92
|
-
# @param [Object] Object to be compared
|
93
|
-
def eql?(o)
|
94
|
-
self == o
|
95
|
-
end
|
96
|
-
|
97
|
-
# Calculates hash code according to all attributes.
|
98
|
-
# @return [Integer] Hash code
|
99
|
-
def hash
|
100
|
-
[braze_id].hash
|
101
|
-
end
|
102
|
-
|
103
|
-
# Builds the object from hash
|
104
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
-
# @return [Object] Returns the model itself
|
106
|
-
def self.build_from_hash(attributes)
|
107
|
-
new.build_from_hash(attributes)
|
108
|
-
end
|
109
|
-
|
110
|
-
# Builds the object from hash
|
111
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
-
# @return [Object] Returns the model itself
|
113
|
-
def build_from_hash(attributes)
|
114
|
-
return nil unless attributes.is_a?(Hash)
|
115
|
-
self.class.openapi_types.each_pair do |key, type|
|
116
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
117
|
-
self.send("#{key}=", nil)
|
118
|
-
elsif type =~ /\AArray<(.*)>/i
|
119
|
-
# check to ensure the input is an array given that the attribute
|
120
|
-
# is documented as an array but the input is not
|
121
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
122
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
123
|
-
end
|
124
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
self
|
130
|
-
end
|
131
|
-
|
132
|
-
# Deserializes the data based on type
|
133
|
-
# @param string type Data type
|
134
|
-
# @param string value Value to be deserialized
|
135
|
-
# @return [Object] Deserialized data
|
136
|
-
def _deserialize(type, value)
|
137
|
-
case type.to_sym
|
138
|
-
when :Time
|
139
|
-
Time.parse(value)
|
140
|
-
when :Date
|
141
|
-
Date.parse(value)
|
142
|
-
when :String
|
143
|
-
value.to_s
|
144
|
-
when :Integer
|
145
|
-
value.to_i
|
146
|
-
when :Float
|
147
|
-
value.to_f
|
148
|
-
when :Boolean
|
149
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
-
true
|
151
|
-
else
|
152
|
-
false
|
153
|
-
end
|
154
|
-
when :Object
|
155
|
-
# generic object (usually a Hash), return directly
|
156
|
-
value
|
157
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
-
inner_type = Regexp.last_match[:inner_type]
|
159
|
-
value.map { |v| _deserialize(inner_type, v) }
|
160
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
-
k_type = Regexp.last_match[:k_type]
|
162
|
-
v_type = Regexp.last_match[:v_type]
|
163
|
-
{}.tap do |hash|
|
164
|
-
value.each do |k, v|
|
165
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
else # model
|
169
|
-
# models (e.g. Pet) or oneOf
|
170
|
-
klass = BrazeClient.const_get(type)
|
171
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
# Returns the string representation of the object
|
176
|
-
# @return [String] String presentation of the object
|
177
|
-
def to_s
|
178
|
-
to_hash.to_s
|
179
|
-
end
|
180
|
-
|
181
|
-
# to_body is an alias to to_hash (backward compatibility)
|
182
|
-
# @return [Hash] Returns the object in the form of hash
|
183
|
-
def to_body
|
184
|
-
to_hash
|
185
|
-
end
|
186
|
-
|
187
|
-
# Returns the object in the form of hash
|
188
|
-
# @return [Hash] Returns the object in the form of hash
|
189
|
-
def to_hash
|
190
|
-
hash = {}
|
191
|
-
self.class.attribute_map.each_pair do |attr, param|
|
192
|
-
value = self.send(attr)
|
193
|
-
if value.nil?
|
194
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
195
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
196
|
-
end
|
197
|
-
|
198
|
-
hash[param] = _to_hash(value)
|
199
|
-
end
|
200
|
-
hash
|
201
|
-
end
|
202
|
-
|
203
|
-
# Outputs non-array value in the form of hash
|
204
|
-
# For object, use to_hash. Otherwise, just return the value
|
205
|
-
# @param [Object] value Any valid value
|
206
|
-
# @return [Hash] Returns the value in the form of hash
|
207
|
-
def _to_hash(value)
|
208
|
-
if value.is_a?(Array)
|
209
|
-
value.compact.map { |v| _to_hash(v) }
|
210
|
-
elsif value.is_a?(Hash)
|
211
|
-
{}.tap do |hash|
|
212
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
-
end
|
214
|
-
elsif value.respond_to? :to_hash
|
215
|
-
value.to_hash
|
216
|
-
else
|
217
|
-
value
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Braze
|
3
|
-
|
4
|
-
#Track users, send messages, export data, and more
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 0.1.0
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.2.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'spec_helper'
|
14
|
-
require 'json'
|
15
|
-
require 'date'
|
16
|
-
|
17
|
-
# Unit tests for BrazeClient::AttributesArray
|
18
|
-
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
-
# Please update as you see appropriate
|
20
|
-
describe BrazeClient::AttributesArray do
|
21
|
-
let(:instance) { BrazeClient::AttributesArray.new }
|
22
|
-
|
23
|
-
describe 'test an instance of AttributesArray' do
|
24
|
-
it 'should create an instance of AttributesArray' do
|
25
|
-
expect(instance).to be_instance_of(BrazeClient::AttributesArray)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
describe 'test attribute "attributes"' do
|
29
|
-
it 'should work' do
|
30
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|