Class: Toggl::Jobcan::Credentials
- Inherits:
-
Object
- Object
- Toggl::Jobcan::Credentials
- Defined in:
- lib/toggl/jobcan/credentials.rb
Overview
Jobcan credentials manager
Constant Summary collapse
- ATTRS =
%i[email password].freeze
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#password ⇒ Object
Returns the value of attribute password.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Credentials
constructor
A new instance of Credentials.
Constructor Details
#initialize(args) ⇒ Credentials
Returns a new instance of Credentials.
14 15 16 17 18 |
# File 'lib/toggl/jobcan/credentials.rb', line 14 def initialize(args) attr_set(args) if args.key?(:email) c = self.class.load_config(args[:path]) attr_set(c) end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
9 10 11 |
# File 'lib/toggl/jobcan/credentials.rb', line 9 def email @email end |
#password ⇒ Object
Returns the value of attribute password.
10 11 12 |
# File 'lib/toggl/jobcan/credentials.rb', line 10 def password @password end |
Class Method Details
.load_config(path) ⇒ Object
21 22 23 |
# File 'lib/toggl/jobcan/credentials.rb', line 21 def load_config(path) YAML.safe_load(File.open(path).read).transform_keys(&:to_sym) end |