Class: Callapi::Call::Request::Mock

Inherits:
Base
  • Object
show all
Defined in:
lib/callapi/call/request/mock.rb

Constant Summary collapse

MOCK_FORMAT =

TODO: should not be hardcoded

'.json'

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Callapi::Call::Request::Base

Instance Method Details

#bodyObject



13
14
15
16
17
# File 'lib/callapi/call/request/mock.rb', line 13

def body
  File.read(file_path)  # add #with_logging
rescue Errno::ENOENT
  raise Callapi::CouldNotFoundMockRequestFileError.new(file_path)
end

#codeObject



9
10
11
# File 'lib/callapi/call/request/mock.rb', line 9

def code
  '200'
end

#responseObject



5
6
7
# File 'lib/callapi/call/request/mock.rb', line 5

def response
  OpenStruct.new(body: body, code: code)
end