Class: Fitting::Records::Tested::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/fitting/records/tested/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(response, example) ⇒ Request

Returns a new instance of Request.



9
10
11
12
# File 'lib/fitting/records/tested/request.rb', line 9

def initialize(response, example)
  @example = example
  @response = response
end

Instance Method Details

#bodyObject



26
27
28
# File 'lib/fitting/records/tested/request.rb', line 26

def body
  @body ||= @response.request.request_parameters
end

#fitting_responseObject



30
31
32
# File 'lib/fitting/records/tested/request.rb', line 30

def fitting_response
  @fitting_response ||= Fitting::Records::Tested::Response.new(@response)
end

#hostObject



14
15
16
# File 'lib/fitting/records/tested/request.rb', line 14

def host
  @host ||= @response.request.host
end

#methodObject



18
19
20
# File 'lib/fitting/records/tested/request.rb', line 18

def method
  @method ||= @response.request.request_method
end

#pathObject



22
23
24
# File 'lib/fitting/records/tested/request.rb', line 22

def path
  @path ||= Tomograph::Path.new(@response.request.fullpath)
end

#test_file_pathObject



38
39
40
# File 'lib/fitting/records/tested/request.rb', line 38

def test_file_path
  @test_file_path ||= @example.file_path
end

#test_pathObject



34
35
36
# File 'lib/fitting/records/tested/request.rb', line 34

def test_path
  @test_path ||= @example.location
end

#to_sphericalObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fitting/records/tested/request.rb', line 42

def to_spherical
  Fitting::Records::Spherical::Request.new(
    method: method,
    path: path,
    body: body,
    response: fitting_response.to_spherical,
    title: test_path,
    group: test_file_path,
    host: host
  )
end