Class: Webull::Tokens

Inherits:
Object
  • Object
show all
Defined in:
lib/webull/authenticator.rb

Overview

Tokens object describes a full set of API tokens

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Tokens

Returns a new instance of Tokens.



11
12
13
14
# File 'lib/webull/authenticator.rb', line 11

def initialize(params = {})
  @access = params[:access]
  @refresh = params[:refresh]
end

Instance Attribute Details

#accessObject (readonly)

Returns the value of attribute access.



9
10
11
# File 'lib/webull/authenticator.rb', line 9

def access
  @access
end

#refreshObject (readonly)

Returns the value of attribute refresh.



9
10
11
# File 'lib/webull/authenticator.rb', line 9

def refresh
  @refresh
end

Class Method Details

.from_resp(resp) ⇒ Object



16
17
18
19
20
21
# File 'lib/webull/authenticator.rb', line 16

def self.from_resp(resp)
  Tokens.new(
    access: resp['accessToken'],
    refresh: resp['refreshToken']
  )
end