module Reuters::Credentials
The {Credentials} module handles storing the configured credentials for the {Reuters} gem.
@example Configuring credentials.
Reuters.configure do |config| config.credentials do |login| # Set username login.username = "my_username" # Set my password login.password = "my_super_secret_password" # Set application ID login.application_id = "application_id" end end
Public Class Methods
Enables credentials to be configured by passing in itself as a block which enables static variables to be set.
@yield [config] The credentials to be configured.
# File lib/reuters/credentials.rb, line 73 def self.configure yield self end
Yields the configured credentials to connect to the Reuter’s API with.
@yield [username, password, app_id] Yields authentication information.
@yieldparam [String, Nil] username configured, or nil if one is not set. @yieldparam [String, Nil] password configured, or nil if one is not set. @yieldparam [String, Nil] app_id configured, or nil if one is not set.
# File lib/reuters/credentials.rb, line 57 def self.details yield @@username, @@password, @@app_id end
Returns credentials that have been configured as a Hash.
@return [Hash] the credentials that have been configured.
# File lib/reuters/credentials.rb, line 64 def self.to_h { username: username, password: password, app_id: app_id } end