class Myfinance::Resources::DepositAccount
A wrapper to Myfinance
deposit accounts API
- API
-
Documentation: app.myfinance.com.br/docs/api/deposit_accounts
Public Instance Methods
Creates a deposit account of entity
- API
-
Method:
POST /entities/:entity_id/deposit_accounts
Documentation: app.myfinance.com.br/docs/api/deposit_accounts#post_create
# 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 a deposit account of entity
- API
-
Method:
DELETE /entities/:entity_id/deposit_accounts/:id
Documentation: app.myfinance.com.br/docs/api/deposit_accounts#delete_destroy
# 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
List a deposit account of entity
- API
-
Method:
GET /entities/:entity_id/deposit_accounts/:id
Documentation: app.myfinance.com.br/docs/api/deposit_accounts#get_show
# 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
List all deposit accounts of entity with optional filters for refinement
- API
-
Method:
GET /entities/:entity_id/deposit_accounts
Documentation: app.myfinance.com.br/docs/api/deposit_accounts#get_index
# 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
Updates a deposit account of entity
- API
-
Method:
PUT /entities/:entity_id/deposit_accounts/:id
Documentation: app.myfinance.com.br/docs/api/deposit_accounts#put_update
# 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
Private Instance Methods
# File lib/myfinance/resources/deposit_account.rb, line 84 def build_search_endpoint(entity_id, params) query_string = query(params).join("&") deposit_endpoint = endpoint(entity_id) URI.encode("#{deposit_endpoint}?#{query_string}") end
# File lib/myfinance/resources/deposit_account.rb, line 91 def endpoint(entity_id) "/entities/#{entity_id}/deposit_accounts" end