Module: RubyLokaliseApi::Rest::Webhooks
- Included in:
- RubyLokaliseApi::Rest
- Defined in:
- lib/ruby_lokalise_api/rest/webhooks.rb
Instance Method Summary collapse
-
#create_webhook(project_id, req_params) ⇒ RubyLokaliseApi::Resources::Webhook
Creates a webhook.
-
#destroy_webhook(project_id, webhook_id) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes a webhook.
-
#regenerate_webhook_secret(project_id, webhook_id) ⇒ RubyLokaliseApi::Generics::RegeneratedWebhookSecret
Regenerates webhook secret.
-
#update_webhook(project_id, webhook_id, req_params) ⇒ RubyLokaliseApi::Resources::Webhook
Updates a webhook.
-
#webhook(project_id, webhook_id) ⇒ RubyLokaliseApi::Resources::Webhook
Returns a single webhook.
-
#webhooks(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Webhooks
Returns project webhooks.
Instance Method Details
#create_webhook(project_id, req_params) ⇒ RubyLokaliseApi::Resources::Webhook
Creates a webhook
41 42 43 44 45 46 47 |
# File 'lib/ruby_lokalise_api/rest/webhooks.rb', line 41 def create_webhook(project_id, req_params) params = { query: project_id, req: req_params } data = endpoint(name: 'Webhooks', params: params).do_post resource 'Webhook', data end |
#destroy_webhook(project_id, webhook_id) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes a webhook
84 85 86 87 88 89 90 |
# File 'lib/ruby_lokalise_api/rest/webhooks.rb', line 84 def destroy_webhook(project_id, webhook_id) params = { query: [project_id, webhook_id] } data = endpoint(name: 'Webhooks', params: params).do_delete RubyLokaliseApi::Generics::DeletedResource.new data.content end |
#regenerate_webhook_secret(project_id, webhook_id) ⇒ RubyLokaliseApi::Generics::RegeneratedWebhookSecret
Regenerates webhook secret
70 71 72 73 74 75 76 |
# File 'lib/ruby_lokalise_api/rest/webhooks.rb', line 70 def regenerate_webhook_secret(project_id, webhook_id) params = { query: [project_id, webhook_id, :secret, :regenerate] } data = endpoint(name: 'Webhooks', params: params).do_patch RubyLokaliseApi::Generics::RegeneratedWebhookSecret.new data.content end |
#update_webhook(project_id, webhook_id, req_params) ⇒ RubyLokaliseApi::Resources::Webhook
Updates a webhook
56 57 58 59 60 61 62 |
# File 'lib/ruby_lokalise_api/rest/webhooks.rb', line 56 def update_webhook(project_id, webhook_id, req_params) params = { query: [project_id, webhook_id], req: req_params } data = endpoint(name: 'Webhooks', params: params).do_put resource 'Webhook', data end |
#webhook(project_id, webhook_id) ⇒ RubyLokaliseApi::Resources::Webhook
Returns a single webhook
27 28 29 30 31 32 33 |
# File 'lib/ruby_lokalise_api/rest/webhooks.rb', line 27 def webhook(project_id, webhook_id) params = { query: [project_id, webhook_id] } data = endpoint(name: 'Webhooks', params: params).do_get resource 'Webhook', data end |
#webhooks(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Webhooks
Returns project webhooks
12 13 14 15 16 17 18 19 |
# File 'lib/ruby_lokalise_api/rest/webhooks.rb', line 12 def webhooks(project_id, req_params = {}) name = 'Webhooks' params = { query: project_id, req: req_params } data = endpoint(name: name, params: params).do_get collection name, data end |