Class: Adyen::API::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/adyen/api.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_response) ⇒ Response

Returns a new instance of Response.



108
109
110
# File 'lib/adyen/api.rb', line 108

def initialize(http_response)
  @http_response = http_response
end

Instance Attribute Details

#http_responseObject (readonly)

Returns the value of attribute http_response.



106
107
108
# File 'lib/adyen/api.rb', line 106

def http_response
  @http_response
end

Class Method Details

.response_attrs(*attrs) ⇒ Object



100
101
102
103
104
# File 'lib/adyen/api.rb', line 100

def self.response_attrs(*attrs)
  attrs.each do |attr|
    define_method(attr) { params[attr] }
  end
end

Instance Method Details

#http_failure?Boolean

Returns Whether or not the HTTP request was a success.

Returns:

  • (Boolean)

    Whether or not the HTTP request was a success.



118
119
120
# File 'lib/adyen/api.rb', line 118

def http_failure?
  !@http_response.is_a?(Net::HTTPSuccess)
end

#paramsObject



126
127
128
# File 'lib/adyen/api.rb', line 126

def params
  raise "The Adyen::API::Response#params method should be overriden in a subclass."
end

#success?Boolean

Returns Whether or not the request was successful.

Returns:

  • (Boolean)

    Whether or not the request was successful.



113
114
115
# File 'lib/adyen/api.rb', line 113

def success?
  !http_failure?
end

#xml_querierObject



122
123
124
# File 'lib/adyen/api.rb', line 122

def xml_querier
  @xml_querier ||= XMLQuerier.new(@http_response.body)
end