Class: ResponseMate::Recorder

Inherits:
Object
  • Object
show all
Defined in:
lib/response_mate/recorder.rb

Overview

Handles recording requests

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Recorder

Returns a new instance of Recorder.



6
7
8
9
10
# File 'lib/response_mate/recorder.rb', line 6

def initialize(args = {})
  @manifest = args[:manifest]
  @conn = ResponseMate::Connection.new
  @output_dir = args[:output_dir]
end

Instance Attribute Details

#connObject

Returns the value of attribute conn.



4
5
6
# File 'lib/response_mate/recorder.rb', line 4

def conn
  @conn
end

#keysObject

Returns the value of attribute keys.



4
5
6
# File 'lib/response_mate/recorder.rb', line 4

def keys
  @keys
end

#manifestObject

Returns the value of attribute manifest.



4
5
6
# File 'lib/response_mate/recorder.rb', line 4

def manifest
  @manifest
end

#output_dirObject

Returns the value of attribute output_dir.



4
5
6
# File 'lib/response_mate/recorder.rb', line 4

def output_dir
  @output_dir
end

Instance Method Details

#record(keys) ⇒ Object



12
13
14
15
16
# File 'lib/response_mate/recorder.rb', line 12

def record(keys)
  requests = keys.empty? ? manifest.requests : manifest.requests_for_keys(keys)

  requests.each { |request| process request }
end