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.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/puree/rest/base.rb', line 19
def initialize(config)
config = http_defaults.merge 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]))
@http_client = @http_client.timeout read: config[:http_read_timeout],
write: config[:http_write_timeout],
connect: config[:http_connection_timeout]
@url = config[:url]
end
|
Instance Method Details
#all(params: {}, accept: :xml) ⇒ HTTP::Response
46
47
48
49
|
# File 'lib/puree/rest/base.rb', line 46
def all(params: {}, accept: :xml)
get_request_collection params: params,
accept: accept
end
|
#all_complex(params: {}, accept: :xml) ⇒ HTTP::Response
38
39
40
41
|
# File 'lib/puree/rest/base.rb', line 38
def all_complex(params: {}, accept: :xml)
post_request_collection params: params,
accept: accept
end
|
#find(id:, params: {}, accept: :xml) ⇒ HTTP::Response
55
56
57
58
59
|
# File 'lib/puree/rest/base.rb', line 55
def find(id:, params: {}, accept: :xml)
get_request_singleton id: id,
params: params,
accept: accept
end
|
#orderings(accept: :xml) ⇒ HTTP::Response
63
64
65
66
|
# File 'lib/puree/rest/base.rb', line 63
def orderings(accept: :xml)
get_request_meta meta_type: 'orderings',
accept: accept
end
|
#renderings(accept: :xml) ⇒ HTTP::Response
70
71
72
73
|
# File 'lib/puree/rest/base.rb', line 70
def renderings(accept: :xml)
get_request_meta meta_type: 'renderings',
accept: accept
end
|