class Myfinance::Resources::Category

A wrapper to Myfinance categories API

API

Documentation: sandbox.myfinance.com.br/docs/api/categories

Public Instance Methods

create(params) click to toggle source

Creates a category

API

Method: POST /categories

Documentation: sandbox.myfinance.com.br/docs/api/categories#post_create

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

Destroy a category

API

Method: DELETE /categories/:id

Documentation: sandbox.myfinance.com.br/docs/api/categories#delete_destroy

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

Find a category

API

Method: GET /categories/:id

Documentation: sandbox.myfinance.com.br/docs/api/categories#get_show

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

List all categories

API

Method: GET /categories

Documentation: sandbox.myfinance.com.br/docs/api/categories#get_index

# File lib/myfinance/resources/category.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 category

API

Method: PUT /categories/:id

Documentation: sandbox.myfinance.com.br/docs/api/categories#put_update

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

Private Instance Methods

endpoint() click to toggle source
# File lib/myfinance/resources/category.rb, line 84
def endpoint
  "/categories"
end