tdiary-contrib 5.0.7 → 5.0.8
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 +4 -4
- data/lib/tdiary/contrib/version.rb +1 -1
- data/plugin/ohmsha_estore.rb +1 -48
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d9a46bf4de48e3f68a55368e90037739d4893f8cf01e8a84856ab0d20909c6e
|
|
4
|
+
data.tar.gz: 1ed06a04c4e91f800324a748f0aa463144a1903513480609d3bf2982d87921a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4e92b1579a74a59a33c733b087f6bc450614cdfe7bf4e691f95ae510a863f24308674a78bf811e86195dd7c80dbb99a034bf96a0919a1b934da402fc2c62882
|
|
7
|
+
data.tar.gz: 7c666a539ff02568ed5abc27a3d8d6876be81c03d599a823affaee81031c01d23d822df8a919bbfaf7929a6f24536bb66e9220f8d4adc15a8c6e363791c09878
|
data/plugin/ohmsha_estore.rb
CHANGED
|
@@ -4,55 +4,8 @@
|
|
|
4
4
|
# display book info in https://estore.ohmsha.co.jp/ like amazon.rb
|
|
5
5
|
# USAGE: {{ohmsha_estore '978427406694P'}}
|
|
6
6
|
|
|
7
|
-
def ohmsha_estore_cache_dir
|
|
8
|
-
cache = "#{@cache_path}/ohmsha-estore"
|
|
9
|
-
Dir.mkdir( cache ) unless File.directory?( cache )
|
|
10
|
-
cache
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def ohmsha_estore_cache_set( id, result )
|
|
14
|
-
File.open( "#{ohmsha_estore_cache_dir}/#{id}", "w" ) do |f|
|
|
15
|
-
f.write result
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def ohmsha_estore_cache_get( id )
|
|
20
|
-
File.open( "#{ohmsha_estore_cache_dir}/#{id}", "r" ) do |f|
|
|
21
|
-
f.read
|
|
22
|
-
end
|
|
23
|
-
rescue
|
|
24
|
-
nil
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
require 'open-uri'
|
|
28
|
-
require 'json'
|
|
29
7
|
def ohmsha_estore( id, doc = nil )
|
|
30
|
-
|
|
31
|
-
return result
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
html = ''
|
|
35
|
-
begin
|
|
36
|
-
open("https://estore.ohmsha.co.jp/titles/#{id}"){|r|html = r.read}
|
|
37
|
-
rescue SecurityError # avoid error on unlink
|
|
38
|
-
end
|
|
39
|
-
info = JSON.parse(html.scan(%r|<script type='application/ld\+json'>(.*?)</script>|m).flatten[0])
|
|
40
|
-
|
|
41
|
-
result = <<-EOS
|
|
42
|
-
<a class="amazon-detail" href="#{h link}"><span class="amazon-detail">
|
|
43
|
-
<img class="amazon-detail left" src="#{h info['image']}"
|
|
44
|
-
height="150" width="100"
|
|
45
|
-
alt="#{h info['name']}">
|
|
46
|
-
<span class="amazon-detail-desc">
|
|
47
|
-
<span class="amazon-title">#{h info['name']}</span><br>
|
|
48
|
-
<span class="amazon-label">#{h info['description'].split.first}</span><br>
|
|
49
|
-
<span class="amazon-price">#{h info['offers']['price'].to_f.to_i}円</span>
|
|
50
|
-
</span><br style="clear: left">
|
|
51
|
-
</span></a>
|
|
52
|
-
EOS
|
|
53
|
-
|
|
54
|
-
ohmsha_estore_cache_set( id, result ) unless @conf.secure
|
|
55
|
-
result
|
|
8
|
+
"<p>Ohmsha eBook Store is no longer available.</p>\n"
|
|
56
9
|
end
|
|
57
10
|
|
|
58
11
|
# Local Variables:
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tdiary-contrib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.0.
|
|
4
|
+
version: 5.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tDiary contributors
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-03-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: tdiary
|
|
@@ -506,7 +506,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
506
506
|
version: '0'
|
|
507
507
|
requirements: []
|
|
508
508
|
rubyforge_project:
|
|
509
|
-
rubygems_version: 2.7.
|
|
509
|
+
rubygems_version: 2.7.6
|
|
510
510
|
signing_key:
|
|
511
511
|
specification_version: 4
|
|
512
512
|
summary: tDiary contributions package
|