Class: TresDelta::Response

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



5
6
7
# File 'lib/tres_delta/response.rb', line 5

def initialize(response)
  @response = response
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



13
14
15
# File 'lib/tres_delta/response.rb', line 13

def method_missing(method, *args)
  @response[method]
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/tres_delta/response.rb', line 3

def response
  @response
end

Class Method Details

.create_from_action(action, response) ⇒ Object



17
18
19
# File 'lib/tres_delta/response.rb', line 17

def self.create_from_action(action, response)
  self.new(response.body["#{action}_response".to_sym]["#{action}_result".to_sym])
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/tres_delta/response.rb', line 9

def success?
  @response[:succeeded]
end