Class: Sappy::Responses::Auth

Inherits:
Sappy::Response show all
Defined in:
lib/sappy/responses/auth.rb

Defined Under Namespace

Classes: LoginFailed

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Sappy::Response

#initialize, parse, #parse

Constructor Details

This class inherits a constructor from Sappy::Response

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



6
7
8
# File 'lib/sappy/responses/auth.rb', line 6

def key
  @key
end

Instance Method Details

#failure(code, message) ⇒ Object



11
12
13
14
15
16
# File 'lib/sappy/responses/auth.rb', line 11

def failure(code, message)
  case code
  when "WRONG_DATA"
    raise LoginFailed, message
  end
end

#success(hash) ⇒ Object



7
8
9
# File 'lib/sappy/responses/auth.rb', line 7

def success(hash)
  @key = hash["session"].first["key"]
end