tta_terms_api 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tta_terms_api/version.rb +1 -1
- data/lib/tta_terms_api.rb +4 -1
- data/spec/tta_terms_api_spec.rb +11 -2
- data/tta_terms_api.gemspec +6 -5
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c9d8b01f161dc68af43ae55dea7fb436cfa1aac
|
4
|
+
data.tar.gz: fd5987c321433b7e92aea48ba329d4d49349cd57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf700fee0c08b791c9c761576b5882a64df3cb09e293c24b00826aedcd8e12c78d3fb94c5ad5babe53dcd3b0e988801b5b5fdf0c9a8d68f05f33de1f5936a5a5
|
7
|
+
data.tar.gz: f74dd010c0caa8b5cbfb5ab97dc85b66bda4029936caa3407bb5878331b691fbc74a181d854dd4c77d577852e0704e7e4da8334396451c6929be7b3c18769110
|
data/lib/tta_terms_api.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require "tta_terms_api/version"
|
2
2
|
require "nokogiri"
|
3
3
|
require 'open-uri'
|
4
|
+
require 'moneta'
|
4
5
|
|
5
6
|
|
6
7
|
module TtaTermsApi
|
7
8
|
BASE_URL = "http://word.tta.or.kr/terms/"
|
9
|
+
STORE = Moneta.new(:File, :dir => 'tmp')
|
8
10
|
WordCriteria = Struct.new(:name, :options) do
|
9
11
|
def to_word
|
10
12
|
TtaTermsApi.view(options)
|
@@ -41,7 +43,8 @@ module TtaTermsApi
|
|
41
43
|
|
42
44
|
def self.html(type, options)
|
43
45
|
uri = "#{BASE_URL}terms#{type.to_s.capitalize}.jsp?#{options.map{|k,v|"#{k}=#{v}"} * "&"}"
|
44
|
-
|
46
|
+
html = STORE.fetch(uri) { STORE[uri] = open(uri).read }
|
47
|
+
Nokogiri::HTML(html, nil, "EUC-KR")
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
data/spec/tta_terms_api_spec.rb
CHANGED
@@ -6,14 +6,23 @@ describe TtaTermsApi do
|
|
6
6
|
let(:list) { TtaTermsApi.list(search: "list") }
|
7
7
|
it "return array of word object" do
|
8
8
|
expect(list.class).to be Array
|
9
|
-
expect(list.first.class).to be TtaTermsApi::
|
9
|
+
expect(list.first.class).to be TtaTermsApi::WordCriteria
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
describe ".view" do
|
14
|
-
let(:view) { TtaTermsApi.view(gubun: 1, terms_num:
|
14
|
+
let(:view) { TtaTermsApi.view(gubun: 1, terms_num: 17626) }
|
15
15
|
it "return array of word object" do
|
16
16
|
expect(view.class).to be TtaTermsApi::Word
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
describe ".html" do
|
21
|
+
let(:html) { TtaTermsApi.html("", {}) }
|
22
|
+
it "cache html object" do
|
23
|
+
expect(html).to_not be_nil
|
24
|
+
expect(TtaTermsApi::STORE["http://word.tta.or.kr/terms/terms.jsp?"]).to_not be_nil
|
25
|
+
TtaTermsApi::STORE.delete("http://word.tta.or.kr/terms/terms.jsp?")
|
26
|
+
end
|
27
|
+
end
|
19
28
|
end
|
data/tta_terms_api.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Shim Tw"]
|
10
10
|
spec.email = ["marocchino@gmail.com"]
|
11
11
|
spec.summary = %q{Ruby interface to Korean IT terms(정보 통신 용어 사전)}
|
12
|
-
spec.description = ""
|
13
|
-
spec.homepage = ""
|
12
|
+
spec.description = "It is unoffical API for Korean IT terms."
|
13
|
+
spec.homepage = "https://github.com/marocchino/tta_terms_api"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -18,8 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "nokogiri", "~> 1.6
|
21
|
+
spec.add_dependency "nokogiri", "~> 1.6"
|
22
|
+
spec.add_dependency "moneta", "~> 0.7"
|
22
23
|
spec.add_development_dependency "bundler", "~> 1.5"
|
23
|
-
spec.add_development_dependency "rake"
|
24
|
-
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
25
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
25
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tta_terms_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shim Tw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.6
|
19
|
+
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.6
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: moneta
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.7'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,31 +56,31 @@ dependencies:
|
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '10.1'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '10.1'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '2.14'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
-
description:
|
82
|
+
version: '2.14'
|
83
|
+
description: It is unoffical API for Korean IT terms.
|
70
84
|
email:
|
71
85
|
- marocchino@gmail.com
|
72
86
|
executables: []
|
@@ -83,7 +97,7 @@ files:
|
|
83
97
|
- spec/spec_helper.rb
|
84
98
|
- spec/tta_terms_api_spec.rb
|
85
99
|
- tta_terms_api.gemspec
|
86
|
-
homepage:
|
100
|
+
homepage: https://github.com/marocchino/tta_terms_api
|
87
101
|
licenses:
|
88
102
|
- MIT
|
89
103
|
metadata: {}
|