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

Attributes inherited from Sappy::Response

#data, #xml

Instance Method Summary collapse

Methods inherited from Sappy::Response

#error_response, #error_response?, #first_xpath, #initialize, parse, #parse

Constructor Details

This class inherits a constructor from Sappy::Response

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



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

def key
  @key
end

Instance Method Details

#failure(code, message) ⇒ Object



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

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

#successObject



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

def success
  node = first_xpath('//session')
  @key = node && node["key"]
end