Class: DeployGate::API::V1::Session
- Inherits:
-
Object
- Object
- DeployGate::API::V1::Session
- Defined in:
- lib/deploygate/api/v1/session.rb
Constant Summary collapse
- ENDPOINT =
'/sessions'
Class Method Summary collapse
Class Method Details
.check(name, token) ⇒ Boolean
21 22 23 24 25 26 |
# File 'lib/deploygate/api/v1/session.rb', line 21 def check(name, token) results = show(token) return false if results.nil? name == results['name'] end |
.login(email, password) ⇒ Hash
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/deploygate/api/v1/session.rb', line 31 def login(email, password) res = Base.new().post(ENDPOINT, {:email => email, :password => password}) login_results = { :error => res['error'], :message => res['because'] } results = res['results'] unless results.nil? login_results.merge!({ :name => results['name'], :token => results['api_token'] }) end login_results end |