Class: DeployGate::Session
- Inherits:
-
Object
- Object
- DeployGate::Session
- Defined in:
- lib/deploygate/session.rb
Defined Under Namespace
Modules: ENVKey Classes: LoginError
Constant Summary collapse
- @@login =
nil
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
Constructor Details
#initialize ⇒ DeployGate::Session
16 17 18 |
# File 'lib/deploygate/session.rb', line 16 def initialize load_setting end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/deploygate/session.rb', line 6 def name @name end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
6 7 8 |
# File 'lib/deploygate/session.rb', line 6 def token @token end |
Class Method Details
.delete ⇒ void
This method returns an undefined value.
54 55 56 57 |
# File 'lib/deploygate/session.rb', line 54 def self.delete save('', '') # delete config values @@login = false end |
.login(email, password) ⇒ void
This method returns an undefined value.
32 33 34 35 36 37 38 39 40 |
# File 'lib/deploygate/session.rb', line 32 def self.login(email, password) data = API::V1::Session.login(email, password) raise LoginError, data[:message] if data[:error] name = data[:name] token = data[:token] save(name, token) @@login = true end |
.save(name, token) ⇒ void
This method returns an undefined value.
45 46 47 48 49 50 51 |
# File 'lib/deploygate/session.rb', line 45 def self.save(name, token) settings = { :name => name, :token => token } Config::Credential.write(settings) end |