Class: Myfinance::Resources::Webhook

Inherits:
Base
  • Object
show all
Defined in:
lib/myfinance/resources/webhook.rb

Overview

A wrapper to Myfinance Webhooks API

[API] Documentation: https://app.myfinance.com.br/docs/api/webhooks

Instance Attribute Summary

Attributes inherited from Base

#http

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Myfinance::Resources::Base

Instance Method Details

#create(params) ⇒ Object

Create a webhook

[API] Method: POST /integrations/webhooks

Documentation: https://app.myfinance.com.br/docs/api/webhooks#post_create


46
47
48
49
50
# File 'lib/myfinance/resources/webhook.rb', line 46

def create(params)
  http.post("/integrations/webhooks", body: { webhook: params }) do |response|
    respond_with_object(response, "webhook")
  end
end

#destroy(id) ⇒ Object

Destroy a webhook

[API] Method: DELETE /integrations/webhooks/:id

Documentation: https://app.myfinance.com.br/docs/api/webhooks#delete_destroy


76
77
78
79
80
# File 'lib/myfinance/resources/webhook.rb', line 76

def destroy(id)
  http.delete("/integrations/webhooks/#{id}", body: {}) do |response|
    respond_with_object(response, "webhook")
  end
end

#find(id) ⇒ Object

List a webhook

[API] Method: GET /integrations/webhooks/:id

Documentation: https://app.myfinance.com.br/docs/api/webhooks#get_show


32
33
34
35
36
# File 'lib/myfinance/resources/webhook.rb', line 32

def find(id)
  http.get("/integrations/webhooks/#{id}", body: {}) do |response|
    respond_with_object response, "webhook"
  end
end

#find_allObject

List all webhooks

[API] Method: GET /integrations/webhooks

Documentation: https://app.myfinance.com.br/docs/api/webhooks#get_index


18
19
20
21
22
# File 'lib/myfinance/resources/webhook.rb', line 18

def find_all
  http.get("/integrations/webhooks", body: {}) do |response|
    respond_with_collection(response)
  end
end

#update(id, params = {}) ⇒ Object

Updates a webhook

[API] Method: PUT /integrations/webhooks/:id

Documentation: https://app.myfinance.com.br/docs/api/webhooks#put_update


60
61
62
63
64
65
66
# File 'lib/myfinance/resources/webhook.rb', line 60

def update(id, params = {})
  http.put(
    "/integrations/webhooks/#{id}", body: { webhook: params }
  ) do |response|
    respond_with_object(response, "webhook")
  end
end