Module: Crowdin::ApiResources::Webhooks
- Defined in:
- lib/crowdin-api/api_resources/webhooks.rb
Instance Method Summary collapse
- #add_webhook(query = {}, project_id = config.project_id) ⇒ Object
- #delete_webhook(webhook_id = nil, project_id = config.project_id) ⇒ Object
- #edit_webhook(webhook_id = nil, query = {}, project_id = config.project_id) ⇒ Object
- #get_webhook(webhook_id = nil, project_id = config.project_id) ⇒ Object
- #list_webhooks(query = {}, project_id = config.project_id) ⇒ Object
Instance Method Details
#add_webhook(query = {}, project_id = config.project_id) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/crowdin-api/api_resources/webhooks.rb', line 18 def add_webhook(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/webhooks", { params: query } ) Web::SendRequest.new(request).perform end |
#delete_webhook(webhook_id = nil, project_id = config.project_id) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/crowdin-api/api_resources/webhooks.rb', line 42 def delete_webhook(webhook_id = nil, project_id = config.project_id) webhook_id || raise_parameter_is_required_error(:webhook_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :delete, "#{config.target_api_url}/projects/#{project_id}/webhooks/#{webhook_id}" ) Web::SendRequest.new(request).perform end |
#edit_webhook(webhook_id = nil, query = {}, project_id = config.project_id) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/crowdin-api/api_resources/webhooks.rb', line 54 def edit_webhook(webhook_id = nil, query = {}, project_id = config.project_id) webhook_id || raise_parameter_is_required_error(:webhook_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :patch, "#{config.target_api_url}/projects/#{project_id}/webhooks/#{webhook_id}", { params: query } ) Web::SendRequest.new(request).perform end |
#get_webhook(webhook_id = nil, project_id = config.project_id) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/crowdin-api/api_resources/webhooks.rb', line 30 def get_webhook(webhook_id = nil, project_id = config.project_id) webhook_id || raise_parameter_is_required_error(:webhook_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/webhooks/#{webhook_id}" ) Web::SendRequest.new(request).perform end |
#list_webhooks(query = {}, project_id = config.project_id) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/crowdin-api/api_resources/webhooks.rb', line 6 def list_webhooks(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/webhooks", { params: query } ) Web::SendRequest.new(request).perform end |