Class: HttpConnect::HttpRequest
- Inherits:
-
Object
- Object
- HttpConnect::HttpRequest
- Defined in:
- lib/http_connect/http_request.rb
Overview
HttpRequest class
Direct Known Subclasses
Instance Attribute Summary collapse
-
#accept ⇒ Object
readonly
accept header for the response.
-
#content ⇒ Object
readonly
payload.
-
#content_type ⇒ Object
readonly
content type.
-
#http_method ⇒ Object
readonly
http verb.
-
#path ⇒ Object
readonly
resource path.
Instance Method Summary collapse
-
#initialize(path, method, content_type = 'application/json', accept = 'application/json', content = {}) ⇒ HttpRequest
constructor
initialize().
Constructor Details
#initialize(path, method, content_type = 'application/json', accept = 'application/json', content = {}) ⇒ HttpRequest
initialize()
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/http_connect/http_request.rb', line 11 def initialize(path, method, content_type = 'application/json', accept = 'application/json', content = {}) @path = path @http_method = method @accept = accept @content = content @content_type = content_type @path << "? #{URI.encode_www_form(@content)}" if %w[GET DELETE].include? @http_method end |
Instance Attribute Details
#accept ⇒ Object (readonly)
accept header for the response
6 7 8 |
# File 'lib/http_connect/http_request.rb', line 6 def accept @accept end |
#content ⇒ Object (readonly)
payload
7 8 9 |
# File 'lib/http_connect/http_request.rb', line 7 def content @content end |
#content_type ⇒ Object (readonly)
content type
8 9 10 |
# File 'lib/http_connect/http_request.rb', line 8 def content_type @content_type end |
#http_method ⇒ Object (readonly)
http verb
5 6 7 |
# File 'lib/http_connect/http_request.rb', line 5 def http_method @http_method end |
#path ⇒ Object (readonly)
resource path
4 5 6 |
# File 'lib/http_connect/http_request.rb', line 4 def path @path end |