Class: Pescheck::WebhooksApi
- Inherits:
-
Object
- Object
- Pescheck::WebhooksApi
- Defined in:
- lib/pescheck/api/webhooks_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_webhook2(webhook, opts = {}) ⇒ WebhookResponse
Create webhook for event notifications.
-
#create_webhook2_with_http_info(webhook, opts = {}) ⇒ Array<(WebhookResponse, Integer, Hash)>
Create webhook for event notifications.
-
#delete_webhook2(webhook_id, opts = {}) ⇒ nil
Delete a webhook.
-
#delete_webhook2_with_http_info(webhook_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete a webhook.
-
#initialize(api_client = ApiClient.default) ⇒ WebhooksApi
constructor
A new instance of WebhooksApi.
-
#list_webhooks2(opts = {}) ⇒ Array<WebhookResponse>
List webhooks for the organization.
-
#list_webhooks2_with_http_info(opts = {}) ⇒ Array<(Array<WebhookResponse>, Integer, Hash)>
List webhooks for the organization.
-
#verify_webhook2(webhook_id, verify_webhook, opts = {}) ⇒ nil
Verify webhook ownership.
-
#verify_webhook2_with_http_info(webhook_id, verify_webhook, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Verify webhook ownership.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ WebhooksApi
Returns a new instance of WebhooksApi.
19 20 21 |
# File 'lib/pescheck/api/webhooks_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/pescheck/api/webhooks_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_webhook2(webhook, opts = {}) ⇒ WebhookResponse
Create webhook for event notifications. Authentication Notes: - OAuth2: Organization is automatically determined from the OAuth application - If your OAuth app has no organization set, pass it via X-Organization-Id header or organization_id query parameter Valid Events: - check.started - Check has been initiated - check.completed - Check has been completed successfully - check.failed - Check has failed - screening.created - New screening has been created - screening.completed - Screening has been completed - screening.archived - Screening has been archived - package.created - New package has been created - package.updated - Package has been updated - division.created - New division has been created - division.updated - Division has been updated Limited to 5 webhooks per organization/division.
28 29 30 31 |
# File 'lib/pescheck/api/webhooks_api.rb', line 28 def create_webhook2(webhook, opts = {}) data, _status_code, _headers = create_webhook2_with_http_info(webhook, opts) data end |
#create_webhook2_with_http_info(webhook, opts = {}) ⇒ Array<(WebhookResponse, Integer, Hash)>
Create webhook for event notifications. Authentication Notes: - OAuth2: Organization is automatically determined from the OAuth application - If your OAuth app has no organization set, pass it via `X-Organization-Id` header or `organization_id` query parameter Valid Events: - `check.started` - Check has been initiated - `check.completed` - Check has been completed successfully - `check.failed` - Check has failed - `screening.created` - New screening has been created - `screening.completed` - Screening has been completed - `screening.archived` - Screening has been archived - `package.created` - New package has been created - `package.updated` - Package has been updated - `division.created` - New division has been created - `division.updated` - Division has been updated Limited to 5 webhooks per organization/division.
39 40 41 42 43 44 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 |
# File 'lib/pescheck/api/webhooks_api.rb', line 39 def create_webhook2_with_http_info(webhook, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.create_webhook2 ...' end # verify the required parameter 'webhook' is set if @api_client.config.client_side_validation && webhook.nil? fail ArgumentError, "Missing the required parameter 'webhook' when calling WebhooksApi.create_webhook2" end # resource path local_var_path = '/api/v2/webhooks/' # query parameters query_params = opts[:query_params] || {} query_params[:'organization_id'] = opts[:'organization_id'] if !opts[:'organization_id'].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', 'multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'X-Organization-Id'] = opts[:'x_organization_id'] if !opts[:'x_organization_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook) # return_type return_type = opts[:debug_return_type] || 'WebhookResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] = opts.merge( :operation => :"WebhooksApi.create_webhook2", :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: WebhooksApi#create_webhook2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_webhook2(webhook_id, opts = {}) ⇒ nil
Delete a webhook
98 99 100 101 |
# File 'lib/pescheck/api/webhooks_api.rb', line 98 def delete_webhook2(webhook_id, opts = {}) delete_webhook2_with_http_info(webhook_id, opts) nil end |
#delete_webhook2_with_http_info(webhook_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete a webhook
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/pescheck/api/webhooks_api.rb', line 107 def delete_webhook2_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook2 ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.delete_webhook2" end # resource path local_var_path = '/api/v2/webhooks/{webhook_id}/'.sub('{webhook_id}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] = opts.merge( :operation => :"WebhooksApi.delete_webhook2", :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(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#delete_webhook2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_webhooks2(opts = {}) ⇒ Array<WebhookResponse>
List webhooks for the organization
156 157 158 159 |
# File 'lib/pescheck/api/webhooks_api.rb', line 156 def list_webhooks2(opts = {}) data, _status_code, _headers = list_webhooks2_with_http_info(opts) data end |
#list_webhooks2_with_http_info(opts = {}) ⇒ Array<(Array<WebhookResponse>, Integer, Hash)>
List webhooks for the organization
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 |
# File 'lib/pescheck/api/webhooks_api.rb', line 164 def list_webhooks2_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks2 ...' end # resource path local_var_path = '/api/v2/webhooks/list/' # 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'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array<WebhookResponse>' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] = opts.merge( :operation => :"WebhooksApi.list_webhooks2", :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(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#list_webhooks2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#verify_webhook2(webhook_id, verify_webhook, opts = {}) ⇒ nil
Verify webhook ownership
213 214 215 216 |
# File 'lib/pescheck/api/webhooks_api.rb', line 213 def verify_webhook2(webhook_id, verify_webhook, opts = {}) verify_webhook2_with_http_info(webhook_id, verify_webhook, opts) nil end |
#verify_webhook2_with_http_info(webhook_id, verify_webhook, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Verify webhook ownership
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/pescheck/api/webhooks_api.rb', line 223 def verify_webhook2_with_http_info(webhook_id, verify_webhook, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksApi.verify_webhook2 ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.verify_webhook2" end # verify the required parameter 'verify_webhook' is set if @api_client.config.client_side_validation && verify_webhook.nil? fail ArgumentError, "Missing the required parameter 'verify_webhook' when calling WebhooksApi.verify_webhook2" end # resource path local_var_path = '/api/v2/webhooks/{webhook_id}/verify/'.sub('{webhook_id}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json', 'multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(verify_webhook) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] = opts.merge( :operation => :"WebhooksApi.verify_webhook2", :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: WebhooksApi#verify_webhook2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |