Class: Puree::REST::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/puree/rest/base.rb
Overview
Direct Known Subclasses
Activity, Application, ClassificationScheme, CurriculaVitae, Dataset, Equipment, Event, ExternalOrganisation, ExternalPerson, Impact, Journal, OrganisationalUnit, Person, PressMedia, Prize, Project, Publisher, ResearchOutput
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/puree/rest/base.rb', line 16
def initialize(config)
@http_client = HTTP::Client.new
if config[:username] || config[:password]
options = {}
options[:user] = config[:username]
options[:pass] = config[:password]
@http_client = @http_client.basic_auth options
end
@http_client = @http_client.((config[:api_key]))
@url = config[:url]
end
|
Instance Method Details
#all(params: {}, accept: :xml) ⇒ HTTP::Response
31
32
33
34
|
# File 'lib/puree/rest/base.rb', line 31
def all(params: {}, accept: :xml)
get_request_collection params: params,
accept: accept
end
|
#find(id:, params: {}, accept: :xml) ⇒ HTTP::Response
40
41
42
43
44
|
# File 'lib/puree/rest/base.rb', line 40
def find(id:, params: {}, accept: :xml)
get_request_singleton id: id,
params: params,
accept: accept
end
|
#orderings(accept: :xml) ⇒ HTTP::Response
48
49
50
51
|
# File 'lib/puree/rest/base.rb', line 48
def orderings(accept: :xml)
get_request_meta meta_type: 'orderings',
accept: accept
end
|
#renderings(accept: :xml) ⇒ HTTP::Response
55
56
57
58
|
# File 'lib/puree/rest/base.rb', line 55
def renderings(accept: :xml)
get_request_meta meta_type: 'renderings',
accept: accept
end
|