Class: Dialers::MockedResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/dialers/mockable_caller.rb

Instance Method Summary collapse

Constructor Details

#initialize(http_method: nil, url: "", params: {}, headers: {}, routes_definition: nil) ⇒ MockedResponse

Returns a new instance of MockedResponse.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/dialers/mockable_caller.rb', line 59

def initialize(http_method: nil, url: "", params: {}, headers: {}, routes_definition: nil)
  self.http_method = http_method
  self.url = url
  self.params = params
  self.headers = headers
  self.route = routes_definition.get_route(http_method, url)

  if route.nil?
    fail "Route is not defined for: #{http_method} to #{url}."
  end
end

Instance Method Details

#bodyObject



75
76
77
# File 'lib/dialers/mockable_caller.rb', line 75

def body
  route[:body]
end

#statusObject



71
72
73
# File 'lib/dialers/mockable_caller.rb', line 71

def status
  route[:status]
end