Class: Belvo::Client
- Inherits:
-
Object
- Object
- Belvo::Client
- Defined in:
- lib/belvo.rb
Overview
Allows easy access to Belvo API servers.
Instance Attribute Summary collapse
-
#session ⇒ APISession
readonly
Current Belvo API session.
Instance Method Summary collapse
-
#accounts ⇒ Account
Provides access to Accounts resource.
-
#balances ⇒ Balance
Provides access to Balances resource.
-
#employment_records ⇒ EmploymentRecords
Provides access to EmploymentRecords resource.
-
#incomes ⇒ Income
Provides access to Incomes resource.
-
#initialize(secret_key_id, secret_key_password, url = nil) ⇒ APISession
constructor
Authenticated Belvo API session.
-
#institutions ⇒ Institution
Provides access to the Institutions resource.
-
#investments_portfolio ⇒ InvestmentsPortfolio
Provides access to InvestmentsPortfolio resource.
-
#invoices ⇒ Invoice
Provides access to Invoices resource.
-
#links ⇒ Link
Provides access to Links resource.
-
#owners ⇒ Owner
Provides access to Owners resource.
-
#recurring_expenses ⇒ RecurringExpense
Provides access to RecurringExpenses resource.
-
#risk_insights ⇒ RiskInsights
Provides access to RiskInsights resource.
-
#statements ⇒ Statement
Provides access to Statements resource.
-
#tax_compliance_status ⇒ TaxComplianceStatus
Provides access to TaxComplianceStatus resource.
-
#tax_declarations ⇒ TaxDeclaration
Provides access to TaxDeclarations resource.
-
#tax_retentions ⇒ TaxRetentions
Provides access to the TaxRetentions resource.
-
#tax_returns ⇒ TaxReturn
Provides access to TaxReturns resource.
-
#tax_status ⇒ TaxStatus
Provides access to TaxStatus resource.
-
#transactions ⇒ Transaction
Provides access to Transactions resource.
-
#widget_token ⇒ WidgetToken
Provides access to WidgetToken resource.
Constructor Details
#initialize(secret_key_id, secret_key_password, url = nil) ⇒ APISession
Returns Authenticated Belvo API session.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/belvo.rb', line 20 def initialize(secret_key_id, secret_key_password, url = nil) (belvo_api_url = url) || ENV['BELVO_API_URL'] belvo_api_url = Environment.get_url(belvo_api_url) if belvo_api_url.nil? raise BelvoAPIError, 'You need to provide a URL or a valid environment.' end @session = Belvo::APISession.new(belvo_api_url) return if @session.login(secret_key_id, secret_key_password) raise BelvoAPIError, 'Login failed.' end |
Instance Attribute Details
#session ⇒ APISession (readonly)
Current Belvo API session
13 14 15 |
# File 'lib/belvo.rb', line 13 def session @session end |
Instance Method Details
#accounts ⇒ Account
Provides access to Accounts resource
43 44 45 |
# File 'lib/belvo.rb', line 43 def accounts @accounts = Account.new @session end |
#balances ⇒ Balance
Provides access to Balances resource
61 62 63 |
# File 'lib/belvo.rb', line 61 def balances @balances = Balance.new @session end |
#employment_records ⇒ EmploymentRecords
Provides access to EmploymentRecords resource
145 146 147 |
# File 'lib/belvo.rb', line 145 def employment_records @employment_records = EmploymentRecords.new @session end |
#incomes ⇒ Income
Provides access to Incomes resource
73 74 75 |
# File 'lib/belvo.rb', line 73 def incomes @incomes = Income.new @session end |
#institutions ⇒ Institution
Provides access to the Institutions resource
127 128 129 |
# File 'lib/belvo.rb', line 127 def institutions @institutions = Institution.new @session end |
#investments_portfolio ⇒ InvestmentsPortfolio
Provides access to InvestmentsPortfolio resource
139 140 141 |
# File 'lib/belvo.rb', line 139 def investments_portfolio @investments_portfolio = InvestmentsPortfolio.new @session end |
#invoices ⇒ Invoice
Provides access to Invoices resource
79 80 81 |
# File 'lib/belvo.rb', line 79 def invoices @invoices = Invoice.new @session end |
#links ⇒ Link
Provides access to Links resource
37 38 39 |
# File 'lib/belvo.rb', line 37 def links @links = Link.new @session end |
#owners ⇒ Owner
Provides access to Owners resource
55 56 57 |
# File 'lib/belvo.rb', line 55 def owners @owners = Owner.new @session end |
#recurring_expenses ⇒ RecurringExpense
Provides access to RecurringExpenses resource
85 86 87 |
# File 'lib/belvo.rb', line 85 def recurring_expenses @recurring_expenses = RecurringExpenses.new @session end |
#risk_insights ⇒ RiskInsights
Provides access to RiskInsights resource
91 92 93 |
# File 'lib/belvo.rb', line 91 def risk_insights @risk_insights = RiskInsights.new @session end |
#statements ⇒ Statement
Provides access to Statements resource
67 68 69 |
# File 'lib/belvo.rb', line 67 def statements @statements = Statement.new @session end |
#tax_compliance_status ⇒ TaxComplianceStatus
Provides access to TaxComplianceStatus resource
97 98 99 |
# File 'lib/belvo.rb', line 97 def tax_compliance_status @tax_compliance_status = TaxComplianceStatus.new @session end |
#tax_declarations ⇒ TaxDeclaration
Provides access to TaxDeclarations resource
109 110 111 |
# File 'lib/belvo.rb', line 109 def tax_declarations @tax_declarations = TaxDeclaration.new @session end |
#tax_retentions ⇒ TaxRetentions
Provides access to the TaxRetentions resource
121 122 123 |
# File 'lib/belvo.rb', line 121 def tax_retentions @tax_retentions = TaxRetentions.new @session end |
#tax_returns ⇒ TaxReturn
Provides access to TaxReturns resource
103 104 105 |
# File 'lib/belvo.rb', line 103 def tax_returns @tax_returns = TaxReturn.new @session end |
#tax_status ⇒ TaxStatus
Provides access to TaxStatus resource
115 116 117 |
# File 'lib/belvo.rb', line 115 def tax_status @tax_status = TaxStatus.new @session end |
#transactions ⇒ Transaction
Provides access to Transactions resource
49 50 51 |
# File 'lib/belvo.rb', line 49 def transactions @transactions = Transaction.new @session end |
#widget_token ⇒ WidgetToken
Provides access to WidgetToken resource
133 134 135 |
# File 'lib/belvo.rb', line 133 def @widget_token = WidgetToken.new @session end |