class RailFeeds::Credentials
A Class to store username & password Can be used to set a global default but create new instances with specific ones for a specific use.
Attributes
password[R]
@!attribute [r] username
@return [String] The username to use for authentication.
@!attribute [r] password
@return [String] The password to use for authentication.
username[R]
@!attribute [r] username
@return [String] The username to use for authentication.
@!attribute [r] password
@return [String] The password to use for authentication.
Public Class Methods
configure(username:, password:)
click to toggle source
Configure default credentials. @param [String] username
The username to use for authentication.
@param [String] password
The password to use for authentication.
# File lib/rail_feeds/credentials.rb, line 22 def self.configure(username:, password:) @username = username.to_s.clone.freeze @password = password.to_s.clone.freeze nil end
new( username: self.class.username, password: self.class.password )
click to toggle source
Initialize a new cresential.
# File lib/rail_feeds/credentials.rb, line 29 def initialize( username: self.class.username, password: self.class.password ) @username = username.to_s.clone @password = password.to_s.clone end
password()
click to toggle source
# File lib/rail_feeds/credentials.rb, line 71 def self.password @password.clone end
to_a()
click to toggle source
Get an array of [username, password]. @return [Array<String>]
# File lib/rail_feeds/credentials.rb, line 54 def self.to_a [username, password] end
to_h()
click to toggle source
Get a hash of { username: ?, password: ? }. @return [Hash<Symbol => String>]
# File lib/rail_feeds/credentials.rb, line 60 def self.to_h { username: username, password: password } end
username()
click to toggle source
# File lib/rail_feeds/credentials.rb, line 67 def self.username @username.clone end
Public Instance Methods
to_a()
click to toggle source
Get an array of [username, password]. @return [Array<String>]
# File lib/rail_feeds/credentials.rb, line 39 def to_a [username, password] end
to_h()
click to toggle source
Get a hash of { username: ?, password: ? }. @return [Hash<Symbol => String>]
# File lib/rail_feeds/credentials.rb, line 45 def to_h { username: username, password: password } end