Class: Puree::Extractor::Resource
- Inherits:
-
Object
- Object
- Puree::Extractor::Resource
- Includes:
- API::Authentication
- Defined in:
- lib/puree/extractor/resource.rb
Overview
Resource extractor.
Direct Known Subclasses
Dataset, Event, Journal, Organisation, Person, Project, Publication, Publisher
Instance Method Summary collapse
-
#get(uuid: nil, id: nil) ⇒ Puree::Model::Resource subclass?
(also: #find)
Get a resource.
-
#initialize(config, bleeding: true) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
#initialize(config, bleeding: true) ⇒ Resource
Returns a new instance of Resource.
12 13 14 15 |
# File 'lib/puree/extractor/resource.rb', line 12 def initialize(config, bleeding: true) @latest_api = bleeding configure_api config end |
Instance Method Details
#get(uuid: nil, id: nil) ⇒ Puree::Model::Resource subclass? Also known as: find
Get a resource.
22 23 24 25 26 27 28 29 |
# File 'lib/puree/extractor/resource.rb', line 22 def get(uuid: nil, id: nil) raise 'Cannot perform a request without a configuration' if @config.nil? @response = @request.get uuid: uuid, id: id, latest_api: @latest_api, resource_type: @resource_type set_content @response.body end |