svix 1.42.0 → 1.43.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/environment_api.rb +0 -57
- data/lib/svix/api/message_attempt_api.rb +134 -0
- data/lib/svix/message_api.rb +29 -0
- data/lib/svix/models/count_out.rb +258 -0
- data/lib/svix/models/environment_in.rb +12 -39
- data/lib/svix/models/environment_out.rb +7 -2
- data/lib/svix/version.rb +1 -1
- metadata +3 -4
- data/lib/svix/models/settings_in.rb +0 -465
- data/lib/svix/models/settings_out.rb +0 -465
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a38b5b98867839d9beb5f2177f6fdaac0267b16b071d8cab956db186d2a5434
|
4
|
+
data.tar.gz: 18f162bb497c69a45e7e29a476182e17e48e7149edde80bb431ad1e682807872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d185df715b172437530d93a8d7c9963e139a43757267309daaed932d3dfd3737d585702f9b4e705000af58f24280f7071ae3fce65b5041ca8bb136352bbd997e
|
7
|
+
data.tar.gz: 9d70cf3e7458a51a370ac4d9ae306a2cb232f44dbcd00f1e496d9fb44700111eaea3ce556bfdb74b8bfe7ea6b7c44da2749b94acc62fcb6ba6db58781b0ef766
|
data/Gemfile.lock
CHANGED
@@ -79,63 +79,6 @@ module Svix
|
|
79
79
|
return data, status_code, headers
|
80
80
|
end
|
81
81
|
|
82
|
-
# Export Environment Configuration
|
83
|
-
# Download a JSON file containing all org-settings and event types
|
84
|
-
# @param [Hash] opts the optional parameters
|
85
|
-
# @return [EnvironmentOut]
|
86
|
-
def v1_environment_export_get(opts = {})
|
87
|
-
data, _status_code, _headers = v1_environment_export_get_with_http_info(opts)
|
88
|
-
data
|
89
|
-
end
|
90
|
-
|
91
|
-
# Export Environment Configuration
|
92
|
-
# Download a JSON file containing all org-settings and event types
|
93
|
-
# @param [Hash] opts the optional parameters
|
94
|
-
# @return [Array<(EnvironmentOut, Integer, Hash)>] EnvironmentOut data, response status code and response headers
|
95
|
-
def v1_environment_export_get_with_http_info(opts = {})
|
96
|
-
if @api_client.config.debugging
|
97
|
-
@api_client.config.logger.debug 'Calling API: EnvironmentApi.v1_environment_export_get ...'
|
98
|
-
end
|
99
|
-
# resource path
|
100
|
-
local_var_path = '/api/v1/environment/export'
|
101
|
-
|
102
|
-
# query parameters
|
103
|
-
query_params = opts[:query_params] || {}
|
104
|
-
|
105
|
-
# header parameters
|
106
|
-
header_params = opts[:header_params] || {}
|
107
|
-
# HTTP header 'Accept' (if needed)
|
108
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
109
|
-
|
110
|
-
# form parameters
|
111
|
-
form_params = opts[:form_params] || {}
|
112
|
-
|
113
|
-
# http body (model)
|
114
|
-
post_body = opts[:debug_body]
|
115
|
-
|
116
|
-
# return_type
|
117
|
-
return_type = opts[:debug_return_type] || 'EnvironmentOut'
|
118
|
-
|
119
|
-
# auth_names
|
120
|
-
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
121
|
-
|
122
|
-
new_options = opts.merge(
|
123
|
-
:operation => :"EnvironmentApi.v1_environment_export_get",
|
124
|
-
:header_params => header_params,
|
125
|
-
:query_params => query_params,
|
126
|
-
:form_params => form_params,
|
127
|
-
:body => post_body,
|
128
|
-
:auth_names => auth_names,
|
129
|
-
:return_type => return_type
|
130
|
-
)
|
131
|
-
|
132
|
-
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
133
|
-
if @api_client.config.debugging
|
134
|
-
@api_client.config.logger.debug "API called: EnvironmentApi#v1_environment_export_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
135
|
-
end
|
136
|
-
return data, status_code, headers
|
137
|
-
end
|
138
|
-
|
139
82
|
# Import Environment Configuration
|
140
83
|
# Import a configuration into the active organization. It doesn't delete anything, only adds/updates what was passed to it.
|
141
84
|
# @param environment_in [EnvironmentIn]
|
@@ -19,6 +19,140 @@ module Svix
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# Count Attempts By Endpoint
|
23
|
+
# Like `v1.message-attempt.list-by-endpoint` but returning a count only.
|
24
|
+
# @param app_id [String] The app's ID or UID
|
25
|
+
# @param endpoint_id [String] The ep's ID or UID
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @option opts [MessageStatus] :status Filter response based on the status of the attempt: Success (0), Pending (1), Failed (2), or Sending (3)
|
28
|
+
# @option opts [StatusCodeClass] :status_code_class Filter response based on the HTTP status code
|
29
|
+
# @option opts [String] :channel Filter response based on the channel
|
30
|
+
# @option opts [String] :tag Filter response based on the tag
|
31
|
+
# @option opts [Time] :before Only include items created before a certain date
|
32
|
+
# @option opts [Time] :after Only include items created after a certain date
|
33
|
+
# @option opts [Array<String>] :event_types Filter response based on the event type
|
34
|
+
# @return [CountOut]
|
35
|
+
def v1_message_attempt_count_by_endpoint(app_id, endpoint_id, opts = {})
|
36
|
+
data, _status_code, _headers = v1_message_attempt_count_by_endpoint_with_http_info(app_id, endpoint_id, opts)
|
37
|
+
data
|
38
|
+
end
|
39
|
+
|
40
|
+
# Count Attempts By Endpoint
|
41
|
+
# Like `v1.message-attempt.list-by-endpoint` but returning a count only.
|
42
|
+
# @param app_id [String] The app's ID or UID
|
43
|
+
# @param endpoint_id [String] The ep's ID or UID
|
44
|
+
# @param [Hash] opts the optional parameters
|
45
|
+
# @option opts [MessageStatus] :status Filter response based on the status of the attempt: Success (0), Pending (1), Failed (2), or Sending (3)
|
46
|
+
# @option opts [StatusCodeClass] :status_code_class Filter response based on the HTTP status code
|
47
|
+
# @option opts [String] :channel Filter response based on the channel
|
48
|
+
# @option opts [String] :tag Filter response based on the tag
|
49
|
+
# @option opts [Time] :before Only include items created before a certain date
|
50
|
+
# @option opts [Time] :after Only include items created after a certain date
|
51
|
+
# @option opts [Array<String>] :event_types Filter response based on the event type
|
52
|
+
# @return [Array<(CountOut, Integer, Hash)>] CountOut data, response status code and response headers
|
53
|
+
def v1_message_attempt_count_by_endpoint_with_http_info(app_id, endpoint_id, opts = {})
|
54
|
+
if @api_client.config.debugging
|
55
|
+
@api_client.config.logger.debug 'Calling API: MessageAttemptApi.v1_message_attempt_count_by_endpoint ...'
|
56
|
+
end
|
57
|
+
# verify the required parameter 'app_id' is set
|
58
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
59
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint"
|
60
|
+
end
|
61
|
+
if @api_client.config.client_side_validation && app_id.to_s.length > 256
|
62
|
+
fail ArgumentError, 'invalid value for "app_id" when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, the character length must be smaller than or equal to 256.'
|
63
|
+
end
|
64
|
+
|
65
|
+
if @api_client.config.client_side_validation && app_id.to_s.length < 1
|
66
|
+
fail ArgumentError, 'invalid value for "app_id" when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, the character length must be great than or equal to 1.'
|
67
|
+
end
|
68
|
+
|
69
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
70
|
+
if @api_client.config.client_side_validation && app_id !~ pattern
|
71
|
+
fail ArgumentError, "invalid value for 'app_id' when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, must conform to the pattern #{pattern}."
|
72
|
+
end
|
73
|
+
|
74
|
+
# verify the required parameter 'endpoint_id' is set
|
75
|
+
if @api_client.config.client_side_validation && endpoint_id.nil?
|
76
|
+
fail ArgumentError, "Missing the required parameter 'endpoint_id' when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint"
|
77
|
+
end
|
78
|
+
if @api_client.config.client_side_validation && endpoint_id.to_s.length > 256
|
79
|
+
fail ArgumentError, 'invalid value for "endpoint_id" when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, the character length must be smaller than or equal to 256.'
|
80
|
+
end
|
81
|
+
|
82
|
+
if @api_client.config.client_side_validation && endpoint_id.to_s.length < 1
|
83
|
+
fail ArgumentError, 'invalid value for "endpoint_id" when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, the character length must be great than or equal to 1.'
|
84
|
+
end
|
85
|
+
|
86
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
87
|
+
if @api_client.config.client_side_validation && endpoint_id !~ pattern
|
88
|
+
fail ArgumentError, "invalid value for 'endpoint_id' when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, must conform to the pattern #{pattern}."
|
89
|
+
end
|
90
|
+
|
91
|
+
if @api_client.config.client_side_validation && !opts[:'channel'].nil? && opts[:'channel'].to_s.length > 128
|
92
|
+
fail ArgumentError, 'invalid value for "opts[:"channel"]" when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, the character length must be smaller than or equal to 128.'
|
93
|
+
end
|
94
|
+
|
95
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.:]+$/)
|
96
|
+
if @api_client.config.client_side_validation && !opts[:'channel'].nil? && opts[:'channel'] !~ pattern
|
97
|
+
fail ArgumentError, "invalid value for 'opts[:\"channel\"]' when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, must conform to the pattern #{pattern}."
|
98
|
+
end
|
99
|
+
|
100
|
+
if @api_client.config.client_side_validation && !opts[:'tag'].nil? && opts[:'tag'].to_s.length > 128
|
101
|
+
fail ArgumentError, 'invalid value for "opts[:"tag"]" when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, the character length must be smaller than or equal to 128.'
|
102
|
+
end
|
103
|
+
|
104
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
105
|
+
if @api_client.config.client_side_validation && !opts[:'tag'].nil? && opts[:'tag'] !~ pattern
|
106
|
+
fail ArgumentError, "invalid value for 'opts[:\"tag\"]' when calling MessageAttemptApi.v1_message_attempt_count_by_endpoint, must conform to the pattern #{pattern}."
|
107
|
+
end
|
108
|
+
|
109
|
+
# resource path
|
110
|
+
local_var_path = '/api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}/count'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'endpoint_id' + '}', CGI.escape(endpoint_id.to_s))
|
111
|
+
|
112
|
+
# query parameters
|
113
|
+
query_params = opts[:query_params] || {}
|
114
|
+
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
115
|
+
query_params[:'status_code_class'] = opts[:'status_code_class'] if !opts[:'status_code_class'].nil?
|
116
|
+
query_params[:'channel'] = opts[:'channel'] if !opts[:'channel'].nil?
|
117
|
+
query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
|
118
|
+
query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
|
119
|
+
query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
|
120
|
+
query_params[:'event_types'] = @api_client.build_collection_param(opts[:'event_types'], :multi) if !opts[:'event_types'].nil?
|
121
|
+
|
122
|
+
# header parameters
|
123
|
+
header_params = opts[:header_params] || {}
|
124
|
+
# HTTP header 'Accept' (if needed)
|
125
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
126
|
+
|
127
|
+
# form parameters
|
128
|
+
form_params = opts[:form_params] || {}
|
129
|
+
|
130
|
+
# http body (model)
|
131
|
+
post_body = opts[:debug_body]
|
132
|
+
|
133
|
+
# return_type
|
134
|
+
return_type = opts[:debug_return_type] || 'CountOut'
|
135
|
+
|
136
|
+
# auth_names
|
137
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
138
|
+
|
139
|
+
new_options = opts.merge(
|
140
|
+
:operation => :"MessageAttemptApi.v1_message_attempt_count_by_endpoint",
|
141
|
+
:header_params => header_params,
|
142
|
+
:query_params => query_params,
|
143
|
+
:form_params => form_params,
|
144
|
+
:body => post_body,
|
145
|
+
:auth_names => auth_names,
|
146
|
+
:return_type => return_type
|
147
|
+
)
|
148
|
+
|
149
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
150
|
+
if @api_client.config.debugging
|
151
|
+
@api_client.config.logger.debug "API called: MessageAttemptApi#v1_message_attempt_count_by_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
152
|
+
end
|
153
|
+
return data, status_code, headers
|
154
|
+
end
|
155
|
+
|
22
156
|
# Delete attempt response body
|
23
157
|
# Deletes the given attempt's response body. Useful when an endpoint accidentally returned sensitive content.
|
24
158
|
# @param app_id [String] The app's ID or UID
|
data/lib/svix/message_api.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Svix
|
4
|
+
module_function
|
5
|
+
|
4
6
|
class MessageAPI
|
5
7
|
def initialize(api_client)
|
6
8
|
@api = MessageApi.new(api_client)
|
@@ -22,4 +24,31 @@ module Svix
|
|
22
24
|
return @api.v1_message_expunge_content(app_id, msg_id)
|
23
25
|
end
|
24
26
|
end
|
27
|
+
|
28
|
+
# Creates a [`MessageIn`] with a pre-serialized payload.
|
29
|
+
#
|
30
|
+
# The payload is not normalized on the server. Normally, payloads are required
|
31
|
+
# to be JSON, and Svix will minify the payload before sending the webhook
|
32
|
+
# (for example, by removing extraneous whitespace or unnecessarily escaped
|
33
|
+
# characters in strings). With this function, the payload will be sent
|
34
|
+
# "as is", without any minification or other processing.
|
35
|
+
#
|
36
|
+
# `attributes[:payload]` must be a string. An extra attribute `content_type`
|
37
|
+
# is accepted that sets the `content-type` header of the webhook sent by Svix,
|
38
|
+
# overwriting the default of `application/json` if specified. Other than that,
|
39
|
+
# the attributes are forwarded [`MessageIn.new`], so all the same ones are
|
40
|
+
# accepted.
|
41
|
+
def message_in_raw(attributes = {})
|
42
|
+
attributes[:transformations_params] ||= {}
|
43
|
+
attributes[:transformations_params][:rawPayload] = attributes[:payload]
|
44
|
+
attributes[:payload] = {}
|
45
|
+
|
46
|
+
content_type = attributes.delete(:content_type)
|
47
|
+
if content_type != nil
|
48
|
+
attributes[:transformations_params][:headers] ||= {}
|
49
|
+
attributes[:transformations_params][:headers][:'content-type'] = content_type
|
50
|
+
end
|
51
|
+
|
52
|
+
return MessageIn.new(attributes)
|
53
|
+
end
|
25
54
|
end
|
@@ -0,0 +1,258 @@
|
|
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
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
class CountOut
|
18
|
+
# There's a ceiling to how many attempts we count. When the limit is reached, this will be `true` to indicate the actual count is higher than given.
|
19
|
+
attr_accessor :approximated
|
20
|
+
|
21
|
+
# The count of attempts matching the query.
|
22
|
+
attr_accessor :count
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'approximated' => :'approximated',
|
28
|
+
:'count' => :'count'
|
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
|
+
:'approximated' => :'Boolean',
|
41
|
+
:'count' => :'Integer'
|
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::CountOut` 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::CountOut`. 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?(:'approximated')
|
67
|
+
self.approximated = attributes[:'approximated']
|
68
|
+
else
|
69
|
+
self.approximated = nil
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'count')
|
73
|
+
self.count = attributes[:'count']
|
74
|
+
else
|
75
|
+
self.count = nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
83
|
+
invalid_properties = Array.new
|
84
|
+
if @approximated.nil?
|
85
|
+
invalid_properties.push('invalid value for "approximated", approximated cannot be nil.')
|
86
|
+
end
|
87
|
+
|
88
|
+
if @count.nil?
|
89
|
+
invalid_properties.push('invalid value for "count", count cannot be nil.')
|
90
|
+
end
|
91
|
+
|
92
|
+
if @count < 0
|
93
|
+
invalid_properties.push('invalid value for "count", must be greater than or equal to 0.')
|
94
|
+
end
|
95
|
+
|
96
|
+
invalid_properties
|
97
|
+
end
|
98
|
+
|
99
|
+
# Check to see if the all the properties in the model are valid
|
100
|
+
# @return true if the model is valid
|
101
|
+
def valid?
|
102
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
103
|
+
return false if @approximated.nil?
|
104
|
+
return false if @count.nil?
|
105
|
+
return false if @count < 0
|
106
|
+
true
|
107
|
+
end
|
108
|
+
|
109
|
+
# Custom attribute writer method with validation
|
110
|
+
# @param [Object] count Value to be assigned
|
111
|
+
def count=(count)
|
112
|
+
if count.nil?
|
113
|
+
fail ArgumentError, 'count cannot be nil'
|
114
|
+
end
|
115
|
+
|
116
|
+
if count < 0
|
117
|
+
fail ArgumentError, 'invalid value for "count", must be greater than or equal to 0.'
|
118
|
+
end
|
119
|
+
|
120
|
+
@count = count
|
121
|
+
end
|
122
|
+
|
123
|
+
# Checks equality by comparing each attribute.
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def ==(o)
|
126
|
+
return true if self.equal?(o)
|
127
|
+
self.class == o.class &&
|
128
|
+
approximated == o.approximated &&
|
129
|
+
count == o.count
|
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
|
+
[approximated, count].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
|
+
return nil unless attributes.is_a?(Hash)
|
149
|
+
attributes = attributes.transform_keys(&:to_sym)
|
150
|
+
transformed_hash = {}
|
151
|
+
openapi_types.each_pair do |key, type|
|
152
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
153
|
+
transformed_hash["#{key}"] = nil
|
154
|
+
elsif type =~ /\AArray<(.*)>/i
|
155
|
+
# check to ensure the input is an array given that the attribute
|
156
|
+
# is documented as an array but the input is not
|
157
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
158
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
159
|
+
end
|
160
|
+
elsif !attributes[attribute_map[key]].nil?
|
161
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
162
|
+
end
|
163
|
+
end
|
164
|
+
new(transformed_hash)
|
165
|
+
end
|
166
|
+
|
167
|
+
# Deserializes the data based on type
|
168
|
+
# @param string type Data type
|
169
|
+
# @param string value Value to be deserialized
|
170
|
+
# @return [Object] Deserialized data
|
171
|
+
def self._deserialize(type, value)
|
172
|
+
case type.to_sym
|
173
|
+
when :Time
|
174
|
+
Time.parse(value)
|
175
|
+
when :Date
|
176
|
+
Date.parse(value)
|
177
|
+
when :String
|
178
|
+
value.to_s
|
179
|
+
when :Integer
|
180
|
+
value.to_i
|
181
|
+
when :Float
|
182
|
+
value.to_f
|
183
|
+
when :Boolean
|
184
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
185
|
+
true
|
186
|
+
else
|
187
|
+
false
|
188
|
+
end
|
189
|
+
when :Object
|
190
|
+
# generic object (usually a Hash), return directly
|
191
|
+
value
|
192
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
193
|
+
inner_type = Regexp.last_match[:inner_type]
|
194
|
+
value.map { |v| _deserialize(inner_type, v) }
|
195
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
196
|
+
k_type = Regexp.last_match[:k_type]
|
197
|
+
v_type = Regexp.last_match[:v_type]
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each do |k, v|
|
200
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
else # model
|
204
|
+
# models (e.g. Pet) or oneOf
|
205
|
+
klass = Svix.const_get(type)
|
206
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns the string representation of the object
|
211
|
+
# @return [String] String presentation of the object
|
212
|
+
def to_s
|
213
|
+
to_hash.to_s
|
214
|
+
end
|
215
|
+
|
216
|
+
# to_body is an alias to to_hash (backward compatibility)
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
218
|
+
def to_body
|
219
|
+
to_hash
|
220
|
+
end
|
221
|
+
|
222
|
+
# Returns the object in the form of hash
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_hash
|
225
|
+
hash = {}
|
226
|
+
self.class.attribute_map.each_pair do |attr, param|
|
227
|
+
value = self.send(attr)
|
228
|
+
if value.nil?
|
229
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
230
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
231
|
+
end
|
232
|
+
|
233
|
+
hash[param] = _to_hash(value)
|
234
|
+
end
|
235
|
+
hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Outputs non-array value in the form of hash
|
239
|
+
# For object, use to_hash. Otherwise, just return the value
|
240
|
+
# @param [Object] value Any valid value
|
241
|
+
# @return [Hash] Returns the value in the form of hash
|
242
|
+
def _to_hash(value)
|
243
|
+
if value.is_a?(Array)
|
244
|
+
value.compact.map { |v| _to_hash(v) }
|
245
|
+
elsif value.is_a?(Hash)
|
246
|
+
{}.tap do |hash|
|
247
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
248
|
+
end
|
249
|
+
elsif value.respond_to? :to_hash
|
250
|
+
value.to_hash
|
251
|
+
else
|
252
|
+
value
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
@@ -15,24 +15,18 @@ require 'time'
|
|
15
15
|
|
16
16
|
module Svix
|
17
17
|
class EnvironmentIn
|
18
|
-
attr_accessor :created_at
|
19
|
-
|
20
18
|
attr_accessor :event_types
|
21
19
|
|
22
20
|
attr_accessor :settings
|
23
21
|
|
24
22
|
attr_accessor :transformation_templates
|
25
23
|
|
26
|
-
attr_accessor :version
|
27
|
-
|
28
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
29
25
|
def self.attribute_map
|
30
26
|
{
|
31
|
-
:'created_at' => :'createdAt',
|
32
27
|
:'event_types' => :'eventTypes',
|
33
28
|
:'settings' => :'settings',
|
34
|
-
:'transformation_templates' => :'transformationTemplates'
|
35
|
-
:'version' => :'version'
|
29
|
+
:'transformation_templates' => :'transformationTemplates'
|
36
30
|
}
|
37
31
|
end
|
38
32
|
|
@@ -44,11 +38,9 @@ module Svix
|
|
44
38
|
# Attribute type mapping.
|
45
39
|
def self.openapi_types
|
46
40
|
{
|
47
|
-
:'created_at' => :'Time',
|
48
41
|
:'event_types' => :'Array<EventTypeIn>',
|
49
|
-
:'settings' => :'
|
50
|
-
:'transformation_templates' => :'Array<TemplateIn>'
|
51
|
-
:'version' => :'Integer'
|
42
|
+
:'settings' => :'Hash<String, Object>',
|
43
|
+
:'transformation_templates' => :'Array<TemplateIn>'
|
52
44
|
}
|
53
45
|
end
|
54
46
|
|
@@ -56,7 +48,8 @@ module Svix
|
|
56
48
|
def self.openapi_nullable
|
57
49
|
Set.new([
|
58
50
|
:'event_types',
|
59
|
-
:'
|
51
|
+
:'settings',
|
52
|
+
:'transformation_templates'
|
60
53
|
])
|
61
54
|
end
|
62
55
|
|
@@ -75,12 +68,6 @@ module Svix
|
|
75
68
|
h[k.to_sym] = v
|
76
69
|
}
|
77
70
|
|
78
|
-
if attributes.key?(:'created_at')
|
79
|
-
self.created_at = attributes[:'created_at']
|
80
|
-
else
|
81
|
-
self.created_at = nil
|
82
|
-
end
|
83
|
-
|
84
71
|
if attributes.key?(:'event_types')
|
85
72
|
if (value = attributes[:'event_types']).is_a?(Array)
|
86
73
|
self.event_types = value
|
@@ -88,7 +75,11 @@ module Svix
|
|
88
75
|
end
|
89
76
|
|
90
77
|
if attributes.key?(:'settings')
|
91
|
-
|
78
|
+
if (value = attributes[:'settings']).is_a?(Hash)
|
79
|
+
self.settings = value
|
80
|
+
end
|
81
|
+
else
|
82
|
+
self.settings = nil
|
92
83
|
end
|
93
84
|
|
94
85
|
if attributes.key?(:'transformation_templates')
|
@@ -96,12 +87,6 @@ module Svix
|
|
96
87
|
self.transformation_templates = value
|
97
88
|
end
|
98
89
|
end
|
99
|
-
|
100
|
-
if attributes.key?(:'version')
|
101
|
-
self.version = attributes[:'version']
|
102
|
-
else
|
103
|
-
self.version = nil
|
104
|
-
end
|
105
90
|
end
|
106
91
|
|
107
92
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -109,14 +94,6 @@ module Svix
|
|
109
94
|
def list_invalid_properties
|
110
95
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
111
96
|
invalid_properties = Array.new
|
112
|
-
if @created_at.nil?
|
113
|
-
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
114
|
-
end
|
115
|
-
|
116
|
-
if @version.nil?
|
117
|
-
invalid_properties.push('invalid value for "version", version cannot be nil.')
|
118
|
-
end
|
119
|
-
|
120
97
|
invalid_properties
|
121
98
|
end
|
122
99
|
|
@@ -124,8 +101,6 @@ module Svix
|
|
124
101
|
# @return true if the model is valid
|
125
102
|
def valid?
|
126
103
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
127
|
-
return false if @created_at.nil?
|
128
|
-
return false if @version.nil?
|
129
104
|
true
|
130
105
|
end
|
131
106
|
|
@@ -134,11 +109,9 @@ module Svix
|
|
134
109
|
def ==(o)
|
135
110
|
return true if self.equal?(o)
|
136
111
|
self.class == o.class &&
|
137
|
-
created_at == o.created_at &&
|
138
112
|
event_types == o.event_types &&
|
139
113
|
settings == o.settings &&
|
140
|
-
transformation_templates == o.transformation_templates
|
141
|
-
version == o.version
|
114
|
+
transformation_templates == o.transformation_templates
|
142
115
|
end
|
143
116
|
|
144
117
|
# @see the `==` method
|
@@ -150,7 +123,7 @@ module Svix
|
|
150
123
|
# Calculates hash code according to all attributes.
|
151
124
|
# @return [Integer] Hash code
|
152
125
|
def hash
|
153
|
-
[
|
126
|
+
[event_types, settings, transformation_templates].hash
|
154
127
|
end
|
155
128
|
|
156
129
|
# Builds the object from hash
|
@@ -46,7 +46,7 @@ module Svix
|
|
46
46
|
{
|
47
47
|
:'created_at' => :'Time',
|
48
48
|
:'event_types' => :'Array<EventTypeOut>',
|
49
|
-
:'settings' => :'
|
49
|
+
:'settings' => :'Hash<String, Object>',
|
50
50
|
:'transformation_templates' => :'Array<TemplateOut>',
|
51
51
|
:'version' => :'Integer'
|
52
52
|
}
|
@@ -55,6 +55,7 @@ module Svix
|
|
55
55
|
# List of attributes with nullable: true
|
56
56
|
def self.openapi_nullable
|
57
57
|
Set.new([
|
58
|
+
:'settings',
|
58
59
|
])
|
59
60
|
end
|
60
61
|
|
@@ -88,7 +89,11 @@ module Svix
|
|
88
89
|
end
|
89
90
|
|
90
91
|
if attributes.key?(:'settings')
|
91
|
-
|
92
|
+
if (value = attributes[:'settings']).is_a?(Hash)
|
93
|
+
self.settings = value
|
94
|
+
end
|
95
|
+
else
|
96
|
+
self.settings = nil
|
92
97
|
end
|
93
98
|
|
94
99
|
if attributes.key?(:'transformation_templates')
|