Class: CollectionSpace::Client

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

Overview

CollectionSpace client

Constant Summary collapse

VERSION =
'0.14.1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#add_batch_job, #add_report, #all, #count, #domain, #find, #find_relation, #get_list_types, #keyword_search, #reindex_full_text, #reset_media_blob, #run_job, #search, #service

Constructor Details

#initialize(config = Configuration.new) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
15
# File 'lib/collectionspace/client/client.rb', line 9

def initialize(config = Configuration.new)
  unless config.is_a? CollectionSpace::Configuration
    raise CollectionSpace::ArgumentError, 'Invalid configuration object'
  end

  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/collectionspace/client/client.rb', line 7

def config
  @config
end

Instance Method Details

#delete(path) ⇒ Object



31
32
33
# File 'lib/collectionspace/client/client.rb', line 31

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

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



17
18
19
# File 'lib/collectionspace/client/client.rb', line 17

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

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



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

def post(path, payload, options = {})
  check_payload(payload)
  request 'POST', path, { body: payload }.merge(options)
end

#put(path, payload, options = {}) ⇒ Object



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

def put(path, payload, options = {})
  check_payload(payload)
  request 'PUT', path, { body: payload }.merge(options)
end