Class: Svix::InboundApi
- Inherits:
-
Object
- Object
- Svix::InboundApi
- Defined in:
- lib/svix/api/inbound_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ InboundApi
constructor
A new instance of InboundApi.
-
#v1_inbound_msg(app_id, inbound_token, body, opts = {}) ⇒ MessageOut
Handle Inbound Handles a raw inbound webhook for the application.
-
#v1_inbound_msg_with_http_info(app_id, inbound_token, body, opts = {}) ⇒ Array<(MessageOut, Integer, Hash)>
Handle Inbound Handles a raw inbound webhook for the application.
-
#v1_inbound_rotate_url(app_id, opts = {}) ⇒ RotatedUrlOut
Rotate Url Invalidates the previous inbound url (if one exists), producing a new inbound URL for this app.
-
#v1_inbound_rotate_url_with_http_info(app_id, opts = {}) ⇒ Array<(RotatedUrlOut, Integer, Hash)>
Rotate Url Invalidates the previous inbound url (if one exists), producing a new inbound URL for this app.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ InboundApi
Returns a new instance of InboundApi.
19 20 21 |
# File 'lib/svix/api/inbound_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/svix/api/inbound_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#v1_inbound_msg(app_id, inbound_token, body, opts = {}) ⇒ MessageOut
Handle Inbound Handles a raw inbound webhook for the application.
31 32 33 34 |
# File 'lib/svix/api/inbound_api.rb', line 31 def v1_inbound_msg(app_id, inbound_token, body, opts = {}) data, _status_code, _headers = v1_inbound_msg_with_http_info(app_id, inbound_token, body, opts) data end |
#v1_inbound_msg_with_http_info(app_id, inbound_token, body, opts = {}) ⇒ Array<(MessageOut, Integer, Hash)>
Handle Inbound Handles a raw inbound webhook for the application.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/svix/api/inbound_api.rb', line 45 def v1_inbound_msg_with_http_info(app_id, inbound_token, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboundApi.v1_inbound_msg ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling InboundApi.v1_inbound_msg" end if @api_client.config.client_side_validation && app_id.to_s.length > 256 fail ArgumentError, 'invalid value for "app_id" when calling InboundApi.v1_inbound_msg, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && app_id.to_s.length < 1 fail ArgumentError, 'invalid value for "app_id" when calling InboundApi.v1_inbound_msg, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && app_id !~ pattern fail ArgumentError, "invalid value for 'app_id' when calling InboundApi.v1_inbound_msg, must conform to the pattern #{pattern}." end # verify the required parameter 'inbound_token' is set if @api_client.config.client_side_validation && inbound_token.nil? fail ArgumentError, "Missing the required parameter 'inbound_token' when calling InboundApi.v1_inbound_msg" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling InboundApi.v1_inbound_msg" end if @api_client.config.client_side_validation && !opts[:'event_type'].nil? && opts[:'event_type'].to_s.length > 256 fail ArgumentError, 'invalid value for "opts[:"event_type"]" when calling InboundApi.v1_inbound_msg, the character length must be smaller than or equal to 256.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && !opts[:'event_type'].nil? && opts[:'event_type'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"event_type\"]' when calling InboundApi.v1_inbound_msg, must conform to the pattern #{pattern}." end # resource path local_var_path = '/api/v1/app/{app_id}/inbound/msg/{inbound_token}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'inbound_token' + '}', CGI.escape(inbound_token.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'event_type'] = opts[:'event_type'] if !opts[:'event_type'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'MessageOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InboundApi.v1_inbound_msg", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboundApi#v1_inbound_msg\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#v1_inbound_rotate_url(app_id, opts = {}) ⇒ RotatedUrlOut
Rotate Url Invalidates the previous inbound url (if one exists), producing a new inbound URL for this app
136 137 138 139 |
# File 'lib/svix/api/inbound_api.rb', line 136 def v1_inbound_rotate_url(app_id, opts = {}) data, _status_code, _headers = v1_inbound_rotate_url_with_http_info(app_id, opts) data end |
#v1_inbound_rotate_url_with_http_info(app_id, opts = {}) ⇒ Array<(RotatedUrlOut, Integer, Hash)>
Rotate Url Invalidates the previous inbound url (if one exists), producing a new inbound URL for this app
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/svix/api/inbound_api.rb', line 147 def v1_inbound_rotate_url_with_http_info(app_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboundApi.v1_inbound_rotate_url ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling InboundApi.v1_inbound_rotate_url" end if @api_client.config.client_side_validation && app_id.to_s.length > 256 fail ArgumentError, 'invalid value for "app_id" when calling InboundApi.v1_inbound_rotate_url, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && app_id.to_s.length < 1 fail ArgumentError, 'invalid value for "app_id" when calling InboundApi.v1_inbound_rotate_url, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && app_id !~ pattern fail ArgumentError, "invalid value for 'app_id' when calling InboundApi.v1_inbound_rotate_url, must conform to the pattern #{pattern}." end # resource path local_var_path = '/api/v1/app/{app_id}/inbound/rotate-url'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RotatedUrlOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"InboundApi.v1_inbound_rotate_url", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboundApi#v1_inbound_rotate_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |