Class: Marmotta::LdPathConnection
- Inherits:
-
Object
- Object
- Marmotta::LdPathConnection
- Defined in:
- lib/marmotta/ld_path_connection.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #get(path) ⇒ Object
-
#initialize(connection, uri) ⇒ LdPathConnection
constructor
A new instance of LdPathConnection.
Constructor Details
#initialize(connection, uri) ⇒ LdPathConnection
Returns a new instance of LdPathConnection.
6 7 8 9 |
# File 'lib/marmotta/ld_path_connection.rb', line 6 def initialize(connection, uri) @connection = connection @uri = uri.to_s end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/marmotta/ld_path_connection.rb', line 3 def connection @connection end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
3 4 5 |
# File 'lib/marmotta/ld_path_connection.rb', line 3 def uri @uri end |
Instance Method Details
#get(path) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/marmotta/ld_path_connection.rb', line 11 def get(path) result = connection.get(api_path) do |req| req.query[:uri] = uri req.query[:path] = path.to_s req.query.delete(:graph) req.header = {} end if result.status_code == 200 JSON.parse(result.body) else [] end end |