Class: Myfinance::Client
- Inherits:
-
Object
- Object
- Myfinance::Client
- Defined in:
- lib/myfinance/client.rb
Instance Attribute Summary collapse
-
#http ⇒ Object
readonly
Returns the value of attribute http.
Instance Method Summary collapse
- #accounts ⇒ Object
- #attachments ⇒ Object
- #authenticated? ⇒ Boolean
- #bank_statements ⇒ Object
- #categories ⇒ Object
- #classification_centers ⇒ Object
- #credit_card_transactions ⇒ Object
- #credit_cards ⇒ Object
- #custom_classifier_values ⇒ Object
- #custom_classifiers ⇒ Object
- #deposit_accounts ⇒ Object
- #entities ⇒ Object
- #financial_transactions ⇒ Object
-
#initialize(token, account_id = nil) ⇒ Client
constructor
A new instance of Client.
- #payable_accounts ⇒ Object
- #people ⇒ Object
- #receivable_accounts ⇒ Object
- #reconciles ⇒ Object
- #sale_accounts ⇒ Object
- #sale_rules ⇒ Object
- #sales ⇒ Object
- #taxes ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(token, account_id = nil) ⇒ Client
8 9 10 |
# File 'lib/myfinance/client.rb', line 8 def initialize(token, account_id = nil) @http = Http.new(token, account_id) end |
Instance Attribute Details
#http ⇒ Object (readonly)
Returns the value of attribute http.
6 7 8 |
# File 'lib/myfinance/client.rb', line 6 def http @http end |
Instance Method Details
#accounts ⇒ Object
47 48 49 |
# File 'lib/myfinance/client.rb', line 47 def accounts Myfinance::Resources::Account.new(http) end |
#attachments ⇒ Object
35 36 37 |
# File 'lib/myfinance/client.rb', line 35 def Myfinance::Resources::Attachment.new(http) end |
#authenticated? ⇒ Boolean
12 13 14 15 16 17 |
# File 'lib/myfinance/client.rb', line 12 def authenticated? http.get("/accounts") { |response| response.code == 200 } rescue RequestError => e raise e unless [401, 403].include?(e.code) false end |
#bank_statements ⇒ Object
79 80 81 |
# File 'lib/myfinance/client.rb', line 79 def bank_statements Myfinance::Resources::BankStatement.new(http) end |
#categories ⇒ Object
43 44 45 |
# File 'lib/myfinance/client.rb', line 43 def categories Myfinance::Resources::Category.new(http) end |
#classification_centers ⇒ Object
39 40 41 |
# File 'lib/myfinance/client.rb', line 39 def classification_centers Myfinance::Resources::ClassificationCenter.new(http) end |
#credit_card_transactions ⇒ Object
71 72 73 |
# File 'lib/myfinance/client.rb', line 71 def credit_card_transactions Myfinance::Resources::CreditCardTransaction.new(http) end |
#credit_cards ⇒ Object
67 68 69 |
# File 'lib/myfinance/client.rb', line 67 def credit_cards Myfinance::Resources::CreditCard.new(http) end |
#custom_classifier_values ⇒ Object
99 100 101 |
# File 'lib/myfinance/client.rb', line 99 def custom_classifier_values Myfinance::Resources::CustomClassifierValue.new(http) end |
#custom_classifiers ⇒ Object
95 96 97 |
# File 'lib/myfinance/client.rb', line 95 def custom_classifiers Myfinance::Resources::CustomClassifier.new(http) end |
#deposit_accounts ⇒ Object
51 52 53 |
# File 'lib/myfinance/client.rb', line 51 def deposit_accounts Myfinance::Resources::DepositAccount.new(http) end |
#entities ⇒ Object
19 20 21 |
# File 'lib/myfinance/client.rb', line 19 def entities Myfinance::Resources::Entity.new(http) end |
#financial_transactions ⇒ Object
23 24 25 |
# File 'lib/myfinance/client.rb', line 23 def financial_transactions Myfinance::Resources::FinancialTransaction.new(http) end |
#payable_accounts ⇒ Object
27 28 29 |
# File 'lib/myfinance/client.rb', line 27 def payable_accounts Myfinance::Resources::PayableAccount.new(http) end |
#people ⇒ Object
55 56 57 |
# File 'lib/myfinance/client.rb', line 55 def people Myfinance::Resources::Person.new(http) end |
#receivable_accounts ⇒ Object
31 32 33 |
# File 'lib/myfinance/client.rb', line 31 def receivable_accounts Myfinance::Resources::ReceivableAccount.new(http) end |
#reconciles ⇒ Object
75 76 77 |
# File 'lib/myfinance/client.rb', line 75 def reconciles Myfinance::Resources::Reconcile.new(http) end |
#sale_accounts ⇒ Object
87 88 89 |
# File 'lib/myfinance/client.rb', line 87 def sale_accounts Myfinance::Resources::SaleAccount.new(http) end |
#sale_rules ⇒ Object
91 92 93 |
# File 'lib/myfinance/client.rb', line 91 def sale_rules Myfinance::Resources::SaleRule.new(http) end |
#sales ⇒ Object
83 84 85 |
# File 'lib/myfinance/client.rb', line 83 def sales Myfinance::Resources::Sale.new(http) end |
#taxes ⇒ Object
63 64 65 |
# File 'lib/myfinance/client.rb', line 63 def taxes Myfinance::Resources::Tax.new(http) end |
#webhooks ⇒ Object
59 60 61 |
# File 'lib/myfinance/client.rb', line 59 def webhooks Myfinance::Resources::Webhook.new(http) end |