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.



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

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



39
40
41
42
43
44
45
# File 'lib/dwolla_v2/response.rb', line 39

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



35
36
37
# File 'lib/dwolla_v2/response.rb', line 35

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

#inspectObject



47
48
49
50
51
52
53
# File 'lib/dwolla_v2/response.rb', line 47

def inspect
  Util.pretty_inspect(
    self.class.name,
    { response_status: response_status, response_headers: response_headers },
    response_body
  )
end

#is_a?(klass) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#kind_of?(klass) ⇒ Boolean

Returns:

  • (Boolean)


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

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

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

Returns:

  • (Boolean)


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

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

#response_headersObject



15
16
17
18
19
20
21
# File 'lib/dwolla_v2/response.rb', line 15

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

#response_statusObject



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

def response_status
  @response.status
end