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.3.0'.freeze
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) ⇒ Object
Methods included from Helpers
#all, #count, #get_list_types, #prepare_query, #search
Constructor Details
#initialize(config = Configuration.new) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 |
# File 'lib/collectionspace/client/client.rb', line 7 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.
5 6 7 |
# File 'lib/collectionspace/client/client.rb', line 5 def config @config end |
Instance Method Details
#delete(path) ⇒ Object
29 30 31 |
# File 'lib/collectionspace/client/client.rb', line 29 def delete(path) request 'DELETE', path end |
#get(path, options = {}) ⇒ Object
15 16 17 |
# File 'lib/collectionspace/client/client.rb', line 15 def get(path, = {}) request 'GET', path, end |
#post(path, payload, options = {}) ⇒ Object
19 20 21 22 |
# File 'lib/collectionspace/client/client.rb', line 19 def post(path, payload, = {}) check_payload(payload) request 'POST', path, { body: payload }.merge() end |
#put(path, payload) ⇒ Object
24 25 26 27 |
# File 'lib/collectionspace/client/client.rb', line 24 def put(path, payload) check_payload(payload) request 'PUT', path, body: payload end |