Class: Myfinance::Resources::Entity

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

Overview

A wrapper to Myfinance entities API

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

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

#find(entity_id) ⇒ Object

Find a specific entity

[API] Method: GET /entities/:id

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


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

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

#find_all(params = {}) ⇒ Object

List all entities of the user

[API] Method: GET /entities

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


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

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

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