faraday-webdav 0.1.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +12 -0
- data/lib/faraday/webdav/connection_methods.rb +45 -0
- data/lib/faraday/webdav/version.rb +7 -0
- data/lib/faraday/webdav.rb +22 -0
- data/sig/faraday/webdav.rbs +26 -0
- metadata +87 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 0cfbdcfe6b8287960a01188af99ec4d10c8f70f720bd4ac67ba3a6e4c5860df8
|
|
4
|
+
data.tar.gz: 9a3dc26ed3fe11ae058fe2579d9d28776bafd5ce44174ce1fe796ed6123d9bb8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7012ac683dc11395bcd310d5f2dc07aa231544cb674774892ded3090ba279225dddce6919a4c0d1f9532c34c0144d527f6cc89fcf91025c60ff761bc4e4bbf84
|
|
7
|
+
data.tar.gz: a89a84b5bae852486ac23511c101be35f41dbd88d3bb6de09c0a4d3e42cf414ead57d57c3ff08feef6713700b18cf942f1b34b9f060387c62ea6217d376561b0
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Olejniczak Jeremi Jan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Faraday::Webdav
|
|
2
|
+
|
|
3
|
+
Adds WebDAV HTTP methods to [Faraday](https://github.com/lostisland/faraday) connections: `propfind`, `proppatch`, `mkcol`, `copy`, `move`, `lock`, `unlock`, `report`, and `search`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bundle add faraday-webdav
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
gem install faraday-webdav
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Requiring `faraday/webdav` adds the WebDAV methods to every `Faraday::Connection`:
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
require 'faraday/webdav'
|
|
25
|
+
|
|
26
|
+
connection = Faraday.new(url: 'https://example.com')
|
|
27
|
+
|
|
28
|
+
# PROPFIND / PROPPATCH / LOCK / REPORT / SEARCH take a request body
|
|
29
|
+
response = connection.propfind('/file', propfind_body, { 'Depth' => '0' })
|
|
30
|
+
|
|
31
|
+
# MKCOL / COPY / UNLOCK / MOVE take query params instead of a body
|
|
32
|
+
response = connection.copy('/container/', nil, { 'Destination' => 'https://example.com/other/' })
|
|
33
|
+
|
|
34
|
+
# all methods yield the request to a block, like Faraday's built-in verbs
|
|
35
|
+
response = connection.propfind('/file') do |req|
|
|
36
|
+
req.headers['Depth'] = '1'
|
|
37
|
+
end
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Development
|
|
41
|
+
|
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
43
|
+
|
|
44
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
45
|
+
|
|
46
|
+
## Contributing
|
|
47
|
+
|
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cub8/faraday-webdav.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faraday
|
|
4
|
+
module Webdav
|
|
5
|
+
module ConnectionMethods
|
|
6
|
+
METHODS_WITH_BODY = %i[
|
|
7
|
+
propfind
|
|
8
|
+
proppatch
|
|
9
|
+
lock
|
|
10
|
+
report
|
|
11
|
+
search
|
|
12
|
+
].freeze
|
|
13
|
+
|
|
14
|
+
METHODS_WITH_QUERY = %i[
|
|
15
|
+
mkcol
|
|
16
|
+
copy
|
|
17
|
+
unlock
|
|
18
|
+
move
|
|
19
|
+
].freeze
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
def included(base)
|
|
23
|
+
base::METHODS.merge(Faraday::Webdav::METHODS)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
METHODS_WITH_QUERY.each do |method|
|
|
28
|
+
define_method(method) do |url = nil, params = nil, headers = nil, &block|
|
|
29
|
+
run_request(method, url, nil, headers) do |request|
|
|
30
|
+
request.params.update(params) if params
|
|
31
|
+
block&.call(request)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
METHODS_WITH_BODY.each do |method|
|
|
37
|
+
define_method(method) do |url = nil, body = nil, headers = nil, &block|
|
|
38
|
+
run_request(method, url, body, headers, &block)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Faraday::Connection.include(Faraday::Webdav::ConnectionMethods)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'faraday'
|
|
4
|
+
require_relative 'webdav/version'
|
|
5
|
+
|
|
6
|
+
module Faraday
|
|
7
|
+
module Webdav
|
|
8
|
+
METHODS = %i[
|
|
9
|
+
copy
|
|
10
|
+
lock
|
|
11
|
+
mkcol
|
|
12
|
+
move
|
|
13
|
+
propfind
|
|
14
|
+
proppatch
|
|
15
|
+
unlock
|
|
16
|
+
report
|
|
17
|
+
search
|
|
18
|
+
].freeze
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
require_relative 'webdav/connection_methods'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Faraday
|
|
2
|
+
class Connection
|
|
3
|
+
def copy: (?String | URI url, ?untyped params, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
4
|
+
|
|
5
|
+
def move: (?String | URI url, ?untyped params, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
6
|
+
|
|
7
|
+
def mkcol: (?String | URI url, ?untyped params, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
8
|
+
|
|
9
|
+
def unlock: (?String | URI url, ?untyped params, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
10
|
+
|
|
11
|
+
def propfind: (?String | URI url, ?untyped body, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
12
|
+
|
|
13
|
+
def proppatch: (?String | URI url, ?untyped body, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
14
|
+
|
|
15
|
+
def lock: (?String | URI url, ?untyped body, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
16
|
+
|
|
17
|
+
def report: (?String | URI url, ?untyped body, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
18
|
+
|
|
19
|
+
def search: (?String | URI url, ?untyped body, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
module Webdav
|
|
23
|
+
VERSION: String
|
|
24
|
+
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
|
25
|
+
end
|
|
26
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: faraday-webdav
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Olejniczak Jeremi Jan
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: faraday
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.9'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '3'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '2.9'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '3'
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: faraday-net_http
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: 3.1.0
|
|
39
|
+
type: :runtime
|
|
40
|
+
prerelease: false
|
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: 3.1.0
|
|
46
|
+
description: Adds WebDAV HTTP methods (PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK,
|
|
47
|
+
UNLOCK, REPORT, SEARCH) to Faraday connections.
|
|
48
|
+
email:
|
|
49
|
+
- tsubait8@gmail.com
|
|
50
|
+
executables: []
|
|
51
|
+
extensions: []
|
|
52
|
+
extra_rdoc_files: []
|
|
53
|
+
files:
|
|
54
|
+
- CHANGELOG.md
|
|
55
|
+
- LICENSE.txt
|
|
56
|
+
- README.md
|
|
57
|
+
- Rakefile
|
|
58
|
+
- lib/faraday/webdav.rb
|
|
59
|
+
- lib/faraday/webdav/connection_methods.rb
|
|
60
|
+
- lib/faraday/webdav/version.rb
|
|
61
|
+
- sig/faraday/webdav.rbs
|
|
62
|
+
homepage: https://github.com/cub8/faraday-webdav
|
|
63
|
+
licenses:
|
|
64
|
+
- MIT
|
|
65
|
+
metadata:
|
|
66
|
+
homepage_uri: https://github.com/cub8/faraday-webdav
|
|
67
|
+
source_code_uri: https://github.com/cub8/faraday-webdav
|
|
68
|
+
changelog_uri: https://github.com/cub8/faraday-webdav/blob/main/CHANGELOG.md
|
|
69
|
+
rubygems_mfa_required: 'true'
|
|
70
|
+
rdoc_options: []
|
|
71
|
+
require_paths:
|
|
72
|
+
- lib
|
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: 3.3.0
|
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
requirements: []
|
|
84
|
+
rubygems_version: 4.0.1
|
|
85
|
+
specification_version: 4
|
|
86
|
+
summary: WebDAV support for Faraday.
|
|
87
|
+
test_files: []
|