Class: Finlight::Client
- Inherits:
-
Object
- Object
- Finlight::Client
- Defined in:
- lib/finlight/client.rb,
lib/finlight/client/version.rb
Overview
Entry point to the finlight API.
Constant Summary collapse
- VERSION =
"0.1.0"- CLIENT_VERSION =
Identifier sent as User-Agent (REST) and x-client-version (WebSocket).
"ruby/finlight-client@#{VERSION}".freeze
Instance Attribute Summary collapse
-
#articles ⇒ Object
readonly
Returns the value of attribute articles.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
-
#initialize(api_key:, logger: Logging.default) ⇒ Client
constructor
Remaining keywords (+base_url:+,
wss_url:,timeout:in seconds,retry_count:) are forwarded to Config. -
#raw_websocket ⇒ RawArticleWebSocketClient
A streaming client for raw articles (minimal latency, no enrichment).
-
#websocket ⇒ ArticleWebSocketClient
A streaming client for enriched articles — see BaseWebSocketClient#connect for options and usage.
Constructor Details
#initialize(api_key:, logger: Logging.default) ⇒ Client
Remaining keywords (+base_url:+, wss_url:, timeout: in seconds,
retry_count:) are forwarded to Finlight::Config.
32 33 34 35 36 37 38 |
# File 'lib/finlight/client.rb', line 32 def initialize(api_key:, logger: Logging.default, **) @config = Config.new(api_key: api_key, **) @logger = logger api_client = ApiClient.new(@config, logger: logger) @articles = ArticleService.new(api_client) @sources = SourceService.new(api_client) end |
Instance Attribute Details
#articles ⇒ Object (readonly)
Returns the value of attribute articles.
26 27 28 |
# File 'lib/finlight/client.rb', line 26 def articles @articles end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
26 27 28 |
# File 'lib/finlight/client.rb', line 26 def config @config end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
26 27 28 |
# File 'lib/finlight/client.rb', line 26 def sources @sources end |
Instance Method Details
#raw_websocket ⇒ RawArticleWebSocketClient
A streaming client for raw articles (minimal latency, no enrichment).
51 52 53 |
# File 'lib/finlight/client.rb', line 51 def raw_websocket(**) RawArticleWebSocketClient.new(@config, logger: @logger, **) end |
#websocket ⇒ ArticleWebSocketClient
A streaming client for enriched articles — see BaseWebSocketClient#connect for options and usage.
44 45 46 |
# File 'lib/finlight/client.rb', line 44 def websocket(**) ArticleWebSocketClient.new(@config, logger: @logger, **) end |