Class: Seko::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/seko/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



6
7
8
9
# File 'lib/seko/response.rb', line 6

def initialize(response)
  @raw    = response
  @parsed = JSON.parse(response)
end

Instance Attribute Details

#parsedObject

Returns the value of attribute parsed.



4
5
6
# File 'lib/seko/response.rb', line 4

def parsed
  @parsed
end

#rawObject

Returns the value of attribute raw.



4
5
6
# File 'lib/seko/response.rb', line 4

def raw
  @raw
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/seko/response.rb', line 19

def failure?
  !success?
end

#guidObject



28
29
30
# File 'lib/seko/response.rb', line 28

def guid
  root_response["GUID"]
end

#messageObject



23
24
25
26
# File 'lib/seko/response.rb', line 23

def message
  message = root_response["CallStatus"]["Message"]
  message.empty? ? "" : message
end

#root_responseObject



11
12
13
# File 'lib/seko/response.rb', line 11

def root_response
  @parsed["Response"].nil? ? @parsed : @parsed["Response"]
end

#success?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/seko/response.rb', line 15

def success?
  root_response["CallStatus"]["Success"]
end