Class: MachineGun::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/machine-gun/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, url, headers, payload = nil) ⇒ Request

Returns a new instance of Request.



9
10
11
12
# File 'lib/machine-gun/request.rb', line 9

def initialize(method, url, headers, payload=nil)
  @id = Commands.request(method, url, headers, payload)
  @method = method
end

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



6
7
8
# File 'lib/machine-gun/request.rb', line 6

def headers
  @headers
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/machine-gun/request.rb', line 3

def id
  @id
end

#methodObject

Returns the value of attribute method.



4
5
6
# File 'lib/machine-gun/request.rb', line 4

def method
  @method
end

#payloadObject

Returns the value of attribute payload.



7
8
9
# File 'lib/machine-gun/request.rb', line 7

def payload
  @payload
end

#urlObject

Returns the value of attribute url.



5
6
7
# File 'lib/machine-gun/request.rb', line 5

def url
  @url
end

Instance Method Details

#responseObject



14
15
16
# File 'lib/machine-gun/request.rb', line 14

def response
  Response.new(@id)
end