Class: S3Multipart::Http
- Inherits:
-
Object
- Object
- S3Multipart::Http
- Defined in:
- lib/s3_multipart/http/net_http.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#response ⇒ Object
Returns the value of attribute response.
Class Method Summary collapse
- .get(path, options = {}) ⇒ Object
- .post(path, options = {}) ⇒ Object
- .put(path, options = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(method, path, options) ⇒ Http
constructor
A new instance of Http.
- #perform ⇒ Object
Constructor Details
#initialize(method, path, options) ⇒ Http
Returns a new instance of Http.
7 8 9 10 11 12 |
# File 'lib/s3_multipart/http/net_http.rb', line 7 def initialize(method, path, ) @method = method @path = path @headers = [:headers] @body = [:body] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/s3_multipart/http/net_http.rb', line 5 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/s3_multipart/http/net_http.rb', line 5 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
5 6 7 |
# File 'lib/s3_multipart/http/net_http.rb', line 5 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/s3_multipart/http/net_http.rb', line 5 def path @path end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/s3_multipart/http/net_http.rb', line 5 def response @response end |
Class Method Details
.get(path, options = {}) ⇒ Object
15 16 17 |
# File 'lib/s3_multipart/http/net_http.rb', line 15 def get(path, ={}) new(:get, path, ).perform end |
.post(path, options = {}) ⇒ Object
19 20 21 |
# File 'lib/s3_multipart/http/net_http.rb', line 19 def post(path, ={}) new(:post, path, ).perform end |
.put(path, options = {}) ⇒ Object
23 24 25 |
# File 'lib/s3_multipart/http/net_http.rb', line 23 def put(path, ={}) new(:put, path, ).perform end |
Instance Method Details
#perform ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/s3_multipart/http/net_http.rb', line 28 def perform request = request_class.new(path) headers.each do |key, val| request[key.to_s.split("_").map(&:capitalize).join("-")] = val end request.body = body if body @response = http.request(request) end |