Add WebDavRequest
This commit is contained in:
8
lib/calligraphy.rb
Normal file
8
lib/calligraphy.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
require 'calligraphy/web_dav_request'
|
||||
|
||||
require 'calligraphy/xml/builder'
|
||||
require 'calligraphy/xml/namespace'
|
||||
require 'calligraphy/xml/node'
|
||||
|
||||
module Calligraphy
|
||||
end
|
||||
31
lib/calligraphy/web_dav_request.rb
Normal file
31
lib/calligraphy/web_dav_request.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user