Class: Myfinance::Resources::CustomClassifierValue

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

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(custom_classifier_id, params) ⇒ Object

Creates a custom classifier value

[API] Method: POST /custom_classifiers/:custom_classifier_id/values

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


42
43
44
45
46
47
# File 'lib/myfinance/resources/custom_classifier_value.rb', line 42

def create(custom_classifier_id, params)
  body = { custom_classifier_value: params }
  http.post("/custom_classifiers/#{custom_classifier_id}/values", body: body) do |response|
    respond_with_object(response, "custom_classifier_value")
  end
end

#destroy(custom_classifier_id, id) ⇒ Object

Destroy a custom classifier value

[API] Method: DELETE /custom_classifiers/:custom_classifier_id/values/:id

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


72
73
74
75
76
# File 'lib/myfinance/resources/custom_classifier_value.rb', line 72

def destroy(custom_classifier_id, id)
  http.delete("/custom_classifiers/#{custom_classifier_id}/values/#{id}", body: {}) do |response|
    respond_with_object(response, "custom_classifier_value")
  end
end

#find(custom_classifier_id, id) ⇒ Object

Find a custom classifier value

[API] Method: GET /custom_classifiers/:custom_classifier_id/values/:id

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


28
29
30
31
32
# File 'lib/myfinance/resources/custom_classifier_value.rb', line 28

def find(custom_classifier_id, id)
  http.get("/custom_classifiers/#{custom_classifier_id}/values/#{id}", body: {}) do |response|
    respond_with_object(response, "custom_classifier_value")
  end
end

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

List all custom classifier values

[API] Method: GET /custom_classifiers/:custom_classifier_id/values

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


12
13
14
15
16
17
18
# File 'lib/myfinance/resources/custom_classifier_value.rb', line 12

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

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

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

Updates a custom classifier value

[API] Method: PUT /custom_classifiers/:custom_classifier_id/values/:id

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


57
58
59
60
61
62
# File 'lib/myfinance/resources/custom_classifier_value.rb', line 57

def update(custom_classifier_id, id, params = {})
  body = { custom_classifier_value: params }
  http.put("/custom_classifiers/#{custom_classifier_id}/values/#{id}", body: body) do |response|
    respond_with_object(response, "custom_classifier_value")
  end
end