sist02 0.1.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 679bce48eb8c7267e6791ddf435fadb28048038d
4
+ data.tar.gz: d6b0ecaffdef68dbddc38950da430bdd4059ab56
5
+ SHA512:
6
+ metadata.gz: 2546cb705dd06a1997680b81ac055993912bd5df66143e017f6535ae9a706d2c21d33961044ea78f7d37c823cec9a113cf29aa12d6691daa81f7ac9ce399a52d
7
+ data.tar.gz: 61ab0a72f65acaabb111f96ce7fce80541e3578feac57da6cac6fbd433e2bca60be0e08a7023f4eaad9763a4efa2df42b98e6d3b6efc29227022a0694efdfd9d
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .*
11
+ !.gitignore
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sist02.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Sist02
2
+
3
+ This gem provides easy way to make SIST-02 formed references.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'sist02'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install sist02
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/[my-github-username]/sist02/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sist02"
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
data/bin/setup ADDED
@@ -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,26 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+ require 'date'
4
+
5
+ module Sist02
6
+ module_function
7
+ def article_ref(naid)
8
+ begin
9
+ html = open("http://ci.nii.ac.jp/naid/#{naid}.json").read
10
+ json = JSON.parser.new(html)
11
+ hash = json.parse["@graph"][0]
12
+ title = hash["dc:title"][0]["@value"]
13
+ creator = hash["dc:creator"][0][0]["@value"]
14
+ publication_name = hash["prism:publicationName"][0]["@value"]
15
+ year = hash["dc:date"].match(/\d{4}/)
16
+ volume = hash["prism:volume"]
17
+ number = hash["prism:number"]
18
+ start_p = hash["prism:startingPage"]
19
+ end_p = hash["prism:endingPage"]
20
+ result = "#{creator}. #{title}. #{publication_name}. #{year}, #{volume}(#{number}), p. #{start_p}-#{end_p}."
21
+ rescue => e
22
+ result = e
23
+ end
24
+ return result
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module Sist02
2
+ VERSION = "0.1.1"
3
+ end
data/lib/sist02.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "sist02/version"
2
+ require 'sist02/cinii'
3
+
4
+ module Sist02
5
+ # Your code goes here...
6
+ end
data/sist02.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sist02/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sist02"
8
+ spec.version = Sist02::VERSION
9
+ spec.authors = ["Makoto Hiramatsu"]
10
+ spec.email = ["himkt@klis.tsukuba.ac.jp"]
11
+
12
+ spec.summary = %q{easy way to make sist02 formed reference}
13
+ spec.description = %q{make reference via web api}
14
+ spec.homepage = "https://github.com/himkt/sist02"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.9"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
data/test.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'sist02'
2
+
3
+ p Sist02.article_ref("40020388722")
4
+
5
+ p Sist02.article_ref('s')
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sist02
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Makoto Hiramatsu
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: make reference via web api
42
+ email:
43
+ - himkt@klis.tsukuba.ac.jp
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - lib/sist02.rb
56
+ - lib/sist02/cinii.rb
57
+ - lib/sist02/version.rb
58
+ - sist02.gemspec
59
+ - test.rb
60
+ homepage: https://github.com/himkt/sist02
61
+ licenses: []
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: easy way to make sist02 formed reference
83
+ test_files: []