svix 1.36.0 → 1.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/svix/models/azure_blob_storage_config.rb +251 -0
- data/lib/svix/models/environment_in.rb +13 -1
- data/lib/svix/models/environment_out.rb +17 -1
- data/lib/svix/models/google_cloud_storage_config.rb +239 -0
- data/lib/svix/models/redshift_config.rb +311 -0
- data/lib/svix/models/s3_config.rb +10 -10
- data/lib/svix/models/sink_http_config.rb +12 -1
- data/lib/svix/models/sink_in.rb +1 -2
- data/lib/svix/models/sink_in_one_of3.rb +2 -2
- data/lib/svix/models/sink_out.rb +1 -2
- data/lib/svix/models/snowflake_config.rb +7 -0
- data/lib/svix/models/stream_sink_in.rb +4 -1
- data/lib/svix/models/stream_sink_in_one_of.rb +3 -3
- data/lib/svix/models/stream_sink_in_one_of1.rb +3 -3
- data/lib/svix/models/stream_sink_in_one_of2.rb +3 -3
- data/lib/svix/models/stream_sink_in_one_of3.rb +3 -3
- data/lib/svix/models/stream_sink_in_one_of4.rb +271 -0
- data/lib/svix/models/stream_sink_in_one_of5.rb +271 -0
- data/lib/svix/models/{sink_in_one_of4.rb → stream_sink_in_one_of6.rb} +23 -23
- data/lib/svix/models/stream_sink_out.rb +4 -1
- data/lib/svix/models/stream_sink_patch.rb +4 -1
- data/lib/svix/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299d853f35fd4e89ad80a1248e6d987359a65783e76c0645870483b33ca0c776
|
4
|
+
data.tar.gz: e9a1e5dbdf4ad3b47813bc12cea256a286eb3f101fecd4085e6308bfa3770f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d05f948ab81fee2143d0affa16431661580ffc39a035ceb169ecf622900f0e31be15fd959ec387bc2cfccdebb571989cedeb900b8d7fa1f8c7f5ce52c63efdb0
|
7
|
+
data.tar.gz: e7f8920944c749e874dc2e4a621630bf6c6cfc1baf542c5002943143890b683731411afbbd7665e0f7df8a7a42f206509ff523c699fcf794e7717ea243269033
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,251 @@
|
|
1
|
+
=begin
|
2
|
+
#Svix API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.1.1
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
class AzureBlobStorageConfig
|
18
|
+
attr_accessor :access_key
|
19
|
+
|
20
|
+
attr_accessor :account
|
21
|
+
|
22
|
+
attr_accessor :container
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'access_key' => :'accessKey',
|
28
|
+
:'account' => :'account',
|
29
|
+
:'container' => :'container'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'access_key' => :'String',
|
42
|
+
:'account' => :'String',
|
43
|
+
:'container' => :'String'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
])
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
if (!attributes.is_a?(Hash))
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::AzureBlobStorageConfig` initialize method"
|
58
|
+
end
|
59
|
+
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::AzureBlobStorageConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
64
|
+
end
|
65
|
+
h[k.to_sym] = v
|
66
|
+
}
|
67
|
+
|
68
|
+
if attributes.key?(:'access_key')
|
69
|
+
self.access_key = attributes[:'access_key']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'account')
|
73
|
+
self.account = attributes[:'account']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'container')
|
77
|
+
self.container = attributes[:'container']
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
+
# @return Array for valid properties with the reasons
|
83
|
+
def list_invalid_properties
|
84
|
+
invalid_properties = Array.new
|
85
|
+
if @access_key.nil?
|
86
|
+
invalid_properties.push('invalid value for "access_key", access_key cannot be nil.')
|
87
|
+
end
|
88
|
+
|
89
|
+
if @account.nil?
|
90
|
+
invalid_properties.push('invalid value for "account", account cannot be nil.')
|
91
|
+
end
|
92
|
+
|
93
|
+
if @container.nil?
|
94
|
+
invalid_properties.push('invalid value for "container", container cannot be nil.')
|
95
|
+
end
|
96
|
+
|
97
|
+
invalid_properties
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check to see if the all the properties in the model are valid
|
101
|
+
# @return true if the model is valid
|
102
|
+
def valid?
|
103
|
+
return false if @access_key.nil?
|
104
|
+
return false if @account.nil?
|
105
|
+
return false if @container.nil?
|
106
|
+
true
|
107
|
+
end
|
108
|
+
|
109
|
+
# Checks equality by comparing each attribute.
|
110
|
+
# @param [Object] Object to be compared
|
111
|
+
def ==(o)
|
112
|
+
return true if self.equal?(o)
|
113
|
+
self.class == o.class &&
|
114
|
+
access_key == o.access_key &&
|
115
|
+
account == o.account &&
|
116
|
+
container == o.container
|
117
|
+
end
|
118
|
+
|
119
|
+
# @see the `==` method
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def eql?(o)
|
122
|
+
self == o
|
123
|
+
end
|
124
|
+
|
125
|
+
# Calculates hash code according to all attributes.
|
126
|
+
# @return [Integer] Hash code
|
127
|
+
def hash
|
128
|
+
[access_key, account, container].hash
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def self.build_from_hash(attributes)
|
135
|
+
new.build_from_hash(attributes)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
self.class.openapi_types.each_pair do |key, type|
|
144
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
145
|
+
self.send("#{key}=", nil)
|
146
|
+
elsif type =~ /\AArray<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
151
|
+
end
|
152
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
153
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
# Deserializes the data based on type
|
161
|
+
# @param string type Data type
|
162
|
+
# @param string value Value to be deserialized
|
163
|
+
# @return [Object] Deserialized data
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :Time
|
167
|
+
Time.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :Boolean
|
177
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
# models (e.g. Pet) or oneOf
|
198
|
+
klass = Svix.const_get(type)
|
199
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the string representation of the object
|
204
|
+
# @return [String] String presentation of the object
|
205
|
+
def to_s
|
206
|
+
to_hash.to_s
|
207
|
+
end
|
208
|
+
|
209
|
+
# to_body is an alias to to_hash (backward compatibility)
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_body
|
212
|
+
to_hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the object in the form of hash
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
217
|
+
def to_hash
|
218
|
+
hash = {}
|
219
|
+
self.class.attribute_map.each_pair do |attr, param|
|
220
|
+
value = self.send(attr)
|
221
|
+
if value.nil?
|
222
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
223
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
224
|
+
end
|
225
|
+
|
226
|
+
hash[param] = _to_hash(value)
|
227
|
+
end
|
228
|
+
hash
|
229
|
+
end
|
230
|
+
|
231
|
+
# Outputs non-array value in the form of hash
|
232
|
+
# For object, use to_hash. Otherwise, just return the value
|
233
|
+
# @param [Object] value Any valid value
|
234
|
+
# @return [Hash] Returns the value in the form of hash
|
235
|
+
def _to_hash(value)
|
236
|
+
if value.is_a?(Array)
|
237
|
+
value.compact.map { |v| _to_hash(v) }
|
238
|
+
elsif value.is_a?(Hash)
|
239
|
+
{}.tap do |hash|
|
240
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
241
|
+
end
|
242
|
+
elsif value.respond_to? :to_hash
|
243
|
+
value.to_hash
|
244
|
+
else
|
245
|
+
value
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
@@ -21,6 +21,8 @@ module Svix
|
|
21
21
|
|
22
22
|
attr_accessor :settings
|
23
23
|
|
24
|
+
attr_accessor :transformation_templates
|
25
|
+
|
24
26
|
attr_accessor :version
|
25
27
|
|
26
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -29,6 +31,7 @@ module Svix
|
|
29
31
|
:'created_at' => :'createdAt',
|
30
32
|
:'event_types' => :'eventTypes',
|
31
33
|
:'settings' => :'settings',
|
34
|
+
:'transformation_templates' => :'transformationTemplates',
|
32
35
|
:'version' => :'version'
|
33
36
|
}
|
34
37
|
end
|
@@ -44,6 +47,7 @@ module Svix
|
|
44
47
|
:'created_at' => :'Time',
|
45
48
|
:'event_types' => :'Array<EventTypeIn>',
|
46
49
|
:'settings' => :'SettingsIn',
|
50
|
+
:'transformation_templates' => :'Array<TemplateIn>',
|
47
51
|
:'version' => :'Integer'
|
48
52
|
}
|
49
53
|
end
|
@@ -52,6 +56,7 @@ module Svix
|
|
52
56
|
def self.openapi_nullable
|
53
57
|
Set.new([
|
54
58
|
:'event_types',
|
59
|
+
:'transformation_templates',
|
55
60
|
])
|
56
61
|
end
|
57
62
|
|
@@ -84,6 +89,12 @@ module Svix
|
|
84
89
|
self.settings = attributes[:'settings']
|
85
90
|
end
|
86
91
|
|
92
|
+
if attributes.key?(:'transformation_templates')
|
93
|
+
if (value = attributes[:'transformation_templates']).is_a?(Array)
|
94
|
+
self.transformation_templates = value
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
87
98
|
if attributes.key?(:'version')
|
88
99
|
self.version = attributes[:'version']
|
89
100
|
end
|
@@ -120,6 +131,7 @@ module Svix
|
|
120
131
|
created_at == o.created_at &&
|
121
132
|
event_types == o.event_types &&
|
122
133
|
settings == o.settings &&
|
134
|
+
transformation_templates == o.transformation_templates &&
|
123
135
|
version == o.version
|
124
136
|
end
|
125
137
|
|
@@ -132,7 +144,7 @@ module Svix
|
|
132
144
|
# Calculates hash code according to all attributes.
|
133
145
|
# @return [Integer] Hash code
|
134
146
|
def hash
|
135
|
-
[created_at, event_types, settings, version].hash
|
147
|
+
[created_at, event_types, settings, transformation_templates, version].hash
|
136
148
|
end
|
137
149
|
|
138
150
|
# Builds the object from hash
|
@@ -21,6 +21,8 @@ module Svix
|
|
21
21
|
|
22
22
|
attr_accessor :settings
|
23
23
|
|
24
|
+
attr_accessor :transformation_templates
|
25
|
+
|
24
26
|
attr_accessor :version
|
25
27
|
|
26
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -29,6 +31,7 @@ module Svix
|
|
29
31
|
:'created_at' => :'createdAt',
|
30
32
|
:'event_types' => :'eventTypes',
|
31
33
|
:'settings' => :'settings',
|
34
|
+
:'transformation_templates' => :'transformationTemplates',
|
32
35
|
:'version' => :'version'
|
33
36
|
}
|
34
37
|
end
|
@@ -44,6 +47,7 @@ module Svix
|
|
44
47
|
:'created_at' => :'Time',
|
45
48
|
:'event_types' => :'Array<EventTypeOut>',
|
46
49
|
:'settings' => :'SettingsOut',
|
50
|
+
:'transformation_templates' => :'Array<TemplateOut>',
|
47
51
|
:'version' => :'Integer'
|
48
52
|
}
|
49
53
|
end
|
@@ -83,6 +87,12 @@ module Svix
|
|
83
87
|
self.settings = attributes[:'settings']
|
84
88
|
end
|
85
89
|
|
90
|
+
if attributes.key?(:'transformation_templates')
|
91
|
+
if (value = attributes[:'transformation_templates']).is_a?(Array)
|
92
|
+
self.transformation_templates = value
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
86
96
|
if attributes.key?(:'version')
|
87
97
|
self.version = attributes[:'version']
|
88
98
|
else
|
@@ -102,6 +112,10 @@ module Svix
|
|
102
112
|
invalid_properties.push('invalid value for "event_types", event_types cannot be nil.')
|
103
113
|
end
|
104
114
|
|
115
|
+
if @transformation_templates.nil?
|
116
|
+
invalid_properties.push('invalid value for "transformation_templates", transformation_templates cannot be nil.')
|
117
|
+
end
|
118
|
+
|
105
119
|
invalid_properties
|
106
120
|
end
|
107
121
|
|
@@ -110,6 +124,7 @@ module Svix
|
|
110
124
|
def valid?
|
111
125
|
return false if @created_at.nil?
|
112
126
|
return false if @event_types.nil?
|
127
|
+
return false if @transformation_templates.nil?
|
113
128
|
true
|
114
129
|
end
|
115
130
|
|
@@ -121,6 +136,7 @@ module Svix
|
|
121
136
|
created_at == o.created_at &&
|
122
137
|
event_types == o.event_types &&
|
123
138
|
settings == o.settings &&
|
139
|
+
transformation_templates == o.transformation_templates &&
|
124
140
|
version == o.version
|
125
141
|
end
|
126
142
|
|
@@ -133,7 +149,7 @@ module Svix
|
|
133
149
|
# Calculates hash code according to all attributes.
|
134
150
|
# @return [Integer] Hash code
|
135
151
|
def hash
|
136
|
-
[created_at, event_types, settings, version].hash
|
152
|
+
[created_at, event_types, settings, transformation_templates, version].hash
|
137
153
|
end
|
138
154
|
|
139
155
|
# Builds the object from hash
|
@@ -0,0 +1,239 @@
|
|
1
|
+
=begin
|
2
|
+
#Svix API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.1.1
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
# Configuration for a Google Cloud Storage sink. Write stream events into the named bucket using the supplied Google Cloud credentials.
|
18
|
+
class GoogleCloudStorageConfig
|
19
|
+
attr_accessor :bucket
|
20
|
+
|
21
|
+
# Google Cloud Credentials JSON Object as a string.
|
22
|
+
attr_accessor :credentials
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'bucket' => :'bucket',
|
28
|
+
:'credentials' => :'credentials'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns all the JSON keys this model knows about
|
33
|
+
def self.acceptable_attributes
|
34
|
+
attribute_map.values
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.openapi_types
|
39
|
+
{
|
40
|
+
:'bucket' => :'String',
|
41
|
+
:'credentials' => :'String'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::GoogleCloudStorageConfig` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::GoogleCloudStorageConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
+
end
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:'bucket')
|
67
|
+
self.bucket = attributes[:'bucket']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'credentials')
|
71
|
+
self.credentials = attributes[:'credentials']
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properties with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
if @bucket.nil?
|
80
|
+
invalid_properties.push('invalid value for "bucket", bucket cannot be nil.')
|
81
|
+
end
|
82
|
+
|
83
|
+
if @credentials.nil?
|
84
|
+
invalid_properties.push('invalid value for "credentials", credentials cannot be nil.')
|
85
|
+
end
|
86
|
+
|
87
|
+
invalid_properties
|
88
|
+
end
|
89
|
+
|
90
|
+
# Check to see if the all the properties in the model are valid
|
91
|
+
# @return true if the model is valid
|
92
|
+
def valid?
|
93
|
+
return false if @bucket.nil?
|
94
|
+
return false if @credentials.nil?
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Checks equality by comparing each attribute.
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def ==(o)
|
101
|
+
return true if self.equal?(o)
|
102
|
+
self.class == o.class &&
|
103
|
+
bucket == o.bucket &&
|
104
|
+
credentials == o.credentials
|
105
|
+
end
|
106
|
+
|
107
|
+
# @see the `==` method
|
108
|
+
# @param [Object] Object to be compared
|
109
|
+
def eql?(o)
|
110
|
+
self == o
|
111
|
+
end
|
112
|
+
|
113
|
+
# Calculates hash code according to all attributes.
|
114
|
+
# @return [Integer] Hash code
|
115
|
+
def hash
|
116
|
+
[bucket, credentials].hash
|
117
|
+
end
|
118
|
+
|
119
|
+
# Builds the object from hash
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
# @return [Object] Returns the model itself
|
122
|
+
def self.build_from_hash(attributes)
|
123
|
+
new.build_from_hash(attributes)
|
124
|
+
end
|
125
|
+
|
126
|
+
# Builds the object from hash
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
+
# @return [Object] Returns the model itself
|
129
|
+
def build_from_hash(attributes)
|
130
|
+
return nil unless attributes.is_a?(Hash)
|
131
|
+
self.class.openapi_types.each_pair do |key, type|
|
132
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
133
|
+
self.send("#{key}=", nil)
|
134
|
+
elsif type =~ /\AArray<(.*)>/i
|
135
|
+
# check to ensure the input is an array given that the attribute
|
136
|
+
# is documented as an array but the input is not
|
137
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
138
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
139
|
+
end
|
140
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
141
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
self
|
146
|
+
end
|
147
|
+
|
148
|
+
# Deserializes the data based on type
|
149
|
+
# @param string type Data type
|
150
|
+
# @param string value Value to be deserialized
|
151
|
+
# @return [Object] Deserialized data
|
152
|
+
def _deserialize(type, value)
|
153
|
+
case type.to_sym
|
154
|
+
when :Time
|
155
|
+
Time.parse(value)
|
156
|
+
when :Date
|
157
|
+
Date.parse(value)
|
158
|
+
when :String
|
159
|
+
value.to_s
|
160
|
+
when :Integer
|
161
|
+
value.to_i
|
162
|
+
when :Float
|
163
|
+
value.to_f
|
164
|
+
when :Boolean
|
165
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
166
|
+
true
|
167
|
+
else
|
168
|
+
false
|
169
|
+
end
|
170
|
+
when :Object
|
171
|
+
# generic object (usually a Hash), return directly
|
172
|
+
value
|
173
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
174
|
+
inner_type = Regexp.last_match[:inner_type]
|
175
|
+
value.map { |v| _deserialize(inner_type, v) }
|
176
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
177
|
+
k_type = Regexp.last_match[:k_type]
|
178
|
+
v_type = Regexp.last_match[:v_type]
|
179
|
+
{}.tap do |hash|
|
180
|
+
value.each do |k, v|
|
181
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
else # model
|
185
|
+
# models (e.g. Pet) or oneOf
|
186
|
+
klass = Svix.const_get(type)
|
187
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
|
+
if value.nil?
|
210
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
211
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
212
|
+
end
|
213
|
+
|
214
|
+
hash[param] = _to_hash(value)
|
215
|
+
end
|
216
|
+
hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Outputs non-array value in the form of hash
|
220
|
+
# For object, use to_hash. Otherwise, just return the value
|
221
|
+
# @param [Object] value Any valid value
|
222
|
+
# @return [Hash] Returns the value in the form of hash
|
223
|
+
def _to_hash(value)
|
224
|
+
if value.is_a?(Array)
|
225
|
+
value.compact.map { |v| _to_hash(v) }
|
226
|
+
elsif value.is_a?(Hash)
|
227
|
+
{}.tap do |hash|
|
228
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
229
|
+
end
|
230
|
+
elsif value.respond_to? :to_hash
|
231
|
+
value.to_hash
|
232
|
+
else
|
233
|
+
value
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|