Class: Finlight::Config
- Inherits:
-
Object
- Object
- Finlight::Config
- Defined in:
- lib/finlight/config.rb
Overview
Connection settings shared by the REST and WebSocket clients.
Constant Summary collapse
- DEFAULT_BASE_URL =
"https://api.finlight.me"- DEFAULT_WSS_URL =
"wss://wss.finlight.me"- DEFAULT_TIMEOUT =
5- DEFAULT_RETRY_COUNT =
3
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#retry_count ⇒ Object
readonly
Returns the value of attribute retry_count.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#wss_url ⇒ Object
readonly
Returns the value of attribute wss_url.
Instance Method Summary collapse
-
#initialize(api_key:, base_url: DEFAULT_BASE_URL, wss_url: DEFAULT_WSS_URL, timeout: DEFAULT_TIMEOUT, retry_count: DEFAULT_RETRY_COUNT) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(api_key:, base_url: DEFAULT_BASE_URL, wss_url: DEFAULT_WSS_URL, timeout: DEFAULT_TIMEOUT, retry_count: DEFAULT_RETRY_COUNT) ⇒ Config
Returns a new instance of Config.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/finlight/config.rb', line 18 def initialize(api_key:, base_url: DEFAULT_BASE_URL, wss_url: DEFAULT_WSS_URL, timeout: DEFAULT_TIMEOUT, retry_count: DEFAULT_RETRY_COUNT) raise ArgumentError, "api_key is required" if api_key.nil? || api_key.to_s.empty? @api_key = api_key @base_url = base_url.chomp("/") @wss_url = wss_url.chomp("/") @timeout = timeout @retry_count = retry_count end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/finlight/config.rb', line 11 def api_key @api_key end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
11 12 13 |
# File 'lib/finlight/config.rb', line 11 def base_url @base_url end |
#retry_count ⇒ Object (readonly)
Returns the value of attribute retry_count.
11 12 13 |
# File 'lib/finlight/config.rb', line 11 def retry_count @retry_count end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
11 12 13 |
# File 'lib/finlight/config.rb', line 11 def timeout @timeout end |
#wss_url ⇒ Object (readonly)
Returns the value of attribute wss_url.
11 12 13 |
# File 'lib/finlight/config.rb', line 11 def wss_url @wss_url end |