class Myfinance::Resources::Person

A wrapper to Myfinance people API

API

Documentation: app.myfinance.com.br/docs/api/people

Public Instance Methods

create(params) click to toggle source

Creates a person

API

Method: POST /people

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

# File lib/myfinance/resources/person.rb, line 49
def create(params)
  http.post("/people", body: { person: params }) do |response|
    respond_with_object response, "person"
  end
end
destroy(id) click to toggle source

Destroy a person

API

Method: DELETE /people/:id

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

# File lib/myfinance/resources/person.rb, line 77
def destroy(id)
  http.delete("/people/#{id}", body: {}) do |response|
    respond_with_object response, "person"
  end
end
find(id) click to toggle source

Show a person

API

Method: GET /people/:id

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

# File lib/myfinance/resources/person.rb, line 35
def find(id)
  http.get("/people/#{id}", body: {}) do |response|
    respond_with_object response, "person"
  end
end
find_all(params = {}) click to toggle source

List all people with optional filters for refinement

API

Method: GET /people

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

# File lib/myfinance/resources/person.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
update(id, params) click to toggle source

Updates a person

API

Method: PUT /people/:id

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

# File lib/myfinance/resources/person.rb, line 63
def update(id, params)
  http.put("/people/#{id}", body: { person: params }) do |response|
    respond_with_object response, "person"
  end
end

Private Instance Methods

endpoint() click to toggle source
# File lib/myfinance/resources/person.rb, line 85
def endpoint
  "/people"
end