Class: Finlight::SourceService

Inherits:
Object
  • Object
show all
Defined in:
lib/finlight/source_service.rb

Overview

Lists the news sources available through the API.

Instance Method Summary collapse

Constructor Details

#initialize(api_client) ⇒ SourceService

Returns a new instance of SourceService.



6
7
8
# File 'lib/finlight/source_service.rb', line 6

def initialize(api_client)
  @api_client = api_client
end

Instance Method Details

#get_sourcesArray<Source>

Returns all available news sources.

Returns:

  • (Array<Source>)

    all available news sources

Raises:

  • (ApiError)

    if the API request fails



12
13
14
# File 'lib/finlight/source_service.rb', line 12

def get_sources # rubocop:disable Naming/AccessorMethodName -- mirrors the sibling clients' API
  @api_client.get("/v2/sources").map { |s| Source.from_h(s) }
end