archivesspace-client 0.1.12 → 0.3.0

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
  SHA256:
3
- metadata.gz: c009f995726401b9fd781b18796903276b19c2aabb3d6ec8722d60a36ea86600
4
- data.tar.gz: 3985545e091850851567ebc1706252da34922120222dd491ca7ae58928e30b19
3
+ metadata.gz: 4aa54400871b3c9e356f6750ba9aa9fbba6111869ad57bcfe548334296fbf146
4
+ data.tar.gz: 8fede8b9a6e86517ebea6fa8f3ed0c5e3cb3b18966137a0d7133453bf5f67d1e
5
5
  SHA512:
6
- metadata.gz: ef5a03e03271cb24133b3f82e2304162a5ede929453bb4af99edc8f011f260f204b390960b30ed691bd569af15813f0a0ee9e8063d4599d78e69eb833aad5b17
7
- data.tar.gz: ef541e1ebd699335e4333d195a7ac3e5a554b96543c2f1432e26c056751d584b7a7f1db0c4c0369cbc881e9c6b626286414103b728f778b69a81af1511678eb9
6
+ metadata.gz: a0f5d93549e1357eb6f6a1470faeeb4b36dfc1f43676ffed68c148298c23f8a4263ac88befebd4d85ba54cdd0a2b9bc69c53eac8a038aa5ce18962c57cf8afaf
7
+ data.tar.gz: 71cc7ac848b1c60744f122156706e88457da232e08184cff9c2b53fa32871f585743de9c1d87b26a96105f8c98d72b7221b5dfca8bcc828a3b50845089901a1b
@@ -1,8 +1,6 @@
1
1
  name: CI
2
2
  on: [pull_request]
3
3
 
4
- # TODO: add linters (rubocop)
5
-
6
4
  jobs:
7
5
  tests:
8
6
  name: Tests
@@ -15,8 +13,11 @@ jobs:
15
13
  uses: ruby/setup-ruby@v1
16
14
  with:
17
15
  bundler-cache: true
18
- ruby-version: 2.7
16
+
17
+ - name: Lint
18
+ run: |
19
+ bundle exec standardrb
19
20
 
20
21
  - name: Run tests
21
22
  run: |
22
- bundle exec rake
23
+ bundle exec rspec
@@ -23,7 +23,7 @@ jobs:
23
23
 
24
24
  - name: Release Gem
25
25
  run: |
26
- VERSION=$(ruby -e "puts eval(File.read('$GEM_NAME.gemspec')).version")
26
+ VERSION=$(bundle exec rake version)
27
27
  GEM_VERSION=$(gem list --exact --remote $GEM_NAME)
28
28
 
29
29
  # Publish to RubyGems.org
data/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ require: standard
2
+
3
+ inherit_gem:
4
+ standard: config/base.yml
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in archivesspace-client.gemspec
6
6
  gemspec
data/README.md CHANGED
@@ -45,6 +45,7 @@ config = ArchivesSpace::Configuration.new({
45
45
  page_size: 50,
46
46
  throttle: 0,
47
47
  verify_ssl: false,
48
+ timeout: 60
48
49
  })
49
50
 
50
51
  client = ArchivesSpace::Client.new(config).login
@@ -73,7 +74,8 @@ user = client.all('users').find { |user| user["username"] == "jdoe" }
73
74
  user = client.users.find { |user| user["username"] == "jdoe" }
74
75
  ```
75
76
 
76
- See `helpers.rb` for more convenience methods such as `client.digital_objects` etc.
77
+ See `pagination.rb` for endpoints that support record type methods such as
78
+ `client.digital_objects` etc.
77
79
 
78
80
  **Setting a repository context**
79
81
 
@@ -93,11 +95,11 @@ client.use_global_repository
93
95
 
94
96
  Templates are an optional feature that can help simplify the effort of creating
95
97
  json payloads for ArchivesSpace. Rather than construct the json programatically
96
- according to the schemas a `.erb` template can be used to generate payloads
97
- instead which are transformed to json automatically. There are a small number of
98
+ according to the schemas a template can be used to generate payloads instead which
99
+ are transformed to json automatically. There are a small number of
98
100
  templates provided with the client, but you can create your own and access them
99
101
  by setting the `ARCHIVESSPACE_CLIENT_TEMPLATES_PATH` envvar. A particularly simple
100
- template might look like:
102
+ `erb` template might look like:
101
103
 
102
104
  ```erb
103
105
  {
@@ -113,11 +115,13 @@ assembling the payload. To process a template:
113
115
 
114
116
  ```ruby
115
117
  data = { repo_code: 'ABC', name: 'ABC Archive', agent_contact_name: 'ABC Admin' }
116
- json = ArchivesSpace::Template.process(:repository_with_agent, data)
118
+ json = ArchivesSpace::Template.process("repository_with_agent.json.erb", data)
117
119
  response = client.post('/repositories/with_agent', json)
118
120
  puts response.result.success? ? '=)' : '=('
119
121
  ```
120
122
 
123
+ To view available templates use: `ArchivesSpace::Template.list`
124
+
121
125
  ## CLI
122
126
 
123
127
  Create an `~/.asclientrc` file with a json version of the client configuration:
@@ -130,6 +134,7 @@ Create an `~/.asclientrc` file with a json version of the client configuration:
130
134
  "password": "123456",
131
135
  "page_size": 50,
132
136
  "throttle": 0,
137
+ "timeout": 60,
133
138
  "verify_ssl": false
134
139
  }
135
140
  ```
data/Rakefile CHANGED
@@ -1,16 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
3
+ require "bundler/gem_tasks"
4
4
 
5
- require 'rspec/core/rake_task'
5
+ require "rspec/core/rake_task"
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
8
  # require 'rubocop/rake_task'
9
9
  # RuboCop::RakeTask.new
10
10
 
11
- require 'cucumber/rake/task'
11
+ require "cucumber/rake/task"
12
12
  Cucumber::Rake::Task.new
13
13
 
14
+ require "standard/rake"
15
+
14
16
  task default: %i[spec cucumber]
15
17
 
16
18
  task :version do
@@ -1,38 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'archivesspace/client/version'
5
+ require "archivesspace/client/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'archivesspace-client'
9
- spec.version = ArchivesSpace::Client::VERSION
10
- spec.authors = ['Mark Cooper']
11
- spec.email = ['mark.c.cooper@outlook.com']
12
- spec.summary = 'Interact with ArchivesSpace via the API.'
13
- spec.description = 'Interact with ArchivesSpace via the API.'
14
- spec.homepage = ''
15
- spec.license = 'MIT'
8
+ spec.name = "archivesspace-client"
9
+ spec.version = ArchivesSpace::Client::VERSION
10
+ spec.authors = ["Mark Cooper"]
11
+ spec.email = ["mark.c.cooper@outlook.com"]
12
+ spec.summary = "Interact with ArchivesSpace via the API."
13
+ spec.description = "Interact with ArchivesSpace via the API."
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0")
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ['lib']
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
21
20
 
22
- spec.add_development_dependency 'aruba'
23
- spec.add_development_dependency 'awesome_print', '~> 1.8.0'
24
- spec.add_development_dependency 'bundler'
25
- spec.add_development_dependency 'capybara_discoball'
26
- spec.add_development_dependency 'cucumber'
27
- spec.add_development_dependency 'json_spec'
28
- spec.add_development_dependency 'rake', '~> 10.0'
29
- spec.add_development_dependency 'rspec', '3.6.0'
30
- spec.add_development_dependency 'rubocop'
31
- spec.add_development_dependency 'vcr', '3.0.3'
32
- spec.add_development_dependency 'webmock', '3.0.1'
21
+ spec.add_development_dependency "aruba", "~> 2.0"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "3.6.0"
24
+ spec.add_development_dependency "rubocop", "1.56"
25
+ spec.add_development_dependency "standard", "1.31.0"
26
+ spec.add_development_dependency "vcr", "6.2.0"
27
+ spec.add_development_dependency "webmock", "3.19.1"
33
28
 
34
- spec.add_dependency 'dry-cli', '~> 0.7'
35
- spec.add_dependency 'httparty', '~> 0.14'
36
- spec.add_dependency 'json', '~> 2.0'
37
- spec.add_dependency 'nokogiri', '~> 1.10'
29
+ spec.add_dependency "dry-cli", "~> 0.7"
30
+ spec.add_dependency "httparty", "~> 0.14"
31
+ spec.add_dependency "json", "~> 2.0"
32
+ spec.add_dependency "nokogiri", "~> 1.10"
33
+ spec.add_dependency "jbuilder", "~> 2.11.5"
38
34
  end
data/examples/export.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
- require 'awesome_print'
5
- require 'archivesspace/client'
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "awesome_print"
5
+ require "archivesspace/client"
6
6
 
7
7
  # official sandbox
8
8
  config = ArchivesSpace::Configuration.new(
9
9
  {
10
- base_uri: 'http://test.archivesspace.org/staff/api',
11
- base_repo: '',
12
- username: 'admin',
13
- password: 'admin',
10
+ base_uri: "http://test.archivesspace.org/staff/api",
11
+ base_repo: "",
12
+ username: "admin",
13
+ password: "admin",
14
14
  page_size: 50,
15
15
  throttle: 0,
16
16
  verify_ssl: false
@@ -19,15 +19,15 @@ config = ArchivesSpace::Configuration.new(
19
19
 
20
20
  client = ArchivesSpace::Client.new(config).login
21
21
  client.config.throttle = 0.5
22
- client.config.base_repo = 'repositories/2'
22
+ client.config.base_repo = "repositories/2"
23
23
 
24
24
  begin
25
25
  # date -d '2021-02-01 00:00:00' +'%s' # 1612166400
26
- client.resources(query: { modified_since: '1612166400' }).each do |resource|
26
+ client.resources(query: {modified_since: "1612166400"}).each do |resource|
27
27
  # for now we are just printing ...
28
28
  # but you would actually write to a zip file or whatever
29
- id = resource['uri'].split('/')[-1]
30
- opts = { include_unpublished: false }
29
+ id = resource["uri"].split("/")[-1]
30
+ opts = {include_unpublished: false}
31
31
  response = client.get("resource_descriptions/#{id}.xml", opts)
32
32
  puts Nokogiri::XML(response.body).to_xml
33
33
  end
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
- require 'awesome_print'
5
- require 'archivesspace/client'
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "awesome_print"
5
+ require "archivesspace/client"
6
6
 
7
- username = 'admin'
8
- password = 'admin'
7
+ username = "admin"
8
+ password = "admin"
9
9
 
10
10
  # default client connection: localhost:8089, admin, admin
11
11
  client = ArchivesSpace::Client.new.login
12
12
  begin
13
13
  puts client.password_reset(username, password).parsed
14
- rescue StandardError => e
14
+ rescue => e
15
15
  puts "Failed to update password for #{username},\n#{e.message}"
16
16
  end
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
- require 'awesome_print'
5
- require 'archivesspace/client'
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "awesome_print"
5
+ require "archivesspace/client"
6
6
 
7
7
  # official sandbox
8
8
  config = ArchivesSpace::Configuration.new(
9
9
  {
10
- base_uri: 'http://sandbox.archivesspace.org/api',
11
- base_repo: '',
12
- username: 'admin',
13
- password: 'admin',
10
+ base_uri: "http://sandbox.archivesspace.org/api",
11
+ base_repo: "",
12
+ username: "admin",
13
+ password: "admin",
14
14
  page_size: 50,
15
15
  throttle: 0,
16
16
  verify_ssl: false
@@ -22,36 +22,36 @@ client = ArchivesSpace::Client.new(config).login
22
22
  ap ArchivesSpace::Template.list # view available templates
23
23
 
24
24
  repo_data = {
25
- repo_code: 'XYZ',
26
- name: 'XYZ Archive',
27
- agent_contact_name: 'XYZ Admin'
25
+ repo_code: "XYZ",
26
+ name: "XYZ Archive",
27
+ agent_contact_name: "XYZ Admin"
28
28
  }
29
29
 
30
30
  user_data = {
31
- username: 'lmessi',
32
- name: 'Lionel Messi',
31
+ username: "lmessi",
32
+ name: "Lionel Messi",
33
33
  is_admin: true
34
34
  }
35
- user_password = '123456'
35
+ user_password = "123456"
36
36
 
37
- repository = ArchivesSpace::Template.process(:repository_with_agent, repo_data)
37
+ repository = ArchivesSpace::Template.process("repository_with_agent.json.erb", repo_data)
38
38
 
39
39
  begin
40
- response = client.post('/repositories/with_agent', repository)
40
+ response = client.post("/repositories/with_agent", repository)
41
41
  if response.result.success?
42
- repository = client.repositories.find { |r| r['repo_code'] == 'XYZ' }
42
+ repository = client.repositories.find { |r| r["repo_code"] == "XYZ" }
43
43
  ap repository
44
- ap client.delete(repository['uri'])
44
+ ap client.delete(repository["uri"])
45
45
  else
46
46
  ap response.parsed
47
47
  end
48
48
 
49
- user = ArchivesSpace::Template.process(:user, user_data)
50
- response = client.post('users', user, { password: user_password })
49
+ user = ArchivesSpace::Template.process("user.json.erb", user_data)
50
+ response = client.post("users", user, {password: user_password})
51
51
  if response.result.success?
52
- user = client.users.find { |r| r['username'] == 'lmessi' }
52
+ user = client.users.find { |r| r["username"] == "lmessi" }
53
53
  ap user
54
- ap client.delete user['uri']
54
+ ap client.delete user["uri"]
55
55
  else
56
56
  ap response.parsed
57
57
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "awesome_print"
5
+ require "archivesspace/client"
6
+
7
+ puts ArchivesSpace::Template.list
8
+
9
+ template = "repository_with_agent.json.erb"
10
+ user_data = {
11
+ username: "harrykane",
12
+ name: "Harry Kane",
13
+ is_admin: false
14
+ }
15
+
16
+ puts ArchivesSpace::Template.process(template, user_data)
17
+ # or, if you really want ...
18
+ puts ArchivesSpace::Template::Erb.new(template, user_data).process
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
- require 'awesome_print'
5
- require 'archivesspace/client'
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "awesome_print"
5
+ require "archivesspace/client"
6
6
 
7
7
  # official sandbox
8
8
  config = ArchivesSpace::Configuration.new(
9
9
  {
10
- base_uri: 'http://sandbox.archivesspace.org/api',
11
- base_repo: '',
12
- username: 'admin',
13
- password: 'admin',
10
+ base_uri: "http://sandbox.archivesspace.org/api",
11
+ base_repo: "",
12
+ username: "admin",
13
+ password: "admin",
14
14
  page_size: 50,
15
15
  throttle: 0,
16
16
  verify_ssl: false
@@ -18,4 +18,4 @@ config = ArchivesSpace::Configuration.new(
18
18
  )
19
19
 
20
20
  client = ArchivesSpace::Client.new(config).login
21
- puts client.get('version').body
21
+ puts client.get("version").body
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
- require 'awesome_print'
5
- require 'archivesspace/client'
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "awesome_print"
5
+ require "archivesspace/client"
6
6
 
7
7
  # official sandbox
8
8
  config = ArchivesSpace::Configuration.new(
9
9
  {
10
- base_uri: 'http://sandbox.archivesspace.org/api',
11
- base_repo: '',
12
- username: 'admin',
13
- password: 'admin',
10
+ base_uri: "http://sandbox.archivesspace.org/api",
11
+ base_repo: "",
12
+ username: "admin",
13
+ password: "admin",
14
14
  page_size: 50,
15
15
  throttle: 0,
16
16
  verify_ssl: false
@@ -20,23 +20,23 @@ config = ArchivesSpace::Configuration.new(
20
20
  client = ArchivesSpace::Client.new(config).login
21
21
 
22
22
  user_data = {
23
- username: 'bde',
24
- name: 'BDE',
23
+ username: "bde",
24
+ name: "BDE",
25
25
  is_admin: false
26
26
  }
27
27
 
28
28
  client.post(
29
- 'users',
30
- ArchivesSpace::Template.process(:user, user_data),
31
- { password: '123456' }
29
+ "users",
30
+ ArchivesSpace::Template.process("user.json.erb", user_data),
31
+ {password: "123456"}
32
32
  )
33
33
 
34
34
  users_with_roles = {
35
- 'bde' => ['repository-basic-data-entry']
35
+ "bde" => ["repository-basic-data-entry"]
36
36
  }
37
37
 
38
38
  begin
39
- client.config.base_repo = 'repositories/2'
39
+ client.config.base_repo = "repositories/2"
40
40
  results = client.group_user_assignment users_with_roles
41
41
  ap results.map(&:parsed)
42
42
  rescue ArchivesSpace::RequestError => e
data/exe/asclient CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'bundler/setup'
5
- require 'archivesspace/client'
4
+ require "bundler/setup"
5
+ require "archivesspace/client"
6
6
 
7
7
  Dry::CLI.new(ArchivesSpace::Client::CLI).call
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aruba/cucumber'
4
- require 'json_spec/cucumber'
5
- require 'capybara_discoball'
3
+ require "aruba/cucumber"
4
+ require "json_spec/cucumber"
5
+ require "capybara_discoball"
6
6
 
7
7
  def last_json
8
8
  last_command_started.output
@@ -5,37 +5,37 @@ module ArchivesSpace
5
5
  module CLI
6
6
  # ArchivesSpace::Client::CLI::Exec executes an API request
7
7
  class Exec < Dry::CLI::Command
8
- desc 'Execute an API request'
8
+ desc "Execute an API request"
9
9
 
10
- argument :type, required: true, values: %i[get post put delete], desc: 'API request type'
11
- argument :path, required: true, desc: 'API request path'
10
+ argument :type, required: true, values: %i[get post put delete], desc: "API request type"
11
+ argument :path, required: true, desc: "API request path"
12
12
 
13
- option :rid, type: :integer, default: nil, desc: 'Repository id'
14
- option :payload, type: :string, default: '{}', desc: 'Data payload (json)'
15
- option :params, type: :string, default: '{}', desc: 'Params (json)'
13
+ option :rid, type: :integer, default: nil, desc: "Repository id"
14
+ option :payload, type: :string, default: "{}", desc: "Data payload (json)"
15
+ option :params, type: :string, default: "{}", desc: "Params (json)"
16
16
 
17
17
  example [
18
18
  'exec get --rid 2 "resources/1"',
19
19
  'exec get users --params \'{"query": {"page": 1}}\''
20
20
  ]
21
21
 
22
- def call(type:, path:, rid: nil, payload: '{}', params: '{}', **)
22
+ def call(type:, path:, rid: nil, payload: "{}", params: "{}", **)
23
23
  client = ArchivesSpace::Client::CLI.client
24
24
  client.repository(rid) if rid
25
- type = type.to_sym
25
+ type = type.to_sym
26
26
  payload = JSON.parse(payload, symbolize_names: true)
27
- params = JSON.parse(params, symbolize_names: true)
27
+ params = JSON.parse(params, symbolize_names: true)
28
28
 
29
29
  response = case type
30
- when :get
31
- client.get(path, params)
32
- when :post
33
- client.post(path, payload, params)
34
- when :put
35
- client.put(path, payload, params)
36
- when :delete
37
- client.delete(path)
38
- end
30
+ when :get
31
+ client.get(path, params)
32
+ when :post
33
+ client.post(path, payload, params)
34
+ when :put
35
+ client.put(path, payload, params)
36
+ when :delete
37
+ client.delete(path)
38
+ end
39
39
  puts JSON.generate(response.parsed)
40
40
  end
41
41
  end
@@ -5,7 +5,7 @@ module ArchivesSpace
5
5
  module CLI
6
6
  # ArchivesSpace::Client::CLI::Version prints version
7
7
  class Version < Dry::CLI::Command
8
- desc 'Print ArchivesSpace Client version'
8
+ desc "Print ArchivesSpace Client version"
9
9
 
10
10
  def call(*)
11
11
  puts ArchivesSpace::Client::VERSION
@@ -11,14 +11,14 @@ module ArchivesSpace
11
11
  end
12
12
 
13
13
  def self.find_config
14
- config = ENV.fetch('ASCLIENT_CFG', File.join(ENV['HOME'], '.asclientrc'))
14
+ config = ENV.fetch("ASCLIENT_CFG", File.join(ENV["HOME"], ".asclientrc"))
15
15
  raise "Unable to find asclient configuration file at: #{config}" unless File.file?(config)
16
16
 
17
17
  JSON.parse(File.read(config), symbolize_names: true)
18
18
  end
19
19
 
20
- register 'exec', Exec, aliases: ['e', '-e']
21
- register 'version', Version, aliases: ['v', '-v', '--version']
20
+ register "exec", Exec, aliases: ["e", "-e"]
21
+ register "version", Version, aliases: ["v", "-v", "--version"]
22
22
  end
23
23
  end
24
24
  end
@@ -5,33 +5,35 @@ module ArchivesSpace
5
5
  include Pagination
6
6
  include Task
7
7
  attr_accessor :token
8
- attr_reader :config
8
+ attr_reader :config
9
+
10
+ NAME = "ArchivesSpaceClient"
9
11
 
10
12
  def initialize(config = Configuration.new)
11
- raise 'Invalid configuration object' unless config.is_a? ArchivesSpace::Configuration
13
+ raise "Invalid configuration object" unless config.is_a? ArchivesSpace::Configuration
12
14
 
13
15
  @config = config
14
- @token = nil
16
+ @token = nil
15
17
  end
16
18
 
17
19
  def backend_version
18
- get 'version'
20
+ get "version"
19
21
  end
20
22
 
21
23
  def get(path, options = {})
22
- request 'GET', path, options
24
+ request "GET", path, options
23
25
  end
24
26
 
25
27
  def post(path, payload, params = {})
26
- request 'POST', path, { body: payload, query: params }
28
+ request "POST", path, {body: payload, query: params}
27
29
  end
28
30
 
29
31
  def put(path, payload, params = {})
30
- request 'PUT', path, { body: payload, query: params }
32
+ request "PUT", path, {body: payload, query: params}
31
33
  end
32
34
 
33
35
  def delete(path)
34
- request 'DELETE', path
36
+ request "DELETE", path
35
37
  end
36
38
 
37
39
  # Scoping requests
@@ -43,7 +45,7 @@ module ArchivesSpace
43
45
 
44
46
  begin
45
47
  Integer(id)
46
- rescue StandardError
48
+ rescue
47
49
  raise RepositoryIdError, "Invalid Repository id: #{id}"
48
50
  end
49
51
 
@@ -51,14 +53,14 @@ module ArchivesSpace
51
53
  end
52
54
 
53
55
  def use_global_repository
54
- @config.base_repo = ''
56
+ @config.base_repo = ""
55
57
  end
56
58
 
57
59
  private
58
60
 
59
61
  def request(method, path, options = {})
60
62
  sleep config.throttle
61
- options[:headers] = { 'X-ArchivesSpace-Session' => token } if token
63
+ options[:headers] = {"X-ArchivesSpace-Session" => token} if token
62
64
  result = Request.new(config, method, path, options).execute
63
65
  Response.new result
64
66
  end