class Flutterwave::Response

Attributes

response[RW]

Public Class Methods

new(response) click to toggle source
# File lib/flutterwave/response.rb, line 5
def initialize(response)
  @response = response ? OpenStruct.new(response['data']) : OpenStruct.new({})
end

Public Instance Methods

failed?() click to toggle source
# File lib/flutterwave/response.rb, line 13
def failed?
  !successful?
end
method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/flutterwave/response.rb, line 17
def method_missing(method_name, *args)
  return response.send(method_name, *args) if response.respond_to?(method_name)
  super
end
successful?() click to toggle source
# File lib/flutterwave/response.rb, line 9
def successful?
  (try('responseCode') || try('responsecode')) == '00'
end
try(method_name) click to toggle source
# File lib/flutterwave/response.rb, line 22
def try(method_name)
  instance_eval method_name
rescue NameError
  nil
end