Class: ArchivesSpace::Client
- Inherits:
-
Object
- Object
- ArchivesSpace::Client
- Includes:
- Helpers
- Defined in:
- lib/archivesspace/client/client.rb,
lib/archivesspace/client/version.rb
Constant Summary collapse
- VERSION =
"0.1.6"
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path, options = {}) ⇒ Object
-
#initialize(config = Configuration.new) ⇒ Client
constructor
A new instance of Client.
- #post(path, payload, params = {}) ⇒ Object
- #put(path, payload, params = {}) ⇒ Object
Methods included from Helpers
#accessions, #all, #backend_version, #batch_import, #digital_objects, #group_user_assignment, #groups, #login, #password_reset, #repositories, #repositories_with_agent, #resources, #search, #users
Constructor Details
#initialize(config = Configuration.new) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 |
# File 'lib/archivesspace/client/client.rb', line 8 def initialize(config = Configuration.new) unless config.kind_of? ArchivesSpace::Configuration raise "Invalid configuration object" end @config = config @token = nil end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/archivesspace/client/client.rb', line 6 def config @config end |
#token ⇒ Object
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
28 29 30 |
# File 'lib/archivesspace/client/client.rb', line 28 def delete(path) request 'DELETE', path end |
#get(path, options = {}) ⇒ Object
16 17 18 |
# File 'lib/archivesspace/client/client.rb', line 16 def get(path, = {}) request 'GET', path, end |
#post(path, payload, params = {}) ⇒ Object
20 21 22 |
# File 'lib/archivesspace/client/client.rb', line 20 def post(path, payload, params = {}) request 'POST', path, { body: payload.to_json, query: params } end |
#put(path, payload, params = {}) ⇒ Object
24 25 26 |
# File 'lib/archivesspace/client/client.rb', line 24 def put(path, payload, params = {}) request 'PUT', path, { body: payload.to_json, query: params } end |