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

Inherits:
Base
  • Object
show all
Extended by:
Memoist
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



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

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

#codeObject



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

def code
  '200'
end

#responseObject



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

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