From e64cb55c5d120686da1741835279128729b8cb79 Mon Sep 17 00:00:00 2001 From: Brandon Robins Date: Sun, 22 Oct 2017 23:25:25 -0500 Subject: [PATCH] Add WebDavRequest --- lib/calligraphy.rb | 8 ++++++++ lib/calligraphy/web_dav_request.rb | 31 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 lib/calligraphy.rb create mode 100644 lib/calligraphy/web_dav_request.rb diff --git a/lib/calligraphy.rb b/lib/calligraphy.rb new file mode 100644 index 0000000..cd8fa1c --- /dev/null +++ b/lib/calligraphy.rb @@ -0,0 +1,8 @@ +require 'calligraphy/web_dav_request' + +require 'calligraphy/xml/builder' +require 'calligraphy/xml/namespace' +require 'calligraphy/xml/node' + +module Calligraphy +end diff --git a/lib/calligraphy/web_dav_request.rb b/lib/calligraphy/web_dav_request.rb new file mode 100644 index 0000000..887cda9 --- /dev/null +++ b/lib/calligraphy/web_dav_request.rb @@ -0,0 +1,31 @@ +module Calligraphy + class WebDavRequest + attr_accessor :resource, :response + attr_reader :headers, :request + + def initialize(headers:, request:, response:, resource:) + @headers = headers + @request = request + @response = response + @resource = resource + end + + def request + raise NotImplemented + end + + private + + def body + @resource.request_body + end + + def set_xml_content_type + @response.content_type = 'application/xml' + end + + def xml_builder + Calligraphy::XML::Builder.new server_protocol: @request.env['SERVER_PROTOCOL'] + end + end +end