Class: Myfinance::Resources::DepositAccount

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

Overview

A wrapper to Myfinance deposit accounts API

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

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(entity_id, params = {}) ⇒ Object

Creates a deposit account of entity

[API] Method: POST /entities/:entity_id/deposit_accounts

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


48
49
50
51
52
# File 'lib/myfinance/resources/deposit_account.rb', line 48

def create(entity_id, params = {})
  http.post("/entities/#{entity_id}/deposit_accounts", body: { deposit_account: params }) do |response|
    respond_with_object(response, "deposit_account")
  end
end

#destroy(entity_id, id) ⇒ Object

Destroy a deposit account of entity

[API] Method: DELETE /entities/:entity_id/deposit_accounts/:id

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


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

def destroy(entity_id, id)
  http.delete("/entities/#{entity_id}/deposit_accounts/#{id}", body: {}) do |response|
    respond_with_object(response, "deposit_account")
  end
end

#find(entity_id, id) ⇒ Object

List a deposit account of entity

[API] Method: GET /entities/:entity_id/deposit_accounts/:id

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


34
35
36
37
38
# File 'lib/myfinance/resources/deposit_account.rb', line 34

def find(entity_id, id)
  http.get("/entities/#{entity_id}/deposit_accounts/#{id}", body: {}) do |response|
    respond_with_object(response, "deposit_account")
  end
end

#find_all(entity_id, params = {}) ⇒ Object

List all deposit accounts of entity with optional filters for refinement

[API] Method: GET /entities/:entity_id/deposit_accounts

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


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

def find_all(entity_id, params = {})
  search_endpoint = build_search_endpoint(entity_id, params)

  http.get(search_endpoint) do |response|
    respond_with_collection(response)
  end
end

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

Updates a deposit account of entity

[API] Method: PUT /entities/:entity_id/deposit_accounts/:id

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


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

def update(entity_id, id, params = {})
  http.put("/entities/#{entity_id}/deposit_accounts/#{id}", body: { deposit_account: params }) do |response|
    respond_with_object(response, "deposit_account")
  end
end