google_suggest 1.0.2 → 1.0.3
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/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/lib/google_suggest.rb +3 -6
- data/lib/google_suggest/version.rb +1 -1
- data/spec/google_suggest_spec.rb +1 -1
- data/spec/sample_ja.xml +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a3e9bdc9fbba9c974aaef9edc750bf7e25ada054f4b4d61bce93f024092abda
|
4
|
+
data.tar.gz: 33ddf30287efc93bf8a52ae5e1d3db696203d88a6b2baea9a16d3d5abf13d783
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 597d07a3b8abc51b26c02e16c7e14ba13a515e2a81f5358a782b2f8e5fcdc11310ef0d6b9ded2670c531e2831a47c161ab805a38ead317cdf05b86055160846e
|
7
|
+
data.tar.gz: b88ec7c3f0d8f42b3439a840d49b952a8824a2852277e45b00537c9a3d38c5b30de4f6e7ac491fa58d90b238cf8a560bcf7bbcbcdb361fcd40bf4af261119107
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# ChangeLog
|
2
2
|
|
3
|
-
##
|
3
|
+
## GoogleSuggest 1.0.3
|
4
|
+
|
5
|
+
* BugFix: Failed to parse Suggest API response since encoding issue. [#29](https://github.com/satoryu/google_suggest/pull/29)
|
6
|
+
|
7
|
+
## GoogleSuggest 1.0.2
|
4
8
|
|
5
9
|
* Drop ruby 2.3 from supported ruby versions. [#25](https://github.com/satoryu/google_suggest/pull/25)
|
6
10
|
* Made `Region` module since it has never been instantiated. [#26](https://github.com/satoryu/google_suggest/pull/26)
|
data/Gemfile.lock
CHANGED
data/lib/google_suggest.rb
CHANGED
@@ -64,13 +64,10 @@ class GoogleSuggest
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def parse(doc)
|
67
|
+
doc = doc.encode('UTF-8', 'Shift_JIS') unless doc.valid_encoding?
|
67
68
|
xml = REXML::Document.new(doc)
|
68
|
-
suggestions = REXML::XPath.match(xml, '/toplevel/CompleteSuggestion/suggestion').
|
69
|
-
|
70
|
-
if data && !data.valid_encoding?
|
71
|
-
data.force_encoding('Shift_JIS').encode!('UTF-8')
|
72
|
-
end
|
73
|
-
res << data
|
69
|
+
suggestions = REXML::XPath.match(xml, '/toplevel/CompleteSuggestion/suggestion').map do |suggest|
|
70
|
+
suggest.attribute('data').value
|
74
71
|
end
|
75
72
|
|
76
73
|
suggestions
|
data/spec/google_suggest_spec.rb
CHANGED
data/spec/sample_ja.xml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<?xml version="1.0"?><toplevel><CompleteSuggestion><suggestion data="
|
1
|
+
<?xml version="1.0"?><toplevel><CompleteSuggestion><suggestion data="�O�[�O���}�b�v"/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O��"/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O���|��"/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O���A�[�X"/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O���h���C�u"/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O���t�H�g"/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O���J�����_�["/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O���A�J�E���g"/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O���A�i���e�B�N�X"/></CompleteSuggestion><CompleteSuggestion><suggestion data="�O�[�O���t�H�[��"/></CompleteSuggestion></toplevel>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_suggest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuya Sato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|