Class: Myfinance::Resources::CreditCard

Inherits:
Base
  • Object
show all
Defined in:
lib/myfinance/resources/credit_card.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(entity_id, params = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/myfinance/resources/credit_card.rb', line 17

def create(entity_id, params = {})
  body = { credit_card: params }
  http.post(path(entity_id), body: body) do |response|
    respond_with_object(response, "credit_card")
  end
end

#destroy(entity_id, id) ⇒ Object



32
33
34
35
36
37
# File 'lib/myfinance/resources/credit_card.rb', line 32

def destroy(entity_id, id)
  cc_path = path(entity_id) + "/#{id}"
  http.delete(cc_path, body: {}) do |response|
    response
  end
end

#find(entity_id, id) ⇒ Object



10
11
12
13
14
15
# File 'lib/myfinance/resources/credit_card.rb', line 10

def find(entity_id, id)
  cc_path = path(entity_id) + "/#{id}"
  http.get(cc_path, body: {}) do |response|
    respond_with_object(response, "credit_card")
  end
end

#find_all(entity_id) ⇒ Object



4
5
6
7
8
# File 'lib/myfinance/resources/credit_card.rb', line 4

def find_all(entity_id)
  http.get(path(entity_id), body: {}) do |response|
    respond_with_collection(response)
  end
end

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



24
25
26
27
28
29
30
# File 'lib/myfinance/resources/credit_card.rb', line 24

def update(entity_id, id, params = {})
  cc_path = path(entity_id) + "/#{id}"
  body = { credit_card: params }
  http.put(cc_path, body: body) do |response|
    respond_with_object(response, "credit_card")
  end
end