Class: Myfinance::Resources::FinancialTransaction
- Inherits:
-
Base
- Object
- Base
- Myfinance::Resources::FinancialTransaction
show all
- Defined in:
- lib/myfinance/resources/financial_transaction.rb
Instance Attribute Summary
Attributes inherited from Base
#http
Instance Method Summary
collapse
-
#create(entity_id, deposit_account_id, params = {}) ⇒ Object
-
#destroy(entity_id, deposit_account_id, id) ⇒ Object
-
#destroy_many(entity_id, deposit_account_id, ids = []) ⇒ Object
-
#find(entity_id, deposit_account_id, id) ⇒ Object
-
#find_all(entity_id, deposit_account_id, page = nil) ⇒ Object
A wrapper to Myfinance financial transaction API.
-
#update(entity_id, deposit_account_id, id, params = {}) ⇒ Object
Methods inherited from Base
#initialize
Instance Method Details
#create(entity_id, deposit_account_id, params = {}) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/myfinance/resources/financial_transaction.rb', line 41
def create(entity_id, deposit_account_id, params = {})
body = { financial_transaction: params }
http.post(path(entity_id, deposit_account_id), { body: body }) do |response|
respond_with_object(response, "financial_transaction")
end
end
|
#destroy(entity_id, deposit_account_id, id) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/myfinance/resources/financial_transaction.rb', line 71
def destroy(entity_id, deposit_account_id, id)
ft_path = path(entity_id, deposit_account_id) + "/#{id}"
http.delete(ft_path, body: {}) do |response|
response
end
end
|
#destroy_many(entity_id, deposit_account_id, ids = []) ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/myfinance/resources/financial_transaction.rb', line 85
def destroy_many(entity_id, deposit_account_id, ids=[])
ft_path = destroy_many_path(entity_id, deposit_account_id, ids)
http.delete(ft_path, body: {}) do |response|
response
end
end
|
#find(entity_id, deposit_account_id, id) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/myfinance/resources/financial_transaction.rb', line 26
def find(entity_id, deposit_account_id, id)
ft_path = path(entity_id, deposit_account_id) + "/#{id}"
http.get(ft_path, body: {}) do |response|
respond_with_object(response, "financial_transaction")
end
end
|
#find_all(entity_id, deposit_account_id, page = nil) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/myfinance/resources/financial_transaction.rb', line 10
def find_all(entity_id, deposit_account_id, page = nil)
fts_path = index_path(entity_id, deposit_account_id, page)
http.get(fts_path, body: {}) do |response|
respond_with_collection(response)
end
end
|
#update(entity_id, deposit_account_id, id, params = {}) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/myfinance/resources/financial_transaction.rb', line 56
def update(entity_id, deposit_account_id, id, params = {})
ft_path = path(entity_id, deposit_account_id) + "/#{id}"
body = { financial_transaction: params }
http.put(ft_path, { body: body }) do |response|
respond_with_object(response, "financial_transaction")
end
end
|