Class: Myfinance::Resources::CustomClassifier

Inherits:
Base
  • Object
show all
Defined in:
lib/myfinance/resources/custom_classifier.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(params) ⇒ Object

Creates a custom classifier

[API] Method: POST /custom_classifiers

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


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

def create(params)
  http.post("/custom_classifiers", body: { custom_classifier: params }) do |response|
    respond_with_object response, "custom_classifier"
  end
end

#destroy(id) ⇒ Object

Destroy a custom_classifier

[API] Method: DELETE /custom_classifiers/:id

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


70
71
72
73
74
# File 'lib/myfinance/resources/custom_classifier.rb', line 70

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

#find(id) ⇒ Object

Find a custom classifier

[API] Method: GET /custom_classifiers/:id

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


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

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

#find_all(params = {}) ⇒ Object

List all custom classifiers

[API] Method: GET /custom_classifiers

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


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

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 = {}) ⇒ Object

Updates a custom classifier

[API] Method: PUT /custom_classifiers/:id

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


56
57
58
59
60
# File 'lib/myfinance/resources/custom_classifier.rb', line 56

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