marmotta 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/marmotta/connection.rb +7 -0
- data/lib/marmotta/ld_path_connection.rb +30 -0
- data/lib/marmotta/version.rb +1 -1
- data/lib/marmotta.rb +2 -0
- data/marmotta.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16999630d7940dfbd07f2f3ea4b52857b65ab9b1
|
4
|
+
data.tar.gz: 4ede2dd0b2f38ca858fd3e46b938d2157d575593
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96e47e2a5eba9e01750e789aa20b85900461689fdc68b9a95bd95c79eab549bc595d2add6c23027608e0d1481fc018e28cdfe43c7815da424523ca2510ee5df1
|
7
|
+
data.tar.gz: 9ef900f5bbbe157ce3a287a8fe121bdc79628841042717447c788fc069a77eb40ffde89758abc6ad6f7ecdca709c1fd96ed9aaf2b733b0e90f39ac0987ce40c6
|
data/lib/marmotta/connection.rb
CHANGED
@@ -42,6 +42,13 @@ module Marmotta
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
# Returns an LDPath connection for a given path.
|
46
|
+
# @param [String, #to_s] path LDPath query to run
|
47
|
+
# @return [LdPathConnection] Connection which will run that path query.
|
48
|
+
def ldpath(path)
|
49
|
+
LdPathConnection.new(connection, path)
|
50
|
+
end
|
51
|
+
|
45
52
|
private
|
46
53
|
|
47
54
|
def connection
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Marmotta
|
2
|
+
class LdPathConnection
|
3
|
+
attr_reader :connection, :path
|
4
|
+
# @param [Hurley::Client] connection A client to use for running queries.
|
5
|
+
# @param [String, #to_s] An LDPath to run
|
6
|
+
def initialize(connection, path)
|
7
|
+
@connection = connection
|
8
|
+
@path = path.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def get(uri)
|
12
|
+
result = connection.get(api_path) do |req|
|
13
|
+
req.query[:uri] = uri.to_s
|
14
|
+
req.query[:path] = path
|
15
|
+
req.query.delete(:graph)
|
16
|
+
end
|
17
|
+
if result.status_code == 200
|
18
|
+
JSON.parse(result.body)
|
19
|
+
else
|
20
|
+
{}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def api_path
|
27
|
+
"ldpath/path"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/marmotta/version.rb
CHANGED
data/lib/marmotta.rb
CHANGED
@@ -8,4 +8,6 @@ module Marmotta
|
|
8
8
|
autoload :Connection, 'marmotta/connection'
|
9
9
|
autoload :Resource, 'marmotta/resource'
|
10
10
|
autoload :MaybeGraphResult, 'marmotta/maybe_graph_result'
|
11
|
+
autoload :LdPathQuery, 'marmotta/ld_path_query'
|
12
|
+
autoload :LdPathConnection, 'marmotta/ld_path_connection'
|
11
13
|
end
|
data/marmotta.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marmotta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trey Terell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hurley
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry-byebug
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description:
|
140
154
|
email:
|
141
155
|
- treydt@gmail.com
|
@@ -157,6 +171,7 @@ files:
|
|
157
171
|
- circle.yml
|
158
172
|
- lib/marmotta.rb
|
159
173
|
- lib/marmotta/connection.rb
|
174
|
+
- lib/marmotta/ld_path_connection.rb
|
160
175
|
- lib/marmotta/maybe_graph_result.rb
|
161
176
|
- lib/marmotta/resource.rb
|
162
177
|
- lib/marmotta/version.rb
|