railsdav 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/railsdav/renderer.rb +20 -14
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b475da4632228e4346b209070174973dbca8a0f0
4
- data.tar.gz: 5e80237cc6e1116326cdc2752ddcace61a1f1e37
2
+ SHA256:
3
+ metadata.gz: b739b6628a685433663ac5c453adecc400414d4126bd2f83ed3c426f034e436a
4
+ data.tar.gz: a95878215c921f5bdb33afb5bdc94d3d1c4eb23fad8fa457d61453e6d38f9905
5
5
  SHA512:
6
- metadata.gz: 7010f93c8629d2bab98dec1d73ed11f2343751432490799184fc1eefaa4e2233ad3b3ba6574d6b340aa84683a2dce76599378163cbe7c20dc7618e9a952034de
7
- data.tar.gz: 3a07fcdec26c07546fe88d724e15286ce5ebd8190294283415f6ee25e14af53e54f91d117772035903c2ab168ee6a86b11df7504daa8eeb105a7f588c5fd4e1a
6
+ metadata.gz: c6f58077b65046cca72fb13ccacc457ff3669421086466055927308dc8268669f062df6da95e8f3fdc5d83502be12b1397f8dee036c8b1118f7b7601bb02d1b9
7
+ data.tar.gz: 7adcba76e2a4a34d72954d3f9661649c5807b3dd92904daf306422b259a9ad0228ff8740a24066427afccb2e6b3fb1976e98ea28a8f8992d865564207927fe88
@@ -137,14 +137,20 @@ module Railsdav
137
137
  elsif @controller.request.body.size > 0 # rails version without automatic XML body params parsing, so do it by hand here:
138
138
  @controller.request.body.rewind
139
139
  params.merge! Hash.from_xml(@controller.request.body.read)
140
+ end
141
+
142
+ params[:propfind] ||= {:prop => []}
143
+
144
+ if params[:propfind].respond_to? :to_unsafe_h
145
+ propfind_params = params[:propfind].to_unsafe_h
140
146
  else
141
- params[:propfind] ||= {:prop => []}
147
+ propfind_params = params[:propfind]
142
148
  end
143
149
 
144
- if params[:propfind].has_key? 'allprop'
150
+ if propfind_params.has_key? 'allprop'
145
151
  requested_properties = nil # fill it later, see below.
146
152
  else
147
- requested_properties = params[:propfind][:prop]
153
+ requested_properties = propfind_params[:prop]
148
154
  end
149
155
 
150
156
  resources.flatten.each do |resource|
@@ -205,14 +211,14 @@ module Railsdav
205
211
 
206
212
  Rails.logger.debug requested_properties.inspect
207
213
  requested_properties.each do |prop_name, opts|
208
- if prop_name.to_s.include?(":")
209
- # see first paragraph of big comment above
210
- Rails.logger.warn("DAV propfind prop request contains a namespace prefix; we do NOT handle these properly yet!")
214
+ if prop_name.to_s.include?(':')
215
+ # see first paragraph of long comment above
216
+ Rails.logger.warn 'DAV propfind prop request contains a namespace prefix; we do NOT handle these properly yet!'
211
217
  end
212
218
 
213
- if (!opts.nil?) and opts["xmlns"]
214
- gathered_namespaces["xmlns:lp#{@namespace_counter}"] = opts["xmlns"]
215
- opts.delete("xmlns")
219
+ if opts and opts['xmlns']
220
+ gathered_namespaces["xmlns:lp#{@namespace_counter}"] = opts['xmlns']
221
+ opts.delete 'xmlns'
216
222
  namespaced_requested_properties["lp#{@namespace_counter}:#{prop_name}"] = opts
217
223
  @namespace_counter +=1
218
224
  else
@@ -223,11 +229,11 @@ module Railsdav
223
229
  end
224
230
 
225
231
  response_for(resource.url) do |dav|
226
- dav.tag! "D:propstat", gathered_namespaces do
232
+ dav.tag! 'D:propstat', gathered_namespaces do
227
233
  status_for hash[:status]
228
- dav.tag! "D:prop" do
234
+ dav.tag! 'D:prop' do
229
235
  namespaced_requested_properties.each do |both_prop_name, opts|
230
- prop_space_and_name_pair = both_prop_name.split(":")
236
+ prop_space_and_name_pair = both_prop_name.split(':')
231
237
  prop_name = prop_space_and_name_pair[1] || prop_space_and_name_pair[0]
232
238
  if prop_val = response_hash[prop_name.to_sym]
233
239
  if prop_val.respond_to? :call
@@ -252,8 +258,8 @@ module Railsdav
252
258
  end # def propstat_for
253
259
 
254
260
  def response_for(href)
255
- @dav.tag! "D:response" do
256
- @dav.tag! "D:href", href
261
+ @dav.tag! 'D:response' do
262
+ @dav.tag! 'D:href', href
257
263
  yield @dav
258
264
  end
259
265
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsdav
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Kerkhof
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-13 00:00:00.000000000 Z
11
+ date: 2018-10-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides basic Rails 3/4/5 extensions for making your business resources
14
14
  accessible via WebDAV. This gem does by no means by no means implement the full
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  version: '0'
50
50
  requirements: []
51
51
  rubyforge_project:
52
- rubygems_version: 2.5.2.1
52
+ rubygems_version: 2.7.7
53
53
  signing_key:
54
54
  specification_version: 4
55
55
  summary: Make your Rails 3/4/5 resources accessible via WebDAV