Class: CollectionSpace::Client
- Inherits:
-
Object
- Object
- CollectionSpace::Client
- 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
-
#config ⇒ Object
readonly
Returns the value of attribute config.
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, options = {}) ⇒ Object
- #put(path, payload, options = {}) ⇒ Object
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
#config ⇒ Object (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, = {}) request 'GET', path, end |
#post(path, payload, options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/collectionspace/client/client.rb', line 21 def post(path, payload, = {}) check_payload(payload) request 'POST', path, { body: payload }.merge() end |
#put(path, payload, options = {}) ⇒ Object
26 27 28 29 |
# File 'lib/collectionspace/client/client.rb', line 26 def put(path, payload, = {}) check_payload(payload) request 'PUT', path, { body: payload }.merge() end |