braze_api_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE.md +9 -0
  4. data/README.md +191 -0
  5. data/Rakefile +10 -0
  6. data/braze_api_client.gemspec +38 -0
  7. data/docs/Attributes.md +58 -0
  8. data/docs/AttributesArray.md +18 -0
  9. data/docs/AttributesCurrentLocation.md +20 -0
  10. data/docs/AttributesFacebook.md +22 -0
  11. data/docs/AttributesPushTokens.md +22 -0
  12. data/docs/AttributesTwitter.md +26 -0
  13. data/docs/Event.md +26 -0
  14. data/docs/EventsArray.md +18 -0
  15. data/docs/GeneralError.md +20 -0
  16. data/docs/Identifier.md +51 -0
  17. data/docs/IdentifierOneOf.md +18 -0
  18. data/docs/IdentifierOneOf1.md +18 -0
  19. data/docs/IdentifierOneOf2.md +18 -0
  20. data/docs/RestApi.md +427 -0
  21. data/docs/UsersTrackRequest.md +18 -0
  22. data/docs/UsersTrackResponse.md +24 -0
  23. data/git_push.sh +16 -0
  24. data/lib/braze_api_client/api/rest_api.rb +400 -0
  25. data/lib/braze_api_client/api_client.rb +390 -0
  26. data/lib/braze_api_client/api_error.rb +57 -0
  27. data/lib/braze_api_client/configuration.rb +294 -0
  28. data/lib/braze_api_client/models/attributes.rb +458 -0
  29. data/lib/braze_api_client/models/attributes_array.rb +225 -0
  30. data/lib/braze_api_client/models/attributes_current_location.rb +227 -0
  31. data/lib/braze_api_client/models/attributes_facebook.rb +238 -0
  32. data/lib/braze_api_client/models/attributes_push_tokens.rb +246 -0
  33. data/lib/braze_api_client/models/attributes_twitter.rb +254 -0
  34. data/lib/braze_api_client/models/event.rb +264 -0
  35. data/lib/braze_api_client/models/events_array.rb +220 -0
  36. data/lib/braze_api_client/models/general_error.rb +227 -0
  37. data/lib/braze_api_client/models/identifier.rb +106 -0
  38. data/lib/braze_api_client/models/identifier_one_of.rb +223 -0
  39. data/lib/braze_api_client/models/identifier_one_of1.rb +223 -0
  40. data/lib/braze_api_client/models/identifier_one_of2.rb +223 -0
  41. data/lib/braze_api_client/models/users_track_request.rb +245 -0
  42. data/lib/braze_api_client/models/users_track_response.rb +245 -0
  43. data/lib/braze_api_client/version.rb +15 -0
  44. data/lib/braze_api_client.rb +55 -0
  45. data/spec/api/rest_api_spec.rb +101 -0
  46. data/spec/api_client_spec.rb +226 -0
  47. data/spec/configuration_spec.rb +42 -0
  48. data/spec/models/attributes_array_spec.rb +34 -0
  49. data/spec/models/attributes_current_location_spec.rb +40 -0
  50. data/spec/models/attributes_facebook_spec.rb +46 -0
  51. data/spec/models/attributes_push_tokens_spec.rb +46 -0
  52. data/spec/models/attributes_spec.rb +166 -0
  53. data/spec/models/attributes_twitter_spec.rb +58 -0
  54. data/spec/models/event_spec.rb +58 -0
  55. data/spec/models/events_array_spec.rb +34 -0
  56. data/spec/models/general_error_spec.rb +40 -0
  57. data/spec/models/identifier_one_of1_spec.rb +34 -0
  58. data/spec/models/identifier_one_of2_spec.rb +34 -0
  59. data/spec/models/identifier_one_of_spec.rb +34 -0
  60. data/spec/models/identifier_spec.rb +31 -0
  61. data/spec/models/users_track_request_spec.rb +34 -0
  62. data/spec/models/users_track_response_spec.rb +52 -0
  63. data/spec/spec_helper.rb +111 -0
  64. metadata +164 -0
@@ -0,0 +1,254 @@
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 AttributesTwitter
18
+ attr_accessor :id
19
+
20
+ attr_accessor :screen_name
21
+
22
+ attr_accessor :followers_count
23
+
24
+ attr_accessor :friends_count
25
+
26
+ attr_accessor :statuses_count
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'screen_name' => :'screen_name',
33
+ :'followers_count' => :'followers_count',
34
+ :'friends_count' => :'friends_count',
35
+ :'statuses_count' => :'statuses_count'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'id' => :'Integer',
48
+ :'screen_name' => :'String',
49
+ :'followers_count' => :'Integer',
50
+ :'friends_count' => :'Integer',
51
+ :'statuses_count' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BrazeClient::AttributesTwitter` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BrazeClient::AttributesTwitter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'id')
77
+ self.id = attributes[:'id']
78
+ end
79
+
80
+ if attributes.key?(:'screen_name')
81
+ self.screen_name = attributes[:'screen_name']
82
+ end
83
+
84
+ if attributes.key?(:'followers_count')
85
+ self.followers_count = attributes[:'followers_count']
86
+ end
87
+
88
+ if attributes.key?(:'friends_count')
89
+ self.friends_count = attributes[:'friends_count']
90
+ end
91
+
92
+ if attributes.key?(:'statuses_count')
93
+ self.statuses_count = attributes[:'statuses_count']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ id == o.id &&
116
+ screen_name == o.screen_name &&
117
+ followers_count == o.followers_count &&
118
+ friends_count == o.friends_count &&
119
+ statuses_count == o.statuses_count
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [id, screen_name, followers_count, friends_count, statuses_count].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.openapi_types.each_pair do |key, type|
147
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
148
+ self.send("#{key}=", nil)
149
+ elsif type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ end
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :Time
170
+ Time.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :Boolean
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ # models (e.g. Pet) or oneOf
201
+ klass = BrazeClient.const_get(type)
202
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map { |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+
252
+ end
253
+
254
+ end
@@ -0,0 +1,264 @@
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 Event
18
+ attr_accessor :name
19
+
20
+ attr_accessor :time
21
+
22
+ attr_accessor :app_id
23
+
24
+ attr_accessor :properties
25
+
26
+ attr_accessor :_update_existing_only
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'name' => :'name',
32
+ :'time' => :'time',
33
+ :'app_id' => :'app_id',
34
+ :'properties' => :'properties',
35
+ :'_update_existing_only' => :'_update_existing_only'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'name' => :'String',
48
+ :'time' => :'Time',
49
+ :'app_id' => :'String',
50
+ :'properties' => :'Object',
51
+ :'_update_existing_only' => :'Boolean'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BrazeClient::Event` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BrazeClient::Event`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'name')
77
+ self.name = attributes[:'name']
78
+ end
79
+
80
+ if attributes.key?(:'time')
81
+ self.time = attributes[:'time']
82
+ end
83
+
84
+ if attributes.key?(:'app_id')
85
+ self.app_id = attributes[:'app_id']
86
+ end
87
+
88
+ if attributes.key?(:'properties')
89
+ self.properties = attributes[:'properties']
90
+ end
91
+
92
+ if attributes.key?(:'_update_existing_only')
93
+ self._update_existing_only = attributes[:'_update_existing_only']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ if @name.nil?
102
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
103
+ end
104
+
105
+ if @time.nil?
106
+ invalid_properties.push('invalid value for "time", time cannot be nil.')
107
+ end
108
+
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ return false if @name.nil?
116
+ return false if @time.nil?
117
+ true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ name == o.name &&
126
+ time == o.time &&
127
+ app_id == o.app_id &&
128
+ properties == o.properties &&
129
+ _update_existing_only == o._update_existing_only
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [name, time, app_id, properties, _update_existing_only].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ new.build_from_hash(attributes)
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.openapi_types.each_pair do |key, type|
157
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
158
+ self.send("#{key}=", nil)
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
163
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
164
+ end
165
+ elsif !attributes[self.class.attribute_map[key]].nil?
166
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
167
+ end
168
+ end
169
+
170
+ self
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param string type Data type
175
+ # @param string value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def _deserialize(type, value)
178
+ case type.to_sym
179
+ when :Time
180
+ Time.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :Boolean
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ # models (e.g. Pet) or oneOf
211
+ klass = BrazeClient.const_get(type)
212
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ if value.nil?
235
+ is_nullable = self.class.openapi_nullable.include?(attr)
236
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
237
+ end
238
+
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ hash
242
+ end
243
+
244
+ # Outputs non-array value in the form of hash
245
+ # For object, use to_hash. Otherwise, just return the value
246
+ # @param [Object] value Any valid value
247
+ # @return [Hash] Returns the value in the form of hash
248
+ def _to_hash(value)
249
+ if value.is_a?(Array)
250
+ value.compact.map { |v| _to_hash(v) }
251
+ elsif value.is_a?(Hash)
252
+ {}.tap do |hash|
253
+ value.each { |k, v| hash[k] = _to_hash(v) }
254
+ end
255
+ elsif value.respond_to? :to_hash
256
+ value.to_hash
257
+ else
258
+ value
259
+ end
260
+ end
261
+
262
+ end
263
+
264
+ end