svix 1.8.0 → 1.9.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/api/transformation_template_api.rb +68 -0
- data/lib/svix/models/transformation_simulate_in.rb +328 -0
- data/lib/svix/models/transformation_simulate_out.rb +274 -0
- data/lib/svix/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 662693eb41c3ae0869b7b59d6a9ae16393e0b4ef5328ea05f6dafc071e8e5b90
|
4
|
+
data.tar.gz: 81d017c1e3af2ddd6661c208263f0b0e314b0d56878e7d3e67e427228529134a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0b11ae15356500c338927c3cdae63ef218767856e7db74a3427434c47c2248e71bca1b51cf604665f97e960b4c42c7c4603bf0f30d07868cac61675475ec076
|
7
|
+
data.tar.gz: 94315ad63b1353304c8be42ba70b227b480908102e05548bd687787d71c49108922cbd3d80f92cf9fe514d739c3f522eb9a27a7ebf4439f908882df7f855d7d0
|
data/Gemfile.lock
CHANGED
@@ -358,6 +358,74 @@ module Svix
|
|
358
358
|
return data, status_code, headers
|
359
359
|
end
|
360
360
|
|
361
|
+
# Simulate
|
362
|
+
# Simulate running the transformation on the payload and code
|
363
|
+
# @param transformation_simulate_in [TransformationSimulateIn]
|
364
|
+
# @param [Hash] opts the optional parameters
|
365
|
+
# @option opts [String] :idempotency_key The request's idempotency key
|
366
|
+
# @return [TransformationSimulateOut]
|
367
|
+
def v1_transformation_template_simulate(transformation_simulate_in, opts = {})
|
368
|
+
data, _status_code, _headers = v1_transformation_template_simulate_with_http_info(transformation_simulate_in, opts)
|
369
|
+
data
|
370
|
+
end
|
371
|
+
|
372
|
+
# Simulate
|
373
|
+
# Simulate running the transformation on the payload and code
|
374
|
+
# @param transformation_simulate_in [TransformationSimulateIn]
|
375
|
+
# @param [Hash] opts the optional parameters
|
376
|
+
# @option opts [String] :idempotency_key The request's idempotency key
|
377
|
+
# @return [Array<(TransformationSimulateOut, Integer, Hash)>] TransformationSimulateOut data, response status code and response headers
|
378
|
+
def v1_transformation_template_simulate_with_http_info(transformation_simulate_in, opts = {})
|
379
|
+
if @api_client.config.debugging
|
380
|
+
@api_client.config.logger.debug 'Calling API: TransformationTemplateApi.v1_transformation_template_simulate ...'
|
381
|
+
end
|
382
|
+
# verify the required parameter 'transformation_simulate_in' is set
|
383
|
+
if @api_client.config.client_side_validation && transformation_simulate_in.nil?
|
384
|
+
fail ArgumentError, "Missing the required parameter 'transformation_simulate_in' when calling TransformationTemplateApi.v1_transformation_template_simulate"
|
385
|
+
end
|
386
|
+
# resource path
|
387
|
+
local_var_path = '/api/v1/transformation-template/simulate'
|
388
|
+
|
389
|
+
# query parameters
|
390
|
+
query_params = opts[:query_params] || {}
|
391
|
+
|
392
|
+
# header parameters
|
393
|
+
header_params = opts[:header_params] || {}
|
394
|
+
# HTTP header 'Accept' (if needed)
|
395
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
396
|
+
# HTTP header 'Content-Type'
|
397
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
398
|
+
header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
399
|
+
|
400
|
+
# form parameters
|
401
|
+
form_params = opts[:form_params] || {}
|
402
|
+
|
403
|
+
# http body (model)
|
404
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(transformation_simulate_in)
|
405
|
+
|
406
|
+
# return_type
|
407
|
+
return_type = opts[:debug_return_type] || 'TransformationSimulateOut'
|
408
|
+
|
409
|
+
# auth_names
|
410
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
411
|
+
|
412
|
+
new_options = opts.merge(
|
413
|
+
:operation => :"TransformationTemplateApi.v1_transformation_template_simulate",
|
414
|
+
:header_params => header_params,
|
415
|
+
:query_params => query_params,
|
416
|
+
:form_params => form_params,
|
417
|
+
:body => post_body,
|
418
|
+
:auth_names => auth_names,
|
419
|
+
:return_type => return_type
|
420
|
+
)
|
421
|
+
|
422
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
423
|
+
if @api_client.config.debugging
|
424
|
+
@api_client.config.logger.debug "API called: TransformationTemplateApi#v1_transformation_template_simulate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
425
|
+
end
|
426
|
+
return data, status_code, headers
|
427
|
+
end
|
428
|
+
|
361
429
|
# Update Transformation Template
|
362
430
|
# Update a transformation template
|
363
431
|
# @param transformation_template_id [String]
|
@@ -0,0 +1,328 @@
|
|
1
|
+
=begin
|
2
|
+
#Svix API
|
3
|
+
|
4
|
+
#Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. For more information on authentication, please refer to the [authentication token docs](https://docs.svix.com/api-keys). <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Idempotency Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result. Please note that idempotency is only supported for `POST` requests. ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.7.0
|
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 TransformationSimulateIn
|
18
|
+
attr_accessor :channels
|
19
|
+
|
20
|
+
attr_accessor :code
|
21
|
+
|
22
|
+
# The event type's name
|
23
|
+
attr_accessor :event_type
|
24
|
+
|
25
|
+
attr_accessor :payload
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'channels' => :'channels',
|
31
|
+
:'code' => :'code',
|
32
|
+
:'event_type' => :'eventType',
|
33
|
+
:'payload' => :'payload'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Returns all the JSON keys this model knows about
|
38
|
+
def self.acceptable_attributes
|
39
|
+
attribute_map.values
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.openapi_types
|
44
|
+
{
|
45
|
+
:'channels' => :'Array<String>',
|
46
|
+
:'code' => :'String',
|
47
|
+
:'event_type' => :'String',
|
48
|
+
:'payload' => :'Object'
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# List of attributes with nullable: true
|
53
|
+
def self.openapi_nullable
|
54
|
+
Set.new([
|
55
|
+
:'channels',
|
56
|
+
])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initializes the object
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
+
def initialize(attributes = {})
|
62
|
+
if (!attributes.is_a?(Hash))
|
63
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::TransformationSimulateIn` initialize method"
|
64
|
+
end
|
65
|
+
|
66
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
68
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::TransformationSimulateIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
70
|
+
end
|
71
|
+
h[k.to_sym] = v
|
72
|
+
}
|
73
|
+
|
74
|
+
if attributes.key?(:'channels')
|
75
|
+
if (value = attributes[:'channels']).is_a?(Array)
|
76
|
+
self.channels = value
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'code')
|
81
|
+
self.code = attributes[:'code']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'event_type')
|
85
|
+
self.event_type = attributes[:'event_type']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:'payload')
|
89
|
+
self.payload = attributes[:'payload']
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
94
|
+
# @return Array for valid properties with the reasons
|
95
|
+
def list_invalid_properties
|
96
|
+
invalid_properties = Array.new
|
97
|
+
if @code.nil?
|
98
|
+
invalid_properties.push('invalid value for "code", code cannot be nil.')
|
99
|
+
end
|
100
|
+
|
101
|
+
if @code.to_s.length > 51200
|
102
|
+
invalid_properties.push('invalid value for "code", the character length must be smaller than or equal to 51200.')
|
103
|
+
end
|
104
|
+
|
105
|
+
if @code.to_s.length < 10
|
106
|
+
invalid_properties.push('invalid value for "code", the character length must be great than or equal to 10.')
|
107
|
+
end
|
108
|
+
|
109
|
+
if @event_type.nil?
|
110
|
+
invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
|
111
|
+
end
|
112
|
+
|
113
|
+
if @event_type.to_s.length > 256
|
114
|
+
invalid_properties.push('invalid value for "event_type", the character length must be smaller than or equal to 256.')
|
115
|
+
end
|
116
|
+
|
117
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
118
|
+
if @event_type !~ pattern
|
119
|
+
invalid_properties.push("invalid value for \"event_type\", must conform to the pattern #{pattern}.")
|
120
|
+
end
|
121
|
+
|
122
|
+
if @payload.nil?
|
123
|
+
invalid_properties.push('invalid value for "payload", payload cannot be nil.')
|
124
|
+
end
|
125
|
+
|
126
|
+
invalid_properties
|
127
|
+
end
|
128
|
+
|
129
|
+
# Check to see if the all the properties in the model are valid
|
130
|
+
# @return true if the model is valid
|
131
|
+
def valid?
|
132
|
+
return false if @code.nil?
|
133
|
+
return false if @code.to_s.length > 51200
|
134
|
+
return false if @code.to_s.length < 10
|
135
|
+
return false if @event_type.nil?
|
136
|
+
return false if @event_type.to_s.length > 256
|
137
|
+
return false if @event_type !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
138
|
+
return false if @payload.nil?
|
139
|
+
true
|
140
|
+
end
|
141
|
+
|
142
|
+
# Custom attribute writer method with validation
|
143
|
+
# @param [Object] channels Value to be assigned
|
144
|
+
def channels=(channels)
|
145
|
+
@channels = channels
|
146
|
+
end
|
147
|
+
|
148
|
+
# Custom attribute writer method with validation
|
149
|
+
# @param [Object] code Value to be assigned
|
150
|
+
def code=(code)
|
151
|
+
if code.nil?
|
152
|
+
fail ArgumentError, 'code cannot be nil'
|
153
|
+
end
|
154
|
+
|
155
|
+
if code.to_s.length > 51200
|
156
|
+
fail ArgumentError, 'invalid value for "code", the character length must be smaller than or equal to 51200.'
|
157
|
+
end
|
158
|
+
|
159
|
+
if code.to_s.length < 10
|
160
|
+
fail ArgumentError, 'invalid value for "code", the character length must be great than or equal to 10.'
|
161
|
+
end
|
162
|
+
|
163
|
+
@code = code
|
164
|
+
end
|
165
|
+
|
166
|
+
# Custom attribute writer method with validation
|
167
|
+
# @param [Object] event_type Value to be assigned
|
168
|
+
def event_type=(event_type)
|
169
|
+
if event_type.nil?
|
170
|
+
fail ArgumentError, 'event_type cannot be nil'
|
171
|
+
end
|
172
|
+
|
173
|
+
if event_type.to_s.length > 256
|
174
|
+
fail ArgumentError, 'invalid value for "event_type", the character length must be smaller than or equal to 256.'
|
175
|
+
end
|
176
|
+
|
177
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
178
|
+
if event_type !~ pattern
|
179
|
+
fail ArgumentError, "invalid value for \"event_type\", must conform to the pattern #{pattern}."
|
180
|
+
end
|
181
|
+
|
182
|
+
@event_type = event_type
|
183
|
+
end
|
184
|
+
|
185
|
+
# Checks equality by comparing each attribute.
|
186
|
+
# @param [Object] Object to be compared
|
187
|
+
def ==(o)
|
188
|
+
return true if self.equal?(o)
|
189
|
+
self.class == o.class &&
|
190
|
+
channels == o.channels &&
|
191
|
+
code == o.code &&
|
192
|
+
event_type == o.event_type &&
|
193
|
+
payload == o.payload
|
194
|
+
end
|
195
|
+
|
196
|
+
# @see the `==` method
|
197
|
+
# @param [Object] Object to be compared
|
198
|
+
def eql?(o)
|
199
|
+
self == o
|
200
|
+
end
|
201
|
+
|
202
|
+
# Calculates hash code according to all attributes.
|
203
|
+
# @return [Integer] Hash code
|
204
|
+
def hash
|
205
|
+
[channels, code, event_type, payload].hash
|
206
|
+
end
|
207
|
+
|
208
|
+
# Builds the object from hash
|
209
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
210
|
+
# @return [Object] Returns the model itself
|
211
|
+
def self.build_from_hash(attributes)
|
212
|
+
new.build_from_hash(attributes)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Builds the object from hash
|
216
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
217
|
+
# @return [Object] Returns the model itself
|
218
|
+
def build_from_hash(attributes)
|
219
|
+
return nil unless attributes.is_a?(Hash)
|
220
|
+
self.class.openapi_types.each_pair do |key, type|
|
221
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
222
|
+
self.send("#{key}=", nil)
|
223
|
+
elsif type =~ /\AArray<(.*)>/i
|
224
|
+
# check to ensure the input is an array given that the attribute
|
225
|
+
# is documented as an array but the input is not
|
226
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
227
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
228
|
+
end
|
229
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
230
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
self
|
235
|
+
end
|
236
|
+
|
237
|
+
# Deserializes the data based on type
|
238
|
+
# @param string type Data type
|
239
|
+
# @param string value Value to be deserialized
|
240
|
+
# @return [Object] Deserialized data
|
241
|
+
def _deserialize(type, value)
|
242
|
+
case type.to_sym
|
243
|
+
when :Time
|
244
|
+
Time.parse(value)
|
245
|
+
when :Date
|
246
|
+
Date.parse(value)
|
247
|
+
when :String
|
248
|
+
value.to_s
|
249
|
+
when :Integer
|
250
|
+
value.to_i
|
251
|
+
when :Float
|
252
|
+
value.to_f
|
253
|
+
when :Boolean
|
254
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
255
|
+
true
|
256
|
+
else
|
257
|
+
false
|
258
|
+
end
|
259
|
+
when :Object
|
260
|
+
# generic object (usually a Hash), return directly
|
261
|
+
value
|
262
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
263
|
+
inner_type = Regexp.last_match[:inner_type]
|
264
|
+
value.map { |v| _deserialize(inner_type, v) }
|
265
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
266
|
+
k_type = Regexp.last_match[:k_type]
|
267
|
+
v_type = Regexp.last_match[:v_type]
|
268
|
+
{}.tap do |hash|
|
269
|
+
value.each do |k, v|
|
270
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
else # model
|
274
|
+
# models (e.g. Pet) or oneOf
|
275
|
+
klass = Svix.const_get(type)
|
276
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
# Returns the string representation of the object
|
281
|
+
# @return [String] String presentation of the object
|
282
|
+
def to_s
|
283
|
+
to_hash.to_s
|
284
|
+
end
|
285
|
+
|
286
|
+
# to_body is an alias to to_hash (backward compatibility)
|
287
|
+
# @return [Hash] Returns the object in the form of hash
|
288
|
+
def to_body
|
289
|
+
to_hash
|
290
|
+
end
|
291
|
+
|
292
|
+
# Returns the object in the form of hash
|
293
|
+
# @return [Hash] Returns the object in the form of hash
|
294
|
+
def to_hash
|
295
|
+
hash = {}
|
296
|
+
self.class.attribute_map.each_pair do |attr, param|
|
297
|
+
value = self.send(attr)
|
298
|
+
if value.nil?
|
299
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
300
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
301
|
+
end
|
302
|
+
|
303
|
+
hash[param] = _to_hash(value)
|
304
|
+
end
|
305
|
+
hash
|
306
|
+
end
|
307
|
+
|
308
|
+
# Outputs non-array value in the form of hash
|
309
|
+
# For object, use to_hash. Otherwise, just return the value
|
310
|
+
# @param [Object] value Any valid value
|
311
|
+
# @return [Hash] Returns the value in the form of hash
|
312
|
+
def _to_hash(value)
|
313
|
+
if value.is_a?(Array)
|
314
|
+
value.compact.map { |v| _to_hash(v) }
|
315
|
+
elsif value.is_a?(Hash)
|
316
|
+
{}.tap do |hash|
|
317
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
318
|
+
end
|
319
|
+
elsif value.respond_to? :to_hash
|
320
|
+
value.to_hash
|
321
|
+
else
|
322
|
+
value
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
end
|
327
|
+
|
328
|
+
end
|
@@ -0,0 +1,274 @@
|
|
1
|
+
=begin
|
2
|
+
#Svix API
|
3
|
+
|
4
|
+
#Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. For more information on authentication, please refer to the [authentication token docs](https://docs.svix.com/api-keys). <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Idempotency Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result. Please note that idempotency is only supported for `POST` requests. ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.7.0
|
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 TransformationSimulateOut
|
18
|
+
attr_accessor :method
|
19
|
+
|
20
|
+
attr_accessor :payload
|
21
|
+
|
22
|
+
attr_accessor :url
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'method' => :'method',
|
28
|
+
:'payload' => :'payload',
|
29
|
+
:'url' => :'url'
|
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
|
+
:'method' => :'TransformationHttpMethod',
|
42
|
+
:'payload' => :'String',
|
43
|
+
:'url' => :'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::TransformationSimulateOut` 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::TransformationSimulateOut`. 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?(:'method')
|
69
|
+
self.method = attributes[:'method']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'payload')
|
73
|
+
self.payload = attributes[:'payload']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'url')
|
77
|
+
self.url = attributes[:'url']
|
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 @payload.nil?
|
86
|
+
invalid_properties.push('invalid value for "payload", payload cannot be nil.')
|
87
|
+
end
|
88
|
+
|
89
|
+
if @url.nil?
|
90
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
91
|
+
end
|
92
|
+
|
93
|
+
if @url.to_s.length > 65536
|
94
|
+
invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 65536.')
|
95
|
+
end
|
96
|
+
|
97
|
+
if @url.to_s.length < 1
|
98
|
+
invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
|
99
|
+
end
|
100
|
+
|
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
|
+
return false if @payload.nil?
|
108
|
+
return false if @url.nil?
|
109
|
+
return false if @url.to_s.length > 65536
|
110
|
+
return false if @url.to_s.length < 1
|
111
|
+
true
|
112
|
+
end
|
113
|
+
|
114
|
+
# Custom attribute writer method with validation
|
115
|
+
# @param [Object] url Value to be assigned
|
116
|
+
def url=(url)
|
117
|
+
if url.nil?
|
118
|
+
fail ArgumentError, 'url cannot be nil'
|
119
|
+
end
|
120
|
+
|
121
|
+
if url.to_s.length > 65536
|
122
|
+
fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 65536.'
|
123
|
+
end
|
124
|
+
|
125
|
+
if url.to_s.length < 1
|
126
|
+
fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
|
127
|
+
end
|
128
|
+
|
129
|
+
@url = url
|
130
|
+
end
|
131
|
+
|
132
|
+
# Checks equality by comparing each attribute.
|
133
|
+
# @param [Object] Object to be compared
|
134
|
+
def ==(o)
|
135
|
+
return true if self.equal?(o)
|
136
|
+
self.class == o.class &&
|
137
|
+
method == o.method &&
|
138
|
+
payload == o.payload &&
|
139
|
+
url == o.url
|
140
|
+
end
|
141
|
+
|
142
|
+
# @see the `==` method
|
143
|
+
# @param [Object] Object to be compared
|
144
|
+
def eql?(o)
|
145
|
+
self == o
|
146
|
+
end
|
147
|
+
|
148
|
+
# Calculates hash code according to all attributes.
|
149
|
+
# @return [Integer] Hash code
|
150
|
+
def hash
|
151
|
+
[method, payload, url].hash
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def self.build_from_hash(attributes)
|
158
|
+
new.build_from_hash(attributes)
|
159
|
+
end
|
160
|
+
|
161
|
+
# Builds the object from hash
|
162
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
163
|
+
# @return [Object] Returns the model itself
|
164
|
+
def build_from_hash(attributes)
|
165
|
+
return nil unless attributes.is_a?(Hash)
|
166
|
+
self.class.openapi_types.each_pair do |key, type|
|
167
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
168
|
+
self.send("#{key}=", nil)
|
169
|
+
elsif type =~ /\AArray<(.*)>/i
|
170
|
+
# check to ensure the input is an array given that the attribute
|
171
|
+
# is documented as an array but the input is not
|
172
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
173
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
174
|
+
end
|
175
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
176
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
self
|
181
|
+
end
|
182
|
+
|
183
|
+
# Deserializes the data based on type
|
184
|
+
# @param string type Data type
|
185
|
+
# @param string value Value to be deserialized
|
186
|
+
# @return [Object] Deserialized data
|
187
|
+
def _deserialize(type, value)
|
188
|
+
case type.to_sym
|
189
|
+
when :Time
|
190
|
+
Time.parse(value)
|
191
|
+
when :Date
|
192
|
+
Date.parse(value)
|
193
|
+
when :String
|
194
|
+
value.to_s
|
195
|
+
when :Integer
|
196
|
+
value.to_i
|
197
|
+
when :Float
|
198
|
+
value.to_f
|
199
|
+
when :Boolean
|
200
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
201
|
+
true
|
202
|
+
else
|
203
|
+
false
|
204
|
+
end
|
205
|
+
when :Object
|
206
|
+
# generic object (usually a Hash), return directly
|
207
|
+
value
|
208
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
209
|
+
inner_type = Regexp.last_match[:inner_type]
|
210
|
+
value.map { |v| _deserialize(inner_type, v) }
|
211
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
212
|
+
k_type = Regexp.last_match[:k_type]
|
213
|
+
v_type = Regexp.last_match[:v_type]
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each do |k, v|
|
216
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
else # model
|
220
|
+
# models (e.g. Pet) or oneOf
|
221
|
+
klass = Svix.const_get(type)
|
222
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the string representation of the object
|
227
|
+
# @return [String] String presentation of the object
|
228
|
+
def to_s
|
229
|
+
to_hash.to_s
|
230
|
+
end
|
231
|
+
|
232
|
+
# to_body is an alias to to_hash (backward compatibility)
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_body
|
235
|
+
to_hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the object in the form of hash
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
240
|
+
def to_hash
|
241
|
+
hash = {}
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
243
|
+
value = self.send(attr)
|
244
|
+
if value.nil?
|
245
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
246
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
247
|
+
end
|
248
|
+
|
249
|
+
hash[param] = _to_hash(value)
|
250
|
+
end
|
251
|
+
hash
|
252
|
+
end
|
253
|
+
|
254
|
+
# Outputs non-array value in the form of hash
|
255
|
+
# For object, use to_hash. Otherwise, just return the value
|
256
|
+
# @param [Object] value Any valid value
|
257
|
+
# @return [Hash] Returns the value in the form of hash
|
258
|
+
def _to_hash(value)
|
259
|
+
if value.is_a?(Array)
|
260
|
+
value.compact.map { |v| _to_hash(v) }
|
261
|
+
elsif value.is_a?(Hash)
|
262
|
+
{}.tap do |hash|
|
263
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
264
|
+
end
|
265
|
+
elsif value.respond_to? :to_hash
|
266
|
+
value.to_hash
|
267
|
+
else
|
268
|
+
value
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
data/lib/svix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Svix
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -215,6 +215,8 @@ files:
|
|
215
215
|
- lib/svix/models/template_patch.rb
|
216
216
|
- lib/svix/models/template_update.rb
|
217
217
|
- lib/svix/models/transformation_http_method.rb
|
218
|
+
- lib/svix/models/transformation_simulate_in.rb
|
219
|
+
- lib/svix/models/transformation_simulate_out.rb
|
218
220
|
- lib/svix/models/transformation_template_kind.rb
|
219
221
|
- lib/svix/models/validation_error.rb
|
220
222
|
- lib/svix/svix.rb
|