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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83f450ca5f0bd73c888d7495ed05323b5104d3f67c3ca8f077dbf64e61409aa5
4
- data.tar.gz: 4d6f9afd972dd55417dd82ea98f57a0acbd3bda8db2637ceecdd1edd84907c09
3
+ metadata.gz: 3d9a46bf4de48e3f68a55368e90037739d4893f8cf01e8a84856ab0d20909c6e
4
+ data.tar.gz: 1ed06a04c4e91f800324a748f0aa463144a1903513480609d3bf2982d87921a7
5
5
  SHA512:
6
- metadata.gz: d6330a3ef7dd885b07b75ddd3d16ca8b4c9857a52b596c5c8dba6f5121ced57b5c30833c10df38f47497696a54d397f0c3ee7424ae8441cc29f95a1196faa576
7
- data.tar.gz: 621078f662b39ffa102b0a08df3717450fed12542465c4f9e75e70ad7bb09f5d125e9951529d00c377c33ebfb7b5c787e344a84286cededb31b71c68a27a4f09
6
+ metadata.gz: f4e92b1579a74a59a33c733b087f6bc450614cdfe7bf4e691f95ae510a863f24308674a78bf811e86195dd7c80dbb99a034bf96a0919a1b934da402fc2c62882
7
+ data.tar.gz: 7c666a539ff02568ed5abc27a3d8d6876be81c03d599a823affaee81031c01d23d822df8a919bbfaf7929a6f24536bb66e9220f8d4adc15a8c6e363791c09878
@@ -1,5 +1,5 @@
1
1
  module TDiary
2
2
  class Contrib
3
- VERSION = "5.0.7"
3
+ VERSION = "5.0.8"
4
4
  end
5
5
  end
@@ -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
- if !@conf.secure and !(result = ohmsha_estore_cache_get(id)).nil?
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.7
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: 2017-12-29 00:00:00.000000000 Z
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.3
509
+ rubygems_version: 2.7.6
510
510
  signing_key:
511
511
  specification_version: 4
512
512
  summary: tDiary contributions package