Class: Centrifuge::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/centrifuge/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, verb, uri, params, body = nil, head = {}) ⇒ Request

Returns a new instance of Request.



7
8
9
10
# File 'lib/centrifuge/request.rb', line 7

def initialize(client, verb, uri, params, body = nil, head = {})
  @client, @verb, @uri, @params, @body = client, verb, uri, params, body
  @head = head
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'lib/centrifuge/request.rb', line 5

def body
  @body
end

#clientObject

Returns the value of attribute client.



5
6
7
# File 'lib/centrifuge/request.rb', line 5

def client
  @client
end

#headObject

Returns the value of attribute head.



5
6
7
# File 'lib/centrifuge/request.rb', line 5

def head
  @head
end

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'lib/centrifuge/request.rb', line 5

def params
  @params
end

#uriObject

Returns the value of attribute uri.



5
6
7
# File 'lib/centrifuge/request.rb', line 5

def uri
  @uri
end

#verbObject

Returns the value of attribute verb.



5
6
7
# File 'lib/centrifuge/request.rb', line 5

def verb
  @verb
end

Instance Method Details

#sendObject



12
13
14
15
16
# File 'lib/centrifuge/request.rb', line 12

def send
  response = request_or_rescue
  body = response.body ? response.body.chomp : nil
  handle_response(response.code.to_i, body)
end