marmotta 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa29f4986133a699789cb672308b115155c2918b
4
- data.tar.gz: dfb1b6ef34f841307520d15b3f04dcf042cf0ec8
3
+ metadata.gz: 16999630d7940dfbd07f2f3ea4b52857b65ab9b1
4
+ data.tar.gz: 4ede2dd0b2f38ca858fd3e46b938d2157d575593
5
5
  SHA512:
6
- metadata.gz: b92046a3197706f161961e3ded718fa6af5d5a02e35af3bb9d2c0db8d0b4d6551c80823e78f0fdd59bbf9acb70e57034b3201de82c33318ab08a28871ffe6f41
7
- data.tar.gz: 9a913ddd350d40578bc4bdd58308fa5ff4b79df222a262806562e11fa478104057f9798ef61acfdd1d1af763f9a51f9a74f2ceec7a70ebb81096a7c785ac3e82
6
+ metadata.gz: 96e47e2a5eba9e01750e789aa20b85900461689fdc68b9a95bd95c79eab549bc595d2add6c23027608e0d1481fc018e28cdfe43c7815da424523ca2510ee5df1
7
+ data.tar.gz: 9ef900f5bbbe157ce3a287a8fe121bdc79628841042717447c788fc069a77eb40ffde89758abc6ad6f7ecdca709c1fd96ed9aaf2b733b0e90f39ac0987ce40c6
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Marmotta
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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
@@ -36,4 +36,5 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "webmock"
37
37
  spec.add_development_dependency "jettywrapper"
38
38
  spec.add_development_dependency "rspec"
39
+ spec.add_development_dependency "pry-byebug"
39
40
  end
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.1.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-06-03 00:00:00.000000000 Z
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