Class: ArchivesSpace::Client

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/archivesspace/client/client.rb,
lib/archivesspace/client/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#accessions, #all, #backend_version, #batch_import, #digital_object_to_xml, #digital_objects, #group_user_assignment, #groups, #login, #password_reset, #repositories, #repositories_with_agent, #resource_to_xml, #resources, #search, #users

Constructor Details

#initialize(config = Configuration.new) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
# File 'lib/archivesspace/client/client.rb', line 8

def initialize(config = Configuration.new)
  raise "Invalid configuration object" unless config.kind_of? ArchivesSpace::Configuration
  @config = config
  @token  = nil
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/archivesspace/client/client.rb', line 6

def config
  @config
end

#tokenObject

Returns the value of attribute token.



5
6
7
# File 'lib/archivesspace/client/client.rb', line 5

def token
  @token
end

Instance Method Details

#delete(path) ⇒ Object



26
27
28
# File 'lib/archivesspace/client/client.rb', line 26

def delete(path)
  request 'DELETE', path
end

#get(path, options = {}) ⇒ Object



14
15
16
# File 'lib/archivesspace/client/client.rb', line 14

def get(path, options = {})
  request 'GET', path, options
end

#post(path, payload, params = {}) ⇒ Object



18
19
20
# File 'lib/archivesspace/client/client.rb', line 18

def post(path, payload, params = {})
  request 'POST', path, { body: payload.to_json, query: params }
end

#put(path, payload) ⇒ Object



22
23
24
# File 'lib/archivesspace/client/client.rb', line 22

def put(path, payload)
  request 'PUT', path, { body: payload.to_json }
end