Class: SabredavClient::Request
- Inherits:
-
Object
- Object
- SabredavClient::Request
- Defined in:
- lib/sabredav_client/request.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#path ⇒ Object
Returns the value of attribute path.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #add_body(body) ⇒ Object
- #add_header(data) ⇒ Object
-
#initialize(method, client, path) ⇒ Request
constructor
A new instance of Request.
- #run ⇒ Object
Constructor Details
#initialize(method, client, path) ⇒ Request
Returns a new instance of Request.
6 7 8 9 10 11 12 13 |
# File 'lib/sabredav_client/request.rb', line 6 def initialize(method, client, path) @client = client @path = "#{client.base_path}/#{path}" @http = build_http @request = build_request(method) add_auth end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/sabredav_client/request.rb', line 4 def client @client end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
4 5 6 |
# File 'lib/sabredav_client/request.rb', line 4 def http @http end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/sabredav_client/request.rb', line 3 def path @path end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
4 5 6 |
# File 'lib/sabredav_client/request.rb', line 4 def request @request end |
Instance Method Details
#add_body(body) ⇒ Object
15 16 17 |
# File 'lib/sabredav_client/request.rb', line 15 def add_body(body) request.body = body end |
#add_header(data) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/sabredav_client/request.rb', line 19 def add_header(data) request['Content-Length'] = data[:content_length] if data[:content_length] request['If-Match'] = data[:if_match] if data[:if_match] request['Content-Type'] = data[:content_type] if data[:content_type] request['DAV'] = data[:dav] if data[:dav] end |
#run ⇒ Object
26 27 28 |
# File 'lib/sabredav_client/request.rb', line 26 def run @http.request(request) end |