class Belvo::Client
Allows easy access to Belvo
API servers.
Attributes
Current Belvo
API session @return [APISession]
Public Class Methods
@param secret_key_id [String] @param secret_key_password [String] @param url [String, nil] API host URL, can be set from the environment
using the variable name BELVO_API_URL
@return [APISession] Authenticated Belvo
API session
# 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
Public Instance Methods
Provides access to Accounts resource @return [Account]
# File lib/belvo.rb, line 43 def accounts @accounts = Account.new @session end
Provides access to Balances resource @return [Balance]
# File lib/belvo.rb, line 61 def balances @balances = Balance.new @session end
Provides access to Incomes resource @return [Income]
# File lib/belvo.rb, line 73 def incomes @incomes = Income.new @session end
Provides access to Instituions resource @return [Institution]
# File lib/belvo.rb, line 103 def institutions @institutions = Institution.new @session end
Provides access to Invoices resource @return [Invoice]
# File lib/belvo.rb, line 79 def invoices @invoices = Invoice.new @session end
Provides access to Links resource @return [Link]
# File lib/belvo.rb, line 37 def links @links = Link.new @session end
Provides access to Owners resource @return [Owner]
# File lib/belvo.rb, line 55 def owners @owners = Owner.new @session end
Provides access to Statements resource @return [Statement]
# File lib/belvo.rb, line 67 def statements @statements = Statement.new @session end
Provides access to TaxComplianceStatus
resource @return [TaxComplianceStatus]
# File lib/belvo.rb, line 85 def tax_compliance_status @tax_compliance_status = TaxComplianceStatus.new @session end
Provides access to TaxReturns resource @return [TaxReturn]
# File lib/belvo.rb, line 91 def tax_returns @tax_returns = TaxReturn.new @session end
Provides access to TaxStatus
resource @return [TaxStatus]
# File lib/belvo.rb, line 97 def tax_status @tax_status = TaxStatus.new @session end
Provides access to Transactions resource @return [Transaction]
# File lib/belvo.rb, line 49 def transactions @transactions = Transaction.new @session end
Provides access to WidgetToken
resource @return [WidgetToken]
# File lib/belvo.rb, line 109 def widget_token @widget_token = WidgetToken.new @session end