class Rexpense::Resources::Webhook

A wrapper to Rexpense organizations API

API

Documentation: developers.rexpense.com/api/v1/organizations/

Public Instance Methods

create(id, params={}) click to toggle source

Create a organization Webhook

API

Method: POST /api/v1/organization/:id/integrations/webhooks

Documentation: developers.rexpense.com/api/webhooks#create

# File lib/rexpense/resources/webhook.rb, line 43
def create(id, params={})
  http.post(endpoint_base(id), body: params) do |response|
    Rexpense::Entities::Webhook.new response.parsed_body
  end
end
destroy(id, webhook_id) click to toggle source

Create a organization Webhook

API

Method: DELETE /api/v1/organization/:id/integrations/webhooks/:webhook_id

Documentation: developers.rexpense.com/api/webhooks#destroy

# File lib/rexpense/resources/webhook.rb, line 69
def destroy(id, webhook_id)
  http.delete("#{endpoint_base(id)}/#{webhook_id}") do |response|
    true
  end
end
find(id, webhook_id) click to toggle source

Find a organization Webhook

API

Method: GET /api/v1/organization/:id/integrations/webhooks/:webhook_id

Documentation: developers.rexpense.com/api/webhooks#show

# File lib/rexpense/resources/webhook.rb, line 30
def find(id, webhook_id)
  http.get("#{endpoint_base(id)}/#{webhook_id}") do |response|
    Rexpense::Entities::Webhook.new response.parsed_body
  end
end
find_all(id) click to toggle source

Get organization webhooks

API

Method: GET /api/v1/organization/:id/integrations/webhooks

Documentation: developers.rexpense.com/api/webhooks#index

# File lib/rexpense/resources/webhook.rb, line 17
def find_all(id)
  http.get(endpoint_base(id)) do |response|
    Rexpense::Entities::WebhookCollection.build response
  end
end
update(id, webhook_id, params={}) click to toggle source

Update a organization Webhook

API

Method: PUT /api/v1/organization/:id/integrations/webhooks/:webhook_id

Documentation: developers.rexpense.com/api/webhooks#update

# File lib/rexpense/resources/webhook.rb, line 56
def update(id, webhook_id, params={})
  http.put("#{endpoint_base(id)}/#{webhook_id}", body: params) do |response|
    Rexpense::Entities::Webhook.new response.parsed_body
  end
end

Private Instance Methods

endpoint_base(id) click to toggle source
# File lib/rexpense/resources/webhook.rb, line 77
def endpoint_base(id)
  "/organizations/#{id}/integrations/webhooks"
end