rdf-hurley 0.0.1
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/AUTHORS +1 -0
- data/README.md +64 -0
- data/UNLICENSE +24 -0
- data/VERSION +1 -0
- data/lib/rdf/hurley.rb +7 -0
- data/lib/rdf/hurley/http_adapter.rb +48 -0
- data/lib/rdf/hurley/version.rb +18 -0
- data/spec/spec_helper.rb +2 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c05901c7dfab2a9d433a471c7c9e97cf97480407
|
4
|
+
data.tar.gz: f406303765492e42938b8a2047daa56e05da1c35
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a39042d06022d1190f5e08691d232ad97a77a2e6f76c11217443db82d5d1cb71af4fde8e90af83a4ef0117543265bcbd944b7167564575e4b8e1ab656f06071
|
7
|
+
data.tar.gz: 350d5b13d4b9743027b7b8cba8c8c6095f225f13b027ad9448797d705b8ee91aaf7f15941ee62e38e2cad0b3280d6d6c012cd26e9464b2127d73a30354480752
|
data/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* Chris Beer <chris@cbeer.info>
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Hurley HTTP Adapter for RDF.rb
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/rdf-hurley)
|
4
|
+
[](http://travis-ci.org/cbeer/rdf-hurley)
|
5
|
+
|
6
|
+
## Features
|
7
|
+
|
8
|
+
RDF::Hurley provides a Hurley HTTP adapter for RDF::Util::File to fetch remote resources using a Hurley client.
|
9
|
+
|
10
|
+
Install with `gem install rdf-hurley`
|
11
|
+
|
12
|
+
## Examples
|
13
|
+
|
14
|
+
require 'rubygems'
|
15
|
+
require 'rdf/hurley'
|
16
|
+
|
17
|
+
### Using the default settings
|
18
|
+
|
19
|
+
RDF::Util::File.http_adapter = RDF::Hurley::HttpAdapter
|
20
|
+
|
21
|
+
## Documentation
|
22
|
+
Full documentation available on [RubyDoc](http://rubydoc.info/gems/rdf-hurley/file/README.md)
|
23
|
+
|
24
|
+
### Principal Classes
|
25
|
+
* {RDF::Hurley}
|
26
|
+
* {RDF::Hurley::HttpAdapter}
|
27
|
+
|
28
|
+
## Dependencies
|
29
|
+
* [Ruby](http://ruby-lang.org/) (>= 1.9.3)
|
30
|
+
* [RDF.rb](http://rubygems.org/gems/rdf) (>= 1.0)
|
31
|
+
* [Hurley](https://rubygems.org/gems/hurley)
|
32
|
+
|
33
|
+
## Installation
|
34
|
+
The recommended installation method is via [RubyGems](http://rubygems.org/).
|
35
|
+
To install the latest official release of the `RDF::Hurley` gem, do:
|
36
|
+
|
37
|
+
% [sudo] gem install rdf-hurley
|
38
|
+
|
39
|
+
## Mailing List
|
40
|
+
* <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
|
41
|
+
|
42
|
+
## Author
|
43
|
+
* [Chris Beer](http://github.com/cbeer)
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
* Do your best to adhere to the existing coding conventions and idioms.
|
47
|
+
* Don't use hard tabs, and don't leave trailing whitespace on any line.
|
48
|
+
* Do document every method you add using [YARD][] annotations. Read the
|
49
|
+
[tutorial][YARD-GS] or just look at the existing code for examples.
|
50
|
+
* Don't touch the `rdf-hurley.gemspec`, `VERSION` or `AUTHORS` files. If you need to change them, do so on your private branch only.
|
51
|
+
* Do feel free to add yourself to the `CREDITS` file and the corresponding list in the the `README`. Alphabetical order applies.
|
52
|
+
* Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an explicit [public domain dedication][PDD] on record from you.
|
53
|
+
|
54
|
+
License
|
55
|
+
-------
|
56
|
+
|
57
|
+
This is free and unencumbered public domain software. For more information,
|
58
|
+
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
59
|
+
|
60
|
+
[Ruby]: http://ruby-lang.org/
|
61
|
+
[YARD]: http://yardoc.org/
|
62
|
+
[YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
63
|
+
[PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
|
64
|
+
[RDF.rb]: http://rubygems.org/gems/rdf
|
data/UNLICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
4
|
+
distribute this software, either in source code form or as a compiled
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
6
|
+
means.
|
7
|
+
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
9
|
+
of this software dedicate any and all copyright interest in the
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
11
|
+
of the public at large and to the detriment of our heirs and
|
12
|
+
successors. We intend this dedication to be an overt act of
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
14
|
+
software under copyright law.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
For more information, please refer to <http://unlicense.org/>
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/lib/rdf/hurley.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module RDF; module Hurley
|
2
|
+
##
|
3
|
+
# Use Hurley for retrieving resources
|
4
|
+
class HttpAdapter < RDF::Util::File::HttpAdapter
|
5
|
+
require 'hurley'
|
6
|
+
|
7
|
+
class <<self
|
8
|
+
##
|
9
|
+
# Set the Hurley::Client to use for retrieving RDF resources
|
10
|
+
attr_writer :client
|
11
|
+
|
12
|
+
##
|
13
|
+
# Get the Hurley::Client to use for retrieving RDF resources,
|
14
|
+
# or a default connect that follows redirects.
|
15
|
+
def client
|
16
|
+
@client ||= ::Hurley::Client.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# @see HttpAdapter.open_url
|
21
|
+
# @param [String] base_uri to open
|
22
|
+
# @param [Hash{Symbol => Object}] options
|
23
|
+
# @return [RemoteDocument, Object] A {RemoteDocument}.
|
24
|
+
def self.open_url(base_uri, options)
|
25
|
+
response = client.get(base_uri) do |req|
|
26
|
+
headers(options).each do |k, v|
|
27
|
+
req.header[k] = v
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
if response.success?
|
32
|
+
# found object
|
33
|
+
|
34
|
+
# If a Location is returned, it defines the base resource for this file, not it's actual ending location
|
35
|
+
document_options = {
|
36
|
+
base_uri: RDF::URI((response.location || response.request).url.to_s),
|
37
|
+
charset: Encoding::UTF_8,
|
38
|
+
code: response.status_code,
|
39
|
+
headers: response.header
|
40
|
+
}
|
41
|
+
|
42
|
+
RDF::Util::File::RemoteDocument.new(response.body, document_options)
|
43
|
+
else
|
44
|
+
raise IOError, "<#{base_uri}>: #{response.status_code}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end; end # RDF::Hurley
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RDF::Hurley::VERSION
|
2
|
+
VERSION_FILE = File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "..", "VERSION")
|
3
|
+
MAJOR, MINOR, TINY, EXTRA = File.read(VERSION_FILE).chop.split(".")
|
4
|
+
|
5
|
+
STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
|
6
|
+
|
7
|
+
##
|
8
|
+
# @return [String]
|
9
|
+
def self.to_s() STRING end
|
10
|
+
|
11
|
+
##
|
12
|
+
# @return [String]
|
13
|
+
def self.to_str() STRING end
|
14
|
+
|
15
|
+
##
|
16
|
+
# @return [Array(Integer, Integer, Integer)]
|
17
|
+
def self.to_a() STRING.split(".") end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rdf-hurley
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Beer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: hurley
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdf
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.1.7
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.1'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.1.7
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.9'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.9'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '10.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '10.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rdf-spec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rspec
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
description:
|
104
|
+
email: public-rdf-ruby@w3.org
|
105
|
+
executables: []
|
106
|
+
extensions: []
|
107
|
+
extra_rdoc_files: []
|
108
|
+
files:
|
109
|
+
- AUTHORS
|
110
|
+
- README.md
|
111
|
+
- UNLICENSE
|
112
|
+
- VERSION
|
113
|
+
- lib/rdf/hurley.rb
|
114
|
+
- lib/rdf/hurley/http_adapter.rb
|
115
|
+
- lib/rdf/hurley/version.rb
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
homepage: http://ruby-rdf.github.com/rdf-hurley/
|
118
|
+
licenses: []
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 1.9.3
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.4.5
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: Hurley HTTP adapter for RDF.rb
|
140
|
+
test_files: []
|