ndl 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -1
- data/lib/ndl.rb +1 -0
- data/lib/ndl/opensearch.rb +22 -0
- data/lib/ndl/version.rb +1 -1
- data/ndl.gemspec +1 -1
- data/test.rb +9 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b0105c2700228b1341771c6965312520f968937
|
4
|
+
data.tar.gz: d74cba26baed8e0927d48d6384f162aaa58e420a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d0026b2fad4ee26832f0091ef838ed47ca5c21c4d412067f7520f37185e42f15f766c954836163fdba8de1bc7a88201b4b1ff934ded73660056a49b9fdd8623
|
7
|
+
data.tar.gz: 442fac12e6f2e3f3c19589abc25a4337cac7bec81abe4611c2859a2a0880ecafd22c709af1a39a78ca42ebbf7ee633af4494fbdff84d0c0f97e3b4eaf59353b9
|
data/README.md
CHANGED
@@ -22,7 +22,27 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### OpenSearch
|
26
|
+
|
27
|
+
* The following arguments are available
|
28
|
+
- :dpid
|
29
|
+
- :dpgroupid
|
30
|
+
- :any
|
31
|
+
- :title
|
32
|
+
- :creator
|
33
|
+
- :publisher
|
34
|
+
- :ndc
|
35
|
+
- :from
|
36
|
+
- :until
|
37
|
+
- :cnt
|
38
|
+
- :idx
|
39
|
+
- :isbn
|
40
|
+
- :mediatype
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
open_search = OpenSearch.new
|
44
|
+
open_search.search(:title=>'a', :from=>'1111-11-11', :cnt=>2)
|
45
|
+
```
|
26
46
|
|
27
47
|
## Development
|
28
48
|
|
data/lib/ndl.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module Ndl
|
4
|
+
class OpenSearch
|
5
|
+
def initialize
|
6
|
+
@url = "http://iss.ndl.go.jp/api/opensearch?"
|
7
|
+
end
|
8
|
+
def search(*query)
|
9
|
+
# delete query that don't have value
|
10
|
+
query = query[0].delete_if{|k,v|v==''}
|
11
|
+
# make url for ndl-opensearch-api
|
12
|
+
query.each_with_index do |(k,v), i|
|
13
|
+
@url += "#{k}=#{v}"
|
14
|
+
@url += "&" if (i != query.size-1)
|
15
|
+
end
|
16
|
+
# return #StringIO or #Tempfile via gem 'open-uri'
|
17
|
+
# about 'open-uri', please refer to http://docs.ruby-lang.org/ja/2.1.0/library/open=2duri.html
|
18
|
+
result = open(@url)
|
19
|
+
return result
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/ndl/version.rb
CHANGED
data/ndl.gemspec
CHANGED
data/test.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Makoto Hiramatsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,8 +56,10 @@ files:
|
|
56
56
|
- bin/console
|
57
57
|
- bin/setup
|
58
58
|
- lib/ndl.rb
|
59
|
+
- lib/ndl/opensearch.rb
|
59
60
|
- lib/ndl/version.rb
|
60
61
|
- ndl.gemspec
|
62
|
+
- test.rb
|
61
63
|
homepage: https://github.com/himkt/ndl
|
62
64
|
licenses:
|
63
65
|
- MIT
|