Class: Svix::Application
- Inherits:
-
Object
- Object
- Svix::Application
- Defined in:
- lib/svix/api/application.rb
Instance Method Summary collapse
- #create(application_in, options = {}) ⇒ Object
- #delete(app_id) ⇒ Object
- #get(app_id) ⇒ Object
- #get_or_create(application_in, options = {}) ⇒ Object
-
#initialize(client) ⇒ Application
constructor
A new instance of Application.
- #list(options = {}) ⇒ Object
- #patch(app_id, application_patch) ⇒ Object
- #update(app_id, application_in) ⇒ Object
Constructor Details
#initialize(client) ⇒ Application
Returns a new instance of Application.
8 9 10 |
# File 'lib/svix/api/application.rb', line 8 def initialize(client) @client = client end |
Instance Method Details
#create(application_in, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/svix/api/application.rb', line 28 def create(application_in, = {}) = .transform_keys(&:to_s) res = @client.execute_request( "POST", "/api/v1/app", headers: { "idempotency-key" => ["idempotency-key"] }, body: application_in ) ApplicationOut.deserialize(res) end |
#delete(app_id) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/svix/api/application.rb', line 75 def delete(app_id) @client.execute_request( "DELETE", "/api/v1/app/#{app_id}" ) end |
#get(app_id) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/svix/api/application.rb', line 58 def get(app_id) res = @client.execute_request( "GET", "/api/v1/app/#{app_id}" ) ApplicationOut.deserialize(res) end |
#get_or_create(application_in, options = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/svix/api/application.rb', line 41 def get_or_create(application_in, = {}) = .transform_keys(&:to_s) path = "/api/v1/app" res = @client.execute_request( "POST", path, query_params: { "get_if_exists" => "true" }, headers: { "idempotency-key" => ["idempotency-key"] }, body: application_in ) ApplicationOut.deserialize(res) end |
#list(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/svix/api/application.rb', line 12 def list( = {}) = .transform_keys(&:to_s) res = @client.execute_request( "GET", "/api/v1/app", query_params: { "exclude_apps_with_no_endpoints" => ["exclude_apps_with_no_endpoints"], "exclude_apps_with_disabled_endpoints" => ["exclude_apps_with_disabled_endpoints"], "limit" => ["limit"], "iterator" => ["iterator"], "order" => ["order"] } ) ListResponseApplicationOut.deserialize(res) end |
#patch(app_id, application_patch) ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'lib/svix/api/application.rb', line 82 def patch(app_id, application_patch) res = @client.execute_request( "PATCH", "/api/v1/app/#{app_id}", body: application_patch ) ApplicationOut.deserialize(res) end |
#update(app_id, application_in) ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/svix/api/application.rb', line 66 def update(app_id, application_in) res = @client.execute_request( "PUT", "/api/v1/app/#{app_id}", body: application_in ) ApplicationOut.deserialize(res) end |