Class: AutoExpreso::Client
- Inherits:
-
Object
- Object
- AutoExpreso::Client
- Includes:
- DataUtils
- Defined in:
- lib/autoexpreso.rb
Constant Summary collapse
- BASE_URL =
'https://tp-api.autoexpreso.com'- USER_AGENT =
"AutoExpreso-Rubygem/#{AutoExpreso::VERSION}"- ENDPOINTS =
{ login: '/api/Auth/Login', account_summary: '/api/Account/GetAccountSummary' }
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#jwt_header ⇒ Object
Returns the value of attribute jwt_header.
Instance Method Summary collapse
- #account_details(json: false) ⇒ Object
-
#initialize(*args) ⇒ Client
constructor
A new instance of Client.
- #login(email, password) ⇒ Object
Methods included from DataUtils
attributes, form_data, included, save_transactions
Constructor Details
#initialize(*args) ⇒ Client
Returns a new instance of Client.
26 27 28 |
# File 'lib/autoexpreso.rb', line 26 def initialize(*args) @account = Hash.new end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
23 24 25 |
# File 'lib/autoexpreso.rb', line 23 def account @account end |
#jwt_header ⇒ Object
Returns the value of attribute jwt_header.
24 25 26 |
# File 'lib/autoexpreso.rb', line 24 def jwt_header @jwt_header end |
Instance Method Details
#account_details(json: false) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/autoexpreso.rb', line 35 def account_details(json: false) if json puts JSON.pretty_generate(account) else ap account end end |
#login(email, password) ⇒ Object
30 31 32 33 |
# File 'lib/autoexpreso.rb', line 30 def login(email, password) authenticate(email, password) account_summary end |