svix 0.41.0 → 0.43.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/svix/api/application_api.rb +5 -1
  4. data/lib/svix/api/authentication_api.rb +1 -1
  5. data/lib/svix/api/endpoint_api.rb +22 -18
  6. data/lib/svix/api/event_type_api.rb +5 -1
  7. data/lib/svix/api/health_api.rb +1 -1
  8. data/lib/svix/api/message_api.rb +10 -16
  9. data/lib/svix/api/message_attempt_api.rb +15 -64
  10. data/lib/svix/api/organization_api.rb +152 -0
  11. data/lib/svix/api/organization_settings_api.rb +1 -1
  12. data/lib/svix/api/statistics_api.rb +1 -1
  13. data/lib/svix/api_client.rb +1 -1
  14. data/lib/svix/api_error.rb +1 -1
  15. data/lib/svix/configuration.rb +1 -1
  16. data/lib/svix/endpoint_api.rb +1 -1
  17. data/lib/svix/models/application_in.rb +1 -1
  18. data/lib/svix/models/application_out.rb +1 -1
  19. data/lib/svix/models/attempt_statistics_data.rb +1 -1
  20. data/lib/svix/models/attempt_statistics_response.rb +1 -1
  21. data/lib/svix/models/border_radius_config.rb +1 -1
  22. data/lib/svix/models/border_radius_enum.rb +1 -1
  23. data/lib/svix/models/custom_theme_override.rb +1 -1
  24. data/lib/svix/models/dashboard_access_out.rb +1 -1
  25. data/lib/svix/models/endpoint_created_event.rb +1 -1
  26. data/lib/svix/models/endpoint_created_event_data.rb +1 -1
  27. data/lib/svix/models/endpoint_deleted_event.rb +1 -1
  28. data/lib/svix/models/endpoint_deleted_event_data.rb +1 -1
  29. data/lib/svix/models/endpoint_disabled_event.rb +1 -1
  30. data/lib/svix/models/endpoint_disabled_event_data.rb +1 -1
  31. data/lib/svix/models/endpoint_headers_in.rb +1 -1
  32. data/lib/svix/models/endpoint_headers_out.rb +1 -1
  33. data/lib/svix/models/endpoint_in.rb +38 -2
  34. data/lib/svix/models/endpoint_message_out.rb +38 -2
  35. data/lib/svix/models/endpoint_out.rb +38 -2
  36. data/lib/svix/models/endpoint_secret_out.rb +1 -1
  37. data/lib/svix/models/endpoint_secret_rotate_in.rb +1 -1
  38. data/lib/svix/models/endpoint_stats.rb +1 -1
  39. data/lib/svix/models/endpoint_update.rb +38 -2
  40. data/lib/svix/models/endpoint_updated_event.rb +1 -1
  41. data/lib/svix/models/endpoint_updated_event_data.rb +1 -1
  42. data/lib/svix/models/event_example_in.rb +1 -1
  43. data/lib/svix/models/event_type_example_out.rb +1 -1
  44. data/lib/svix/models/event_type_in.rb +1 -1
  45. data/lib/svix/models/event_type_out.rb +1 -1
  46. data/lib/svix/models/event_type_schema_in.rb +1 -1
  47. data/lib/svix/models/event_type_update.rb +1 -1
  48. data/lib/svix/models/export_organization_out.rb +259 -0
  49. data/lib/svix/models/font_size_config.rb +1 -1
  50. data/lib/svix/models/http_error_out.rb +1 -1
  51. data/lib/svix/models/http_validation_error.rb +1 -1
  52. data/lib/svix/models/import_organization_in.rb +257 -0
  53. data/lib/svix/models/list_response_application_out.rb +1 -1
  54. data/lib/svix/models/list_response_endpoint_message_out.rb +1 -1
  55. data/lib/svix/models/list_response_endpoint_out.rb +1 -1
  56. data/lib/svix/models/list_response_event_type_out.rb +1 -1
  57. data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +1 -1
  58. data/lib/svix/models/list_response_message_attempt_out.rb +1 -1
  59. data/lib/svix/models/list_response_message_endpoint_out.rb +1 -1
  60. data/lib/svix/models/list_response_message_out.rb +1 -1
  61. data/lib/svix/models/message_attempt_endpoint_out.rb +1 -1
  62. data/lib/svix/models/message_attempt_exhausted_event.rb +1 -1
  63. data/lib/svix/models/message_attempt_exhausted_event_data.rb +1 -1
  64. data/lib/svix/models/message_attempt_failed_event.rb +1 -1
  65. data/lib/svix/models/message_attempt_out.rb +1 -1
  66. data/lib/svix/models/message_attempt_trigger_type.rb +1 -1
  67. data/lib/svix/models/message_endpoint_out.rb +38 -2
  68. data/lib/svix/models/message_in.rb +38 -2
  69. data/lib/svix/models/message_out.rb +38 -2
  70. data/lib/svix/models/message_status.rb +1 -1
  71. data/lib/svix/models/portal_settings_out.rb +16 -5
  72. data/lib/svix/models/recover_in.rb +1 -1
  73. data/lib/svix/models/settings_in.rb +328 -0
  74. data/lib/svix/models/settings_out.rb +328 -0
  75. data/lib/svix/models/statistics_period.rb +1 -1
  76. data/lib/svix/models/validation_error.rb +1 -1
  77. data/lib/svix/models/webhook_types.rb +1 -1
  78. data/lib/svix/version.rb +1 -1
  79. data/lib/svix.rb +1 -0
  80. metadata +11 -6
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Svix API
3
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}`. <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/). ## 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.
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}`. <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
5
 
6
6
  The version of the OpenAPI document: 1.4
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Svix API
3
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}`. <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/). ## 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.
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}`. <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
5
 
6
6
  The version of the OpenAPI document: 1.4
7
7
 
@@ -23,13 +23,16 @@ module Svix
23
23
 
24
24
  attr_accessor :custom_theme_override
25
25
 
26
+ attr_accessor :enable_channels
27
+
26
28
  # Attribute mapping from ruby-style variable name to JSON key.
27
29
  def self.attribute_map
28
30
  {
29
31
  :'custom_color' => :'customColor',
30
32
  :'custom_font_family' => :'customFontFamily',
31
33
  :'custom_logo_url' => :'customLogoUrl',
32
- :'custom_theme_override' => :'customThemeOverride'
34
+ :'custom_theme_override' => :'customThemeOverride',
35
+ :'enable_channels' => :'enableChannels'
33
36
  }
34
37
  end
35
38
 
@@ -44,7 +47,8 @@ module Svix
44
47
  :'custom_color' => :'String',
45
48
  :'custom_font_family' => :'String',
46
49
  :'custom_logo_url' => :'String',
47
- :'custom_theme_override' => :'CustomThemeOverride'
50
+ :'custom_theme_override' => :'CustomThemeOverride',
51
+ :'enable_channels' => :'Boolean'
48
52
  }
49
53
  end
50
54
 
@@ -84,6 +88,12 @@ module Svix
84
88
  if attributes.key?(:'custom_theme_override')
85
89
  self.custom_theme_override = attributes[:'custom_theme_override']
86
90
  end
91
+
92
+ if attributes.key?(:'enable_channels')
93
+ self.enable_channels = attributes[:'enable_channels']
94
+ else
95
+ self.enable_channels = false
96
+ end
87
97
  end
88
98
 
89
99
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -148,7 +158,8 @@ module Svix
148
158
  custom_color == o.custom_color &&
149
159
  custom_font_family == o.custom_font_family &&
150
160
  custom_logo_url == o.custom_logo_url &&
151
- custom_theme_override == o.custom_theme_override
161
+ custom_theme_override == o.custom_theme_override &&
162
+ enable_channels == o.enable_channels
152
163
  end
153
164
 
154
165
  # @see the `==` method
@@ -160,7 +171,7 @@ module Svix
160
171
  # Calculates hash code according to all attributes.
161
172
  # @return [Integer] Hash code
162
173
  def hash
163
- [custom_color, custom_font_family, custom_logo_url, custom_theme_override].hash
174
+ [custom_color, custom_font_family, custom_logo_url, custom_theme_override, enable_channels].hash
164
175
  end
165
176
 
166
177
  # Builds the object from hash
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #Svix API
3
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}`. <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/). ## 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.
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}`. <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
5
 
6
6
  The version of the OpenAPI document: 1.4
7
7
 
@@ -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}`. <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.4
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 SettingsIn
18
+ attr_accessor :custom_base_font_size
19
+
20
+ attr_accessor :custom_color
21
+
22
+ attr_accessor :custom_font_family
23
+
24
+ attr_accessor :custom_logo_url
25
+
26
+ attr_accessor :custom_theme_override
27
+
28
+ attr_accessor :disable_endpoint_on_failure
29
+
30
+ attr_accessor :enable_channels
31
+
32
+ attr_accessor :enforce_https
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'custom_base_font_size' => :'customBaseFontSize',
38
+ :'custom_color' => :'customColor',
39
+ :'custom_font_family' => :'customFontFamily',
40
+ :'custom_logo_url' => :'customLogoUrl',
41
+ :'custom_theme_override' => :'customThemeOverride',
42
+ :'disable_endpoint_on_failure' => :'disableEndpointOnFailure',
43
+ :'enable_channels' => :'enableChannels',
44
+ :'enforce_https' => :'enforceHttps'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'custom_base_font_size' => :'Integer',
57
+ :'custom_color' => :'String',
58
+ :'custom_font_family' => :'String',
59
+ :'custom_logo_url' => :'String',
60
+ :'custom_theme_override' => :'CustomThemeOverride',
61
+ :'disable_endpoint_on_failure' => :'Boolean',
62
+ :'enable_channels' => :'Boolean',
63
+ :'enforce_https' => :'Boolean'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::SettingsIn` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::SettingsIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'custom_base_font_size')
89
+ self.custom_base_font_size = attributes[:'custom_base_font_size']
90
+ end
91
+
92
+ if attributes.key?(:'custom_color')
93
+ self.custom_color = attributes[:'custom_color']
94
+ end
95
+
96
+ if attributes.key?(:'custom_font_family')
97
+ self.custom_font_family = attributes[:'custom_font_family']
98
+ end
99
+
100
+ if attributes.key?(:'custom_logo_url')
101
+ self.custom_logo_url = attributes[:'custom_logo_url']
102
+ end
103
+
104
+ if attributes.key?(:'custom_theme_override')
105
+ self.custom_theme_override = attributes[:'custom_theme_override']
106
+ end
107
+
108
+ if attributes.key?(:'disable_endpoint_on_failure')
109
+ self.disable_endpoint_on_failure = attributes[:'disable_endpoint_on_failure']
110
+ else
111
+ self.disable_endpoint_on_failure = true
112
+ end
113
+
114
+ if attributes.key?(:'enable_channels')
115
+ self.enable_channels = attributes[:'enable_channels']
116
+ else
117
+ self.enable_channels = false
118
+ end
119
+
120
+ if attributes.key?(:'enforce_https')
121
+ self.enforce_https = attributes[:'enforce_https']
122
+ else
123
+ self.enforce_https = true
124
+ end
125
+ end
126
+
127
+ # Show invalid properties with the reasons. Usually used together with valid?
128
+ # @return Array for valid properties with the reasons
129
+ def list_invalid_properties
130
+ invalid_properties = Array.new
131
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
132
+ if !@custom_font_family.nil? && @custom_font_family !~ pattern
133
+ invalid_properties.push("invalid value for \"custom_font_family\", must conform to the pattern #{pattern}.")
134
+ end
135
+
136
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
137
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.')
138
+ end
139
+
140
+ if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
141
+ invalid_properties.push('invalid value for "custom_logo_url", the character length must be great than or equal to 1.')
142
+ end
143
+
144
+ invalid_properties
145
+ end
146
+
147
+ # Check to see if the all the properties in the model are valid
148
+ # @return true if the model is valid
149
+ def valid?
150
+ return false if !@custom_font_family.nil? && @custom_font_family !~ Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
151
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
152
+ return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
153
+ true
154
+ end
155
+
156
+ # Custom attribute writer method with validation
157
+ # @param [Object] custom_font_family Value to be assigned
158
+ def custom_font_family=(custom_font_family)
159
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
160
+ if !custom_font_family.nil? && custom_font_family !~ pattern
161
+ fail ArgumentError, "invalid value for \"custom_font_family\", must conform to the pattern #{pattern}."
162
+ end
163
+
164
+ @custom_font_family = custom_font_family
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] custom_logo_url Value to be assigned
169
+ def custom_logo_url=(custom_logo_url)
170
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length > 65536
171
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.'
172
+ end
173
+
174
+ if !custom_logo_url.nil? && custom_logo_url.to_s.length < 1
175
+ fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be great than or equal to 1.'
176
+ end
177
+
178
+ @custom_logo_url = custom_logo_url
179
+ end
180
+
181
+ # Checks equality by comparing each attribute.
182
+ # @param [Object] Object to be compared
183
+ def ==(o)
184
+ return true if self.equal?(o)
185
+ self.class == o.class &&
186
+ custom_base_font_size == o.custom_base_font_size &&
187
+ custom_color == o.custom_color &&
188
+ custom_font_family == o.custom_font_family &&
189
+ custom_logo_url == o.custom_logo_url &&
190
+ custom_theme_override == o.custom_theme_override &&
191
+ disable_endpoint_on_failure == o.disable_endpoint_on_failure &&
192
+ enable_channels == o.enable_channels &&
193
+ enforce_https == o.enforce_https
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
+ [custom_base_font_size, custom_color, custom_font_family, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, enable_channels, enforce_https].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