stash_ezid_datacite 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4ac7b7c250dbf1b628d4900a0da3bf9092ea3236
4
+ data.tar.gz: c4ee190a28dd0879808d6e1b89f694d234fbda9d
5
+ SHA512:
6
+ metadata.gz: 036147e7e4168d9b2fa35d157a641f2baae81bea6f1d16bbe49cfc93461a26fb7bf7281a861f94681ad03bc985d5a1284353ebe99ea911ffa4960822d201c871
7
+ data.tar.gz: 2cd7345605c9a72aa11997c837133083938c9a7d289ad81c9336537b7e3889842096146def3b92447f03e40474055446cac0e5bd3178de0e3bd7be28fbd97180
@@ -0,0 +1,61 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp
10
+ .byebug_history
11
+
12
+ *.gem
13
+
14
+ #### jetbrains ####
15
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
16
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
17
+
18
+ # User-specific stuff:
19
+ .idea/workspace.xml
20
+ .idea/tasks.xml
21
+ .idea/dictionaries
22
+ .idea/vcs.xml
23
+ .idea/jsLibraryMappings.xml
24
+
25
+ # Sensitive or high-churn files:
26
+ .idea/dataSources.ids
27
+ .idea/dataSources.xml
28
+ .idea/dataSources.local.xml
29
+ .idea/sqlDataSources.xml
30
+ .idea/dynamic.xml
31
+ .idea/uiDesigner.xml
32
+
33
+ # Gradle:
34
+ .idea/gradle.xml
35
+ .idea/libraries
36
+
37
+ # Mongo Explorer plugin:
38
+ .idea/mongoSettings.xml
39
+
40
+ ## File-based project format:
41
+ *.iws
42
+
43
+ ## Plugin-specific files:
44
+
45
+ # IntelliJ
46
+ /out/
47
+
48
+ # mpeltonen/sbt-idea plugin
49
+ .idea_modules/
50
+
51
+ # JIRA plugin
52
+ atlassian-ide-plugin.xml
53
+
54
+ # Crashlytics plugin (for Android Studio and IntelliJ)
55
+ com_crashlytics_export_strings.xml
56
+ crashlytics.properties
57
+ crashlytics-build.properties
58
+ fabric.properties
59
+
60
+ # Raketasks
61
+ .rakeTasks
@@ -0,0 +1 @@
1
+ 2.2.5
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in stash_ezid_datacite.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 The Regents of the University of California
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,49 @@
1
+ # StashEzidDatacite
2
+
3
+ This presents a simple interface for minting an EZID item and updating the metadata.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'stash_ezid_datacite'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install stash_ezid_datacite
20
+
21
+ ## Usage
22
+
23
+ Simple example usage
24
+
25
+ ```ruby
26
+ @client = StashEzid::Client.new(shoulder: 'doi:10.5072/FK', account: 'apitest', password: '', owner: nil, id_scheme: 'doi') # fill in api test password on this line
27
+
28
+ identifier = @client.mint_id
29
+
30
+ # ... build an XML string here with your DataCite metadata and identifier as xml_str ...
31
+
32
+ @client.update_metadata(identifier, xml_str) # the return value.msg will equal "OK" if the update succeeds.
33
+ ```
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/stash_ezid_datacite.
44
+
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
49
+
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "stash_ezid_datacite"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,25 @@
1
+ require 'ezid-client'
2
+ module StashEzid
3
+ class Client
4
+
5
+ def initialize(shoulder:, account:, password:, owner:, id_scheme:)
6
+ @ezid_client = ::Ezid::Client.new(user: account, password: password)
7
+ @shoulder = shoulder
8
+ @owner = owner
9
+ @id_scheme = id_scheme
10
+ end
11
+
12
+ def mint_id
13
+ identifier = @ezid_client.mint_identifier(@shoulder, {:status => "reserved", :profile => "datacite"})
14
+ identifier.id
15
+ end
16
+
17
+ def update_metadata(identifier, xml_string, target = nil)
18
+ hash = {:status => "public", :datacite => xml_string }
19
+ hash[:owner] = @owner unless @owner.blank?
20
+ hash.merge!({:target => target}) if target
21
+ @ezid_client.modify_identifier(identifier, hash )
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ require "stash_ezid_datacite/version"
2
+
3
+ module StashEzidDatacite
4
+ def self.root
5
+ File.dirname __dir__
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module StashEzidDatacite
2
+ VERSION = "0.1.5"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'stash_ezid_datacite/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "stash_ezid_datacite"
8
+ spec.version = StashEzidDatacite::VERSION
9
+ spec.authors = ["Scott Fisher"]
10
+ spec.email = ["scott.fisher@ucop.edu"]
11
+
12
+ spec.summary = "Gem to do very basic EZID ID creation/updating for DataCite XML"
13
+ spec.description = "very basic EZID ID creation/updating"
14
+ spec.homepage = "https://github.com/CDLUC3/stash_ezid_datacite"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'ezid-client', "~> 1.5"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.10"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "minitest", "~> 5.9"
27
+ spec.add_development_dependency "byebug", "~> 9.0"
28
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stash_ezid_datacite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Scott Fisher
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ezid-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '9.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '9.0'
83
+ description: very basic EZID ID creation/updating
84
+ email:
85
+ - scott.fisher@ucop.edu
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".ruby-version"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - LICENSE.md
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - lib/stash_ezid/client.rb
100
+ - lib/stash_ezid_datacite.rb
101
+ - lib/stash_ezid_datacite/version.rb
102
+ - stash_ezid_datacite.gemspec
103
+ homepage: https://github.com/CDLUC3/stash_ezid_datacite
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.6.8
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Gem to do very basic EZID ID creation/updating for DataCite XML
127
+ test_files: []