Class: DwollaV2::Response

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/dwolla_v2/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



8
9
10
# File 'lib/dwolla_v2/response.rb', line 8

def initialize response
  @response = response
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/dwolla_v2/response.rb', line 36

def method_missing method, *args, &block
  if response_body.respond_to? method
    response_body.public_send method, *args, &block
  else
    super
  end
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
# File 'lib/dwolla_v2/response.rb', line 32

def == other
  super || response_body == other
end

#headersObject



12
13
14
15
16
17
18
# File 'lib/dwolla_v2/response.rb', line 12

def headers
  if @response.respond_to? :response_headers
    @response.response_headers
  elsif @response.respond_to? :headers
    @response.headers
  end
end

#inspectObject



44
45
46
# File 'lib/dwolla_v2/response.rb', line 44

def inspect
  Util.pretty_inspect self.class.name, { status: status, headers: headers }, response_body
end

#is_a?(klass) ⇒ Boolean

Returns:

  • (Boolean)


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

def is_a? klass
  super || response_body.is_a?(klass)
end

#kind_of?(klass) ⇒ Boolean

Returns:

  • (Boolean)


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

def kind_of? klass
  super || response_body.kind_of?(klass)
end

#respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/dwolla_v2/response.rb', line 20

def respond_to? method, include_private = false
  super || response_body.respond_to?(method)
end