collectionspace-client 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d91d71b3dbef30c674147767761f18fcc1226bb
4
- data.tar.gz: 1b549d3e8dc7ee330159af1760334ad7da8d9e9e
3
+ metadata.gz: a319415ad201aae3e067ccbd1235a97b39dfcb12
4
+ data.tar.gz: 01f4a1be2eee7dfe5e88746b95fd921cf0fa6f6c
5
5
  SHA512:
6
- metadata.gz: 447a62f984a501f447bea685abcee2a849da1269be55272568c8efa3c86766b8b25cb04fa640e7d00cdc1b4467283250f3fa95a984eb8676513ea84478b89dff
7
- data.tar.gz: 0f1d7eee7e44349fa0db4f749021ea3d98ff0bb0e5bb18535cb832081a4bc122687f080daf36ad8ab36c546ca4122b2489f26d027a7f873b085428a573740080
6
+ metadata.gz: 119b3a523dbfd578f5dd608deef78ddc1ef46e5c51a233b522cdf2cd04848910a47072a62b3bf6ed4b02f08ed46a4e28682e1396e7cb3628228bd498964a3c91
7
+ data.tar.gz: 64086ac3f2facdcbf3de0491c1c4a168e8f8b48f795b993f1d3a601082986e54278258df29b39d3c87801debd2dc5c3c23f6f6ecd7a085a36bc8f8a414d16d6d
data/README.md CHANGED
@@ -75,6 +75,14 @@ To run the tests:
75
75
  bundle exec rake
76
76
  ```
77
77
 
78
+ Publishing
79
+ ---
80
+
81
+ ```bash
82
+ VERSION=0.1.3
83
+ gem push collectionspace-client-$VERSION.gem
84
+ ```
85
+
78
86
  Contributing
79
87
  ---
80
88
 
@@ -0,0 +1,26 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'awesome_print'
3
+ require 'collectionspace/client'
4
+
5
+ # CREATE CLIENT WITH DEFAULT (DEMO) CONFIGURATION -- BE NICE!!!
6
+ client = CollectionSpace::Client.new
7
+ client.config.throttle = 1
8
+
9
+ # ap client.get('media/c453755d-3442-4516-9883').xml.to_xml
10
+
11
+ media_url = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
12
+ media = <<-XML
13
+ <?xml version="1.0" encoding="UTF-8"?>
14
+ <document name="media">
15
+ <ns2:media_common xmlns:ns2="http://collectionspace.org/services/media" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
16
+ <title>GOOGLE</title>
17
+ <identificationNumber>GOOGLE-1</identificationNumber>
18
+ </ns2:media_common>
19
+ </document>
20
+ XML
21
+
22
+ response = client.post('media', media, { query: { "blobUri" => media_url } })
23
+ puts response.status_code
24
+ if response.status_code == 201
25
+ puts response.headers['location']
26
+ end
@@ -14,13 +14,14 @@ module CollectionSpace
14
14
  request 'GET', path, options
15
15
  end
16
16
 
17
- def post(path, payload)
18
- raise PayloadError.new if Nokogiri::XML(payload).errors.any?
19
- request 'POST', path, { body: payload }
17
+ # additional_options: { query: { foo: 'bar' } }
18
+ def post(path, payload, additional_options = {})
19
+ raise PayloadError.new, Nokogiri::XML(payload).errors if Nokogiri::XML(payload).errors.any?
20
+ request 'POST', path, { body: payload }.merge(additional_options)
20
21
  end
21
22
 
22
23
  def put(path, payload)
23
- raise PayloadError.new if Nokogiri::XML(payload).errors.any?
24
+ raise PayloadError.new, Nokogiri::XML(payload).errors if Nokogiri::XML(payload).errors.any?
24
25
  request 'PUT', path, { body: payload }
25
26
  end
26
27
 
@@ -4,7 +4,7 @@ module CollectionSpace
4
4
 
5
5
  def defaults
6
6
  {
7
- base_uri: "http://demo.collectionspace.org:8180/cspace-services",
7
+ base_uri: "https://core.collectionspace.org/cspace-services",
8
8
  username: "admin@core.collectionspace.org",
9
9
  password: "Administrator",
10
10
  page_size: 50,
@@ -25,4 +25,4 @@ module CollectionSpace
25
25
 
26
26
  end
27
27
 
28
- end
28
+ end
@@ -1,5 +1,5 @@
1
1
  module CollectionSpace
2
2
  class Client
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collectionspace-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Cooper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2018-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -153,6 +153,7 @@ files:
153
153
  - collectionspace-client.gemspec
154
154
  - examples/demo.rb
155
155
  - examples/export.rb
156
+ - examples/media_with_external_file.rb
156
157
  - examples/purge-empty-vocabularies.rb
157
158
  - examples/search.rb
158
159
  - lib/collectionspace/client.rb
@@ -183,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
184
  version: '0'
184
185
  requirements: []
185
186
  rubyforge_project:
186
- rubygems_version: 2.4.5.1
187
+ rubygems_version: 2.6.13
187
188
  signing_key:
188
189
  specification_version: 4
189
190
  summary: CollectionSpace API client.