Class: ShafClient::Resource
- Inherits:
-
BaseResource
- Object
- BaseResource
- ShafClient::Resource
- Defined in:
- lib/shaf_client/resource.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseResource
#attributes, #curies, #embedded_resources, #links
Instance Method Summary collapse
- #get_doc(rel:) ⇒ Object
-
#initialize(client, payload) ⇒ Resource
constructor
A new instance of Resource.
Methods inherited from BaseResource
#[], #actions, #attribute, #curie, #embedded, #link, #to_s
Constructor Details
#initialize(client, payload) ⇒ Resource
Returns a new instance of Resource.
7 8 9 10 |
# File 'lib/shaf_client/resource.rb', line 7 def initialize(client, payload) @client = client super(payload) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ShafClient::BaseResource
Instance Method Details
#get_doc(rel:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/shaf_client/resource.rb', line 21 def get_doc(rel:) rel = rel.to_s curie_name, rel = if rel.include? ':' rel.split(':') else [:doc, rel] end curie = curie(curie_name) uri = curie.resolve_templated(rel: rel) client.get_doc(uri) end |