class ArchivesSpace::Client
Constants
- VERSION
Attributes
config[R]
token[RW]
Public Class Methods
new(config = Configuration.new)
click to toggle source
# File lib/archivesspace/client/client.rb, line 9 def initialize(config = Configuration.new) raise 'Invalid configuration object' unless config.is_a? ArchivesSpace::Configuration @config = config @token = nil end
Public Instance Methods
delete(path)
click to toggle source
# File lib/archivesspace/client/client.rb, line 28 def delete(path) request 'DELETE', path end
get(path, options = {})
click to toggle source
# File lib/archivesspace/client/client.rb, line 16 def get(path, options = {}) request 'GET', path, options end
post(path, payload, params = {})
click to toggle source
# File lib/archivesspace/client/client.rb, line 20 def post(path, payload, params = {}) request 'POST', path, { body: payload, query: params } end
put(path, payload, params = {})
click to toggle source
# File lib/archivesspace/client/client.rb, line 24 def put(path, payload, params = {}) request 'PUT', path, { body: payload, query: params } end
Private Instance Methods
request(method, path, options = {})
click to toggle source
# File lib/archivesspace/client/client.rb, line 34 def request(method, path, options = {}) sleep config.throttle options[:headers] = { 'X-ArchivesSpace-Session' => token } if token result = Request.new(config, method, path, options).execute Response.new result end