naver-sdk 0.3.0 → 0.4.0
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 +8 -2
- data/README.md +34 -33
- data/lib/naver/client.rb +2 -0
- data/lib/naver/ext/hash/to_underscore_keys.rb +40 -0
- data/lib/naver/map.rb +2 -2
- data/lib/naver/papago.rb +6 -1
- data/lib/naver/sdk.rb +1 -0
- data/lib/naver/sdk/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 169e8f3de0474b1aafd74629d97c606f721bf728
|
|
4
|
+
data.tar.gz: f4d679fdf11f3287b42c3917fac0ae6c37f11127
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29b617d3bf7793a577969d2d025741c0a115cddc42a0b36041eb616d9f8bf73bda3feb685c87a655381fc2f56be99da314118e18552e3019a22e057179bfd98f
|
|
7
|
+
data.tar.gz: 57a587e7e8851029f32066856cd54c2f3d3fea3ad52409e15d2e6542fe77c05a82eff12b051200fa5c38578ff1646ce61e4eaf0d45c1dbeba9eb5001355a97f3
|
data/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
## [unreleased]
|
|
5
5
|
- No significant changes.
|
|
6
6
|
|
|
7
|
+
## [0.4.0] - 2017-06-26
|
|
8
|
+
- [breaking] JSON 출력 결과를 CamelCase 에서 underscore 변경
|
|
9
|
+
- [breaking] Naver::Papago.romanization 리턴값의 key 변경. s_first_name -> first_name,
|
|
10
|
+
a_items -> items
|
|
11
|
+
|
|
7
12
|
## [0.3.0] - 2017-06-26
|
|
8
13
|
- [new] 얼굴인식(Beta)
|
|
9
|
-
- [breaking] `Naver::Clova::tts` renamed to `Naver::Voice
|
|
14
|
+
- [breaking] `Naver::Clova::tts` renamed to `Naver::Voice.tts`.
|
|
10
15
|
- [breaking] `Naver::Shortenurl::url` renamed to `Naver::Shorturl::shorten`.
|
|
11
16
|
|
|
12
17
|
## [0.2.0] - 2017-06-25
|
|
@@ -22,4 +27,5 @@ All notable changes to this project will be documented in this file.
|
|
|
22
27
|
[0.1.0]: https://github.com/kimsuelim/naver-sdk-ruby/releases/tag/v0.1.0
|
|
23
28
|
[0.2.0]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.1.0...v0.2.0
|
|
24
29
|
[0.3.0]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.2.0...v0.3.0
|
|
25
|
-
[
|
|
30
|
+
[0.4.0]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.3.0...v0.4.0
|
|
31
|
+
[unreleased]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.4.0...HEAD
|
data/README.md
CHANGED
|
@@ -57,7 +57,7 @@ response = Naver::Vision.celebrity(image: "test/resources/park.png")
|
|
|
57
57
|
# => #<Naver::ObjectifiedHash:70286633240760 {hash: {
|
|
58
58
|
"info"=>{
|
|
59
59
|
"size"=>{"width"=>683, "height"=>377},
|
|
60
|
-
"
|
|
60
|
+
"face_count"=>1
|
|
61
61
|
},
|
|
62
62
|
"faces"=>[
|
|
63
63
|
{"celebrity"=>{"value"=>"박성웅", "confidence"=>1.0}}
|
|
@@ -74,16 +74,16 @@ puts response.faces[0].celebrity.value
|
|
|
74
74
|
```
|
|
75
75
|
response = Naver::Vision.face(image: "test/resources/park.png")
|
|
76
76
|
# => #<Naver::ObjectifiedHash:70286633075440 {hash: {
|
|
77
|
-
"info"=>{"size"=>{"width"=>683, "height"=>377}, "
|
|
77
|
+
"info"=>{"size"=>{"width"=>683, "height"=>377}, "face_count"=>1},
|
|
78
78
|
"faces"=>[
|
|
79
79
|
{
|
|
80
80
|
"roi"=>{"x"=>214, "y"=>106, "width"=>117, "height"=>117},
|
|
81
81
|
"landmark"=>{
|
|
82
|
-
"
|
|
83
|
-
"
|
|
82
|
+
"left_eye"=>{"x"=>241, "y"=>137},
|
|
83
|
+
"right_eye"=>{"x"=>296, "y"=>126},
|
|
84
84
|
"nose"=>{"x"=>271, "y"=>166},
|
|
85
|
-
"
|
|
86
|
-
"
|
|
85
|
+
"left_mouth"=>{"x"=>250, "y"=>195},
|
|
86
|
+
"right_mouth"=>{"x"=>309, "y"=>185}
|
|
87
87
|
},
|
|
88
88
|
"gender"=>{"value"=>"male", "confidence"=>0.999884},
|
|
89
89
|
"age"=>{"value"=>"44~48", "confidence"=>0.79507},
|
|
@@ -126,8 +126,8 @@ file = File.open("tts.mp3", "wb") { |f| f.write(response) }
|
|
|
126
126
|
```ruby
|
|
127
127
|
response = Naver::Papago.romanization(query: "김수림")
|
|
128
128
|
=> #<Naver::ObjectifiedHash:70284972145960 {hash: {
|
|
129
|
-
"
|
|
130
|
-
"
|
|
129
|
+
"first_name"=>"김",
|
|
130
|
+
"items"=>[
|
|
131
131
|
{"name"=>"Kim Soorim", "score"=>"99"},
|
|
132
132
|
{"name"=>"Kim Soolim", "score"=>"97"},
|
|
133
133
|
{"name"=>"Kim Surim", "score"=>"78"},
|
|
@@ -135,7 +135,7 @@ response = Naver::Papago.romanization(query: "김수림")
|
|
|
135
135
|
]}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
puts response.
|
|
138
|
+
puts response.items[0].name
|
|
139
139
|
# => "Kim Soorim"
|
|
140
140
|
```
|
|
141
141
|
|
|
@@ -148,11 +148,11 @@ response = Naver::Papago.translate(
|
|
|
148
148
|
text: "기술이 인간을 대체하는 것이 아니라 인간은 기술의 도움으로 더욱 창조적으로 될 것이라는 믿는다."
|
|
149
149
|
)
|
|
150
150
|
# => #<Naver::ObjectifiedHash:70362563050680 {hash: {
|
|
151
|
-
"
|
|
151
|
+
"translated_text"=>"To replace the technology not believe that humans are more creatively with the help of technology."
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
puts response.
|
|
155
|
+
puts response.translated_text
|
|
156
156
|
# => "To replace the technology not believe that humans are more creatively with the help of technology."
|
|
157
157
|
```
|
|
158
158
|
|
|
@@ -162,10 +162,11 @@ puts response.translatedText
|
|
|
162
162
|
|
|
163
163
|
```ruby
|
|
164
164
|
response = Naver::Map.geocode(query: "불정로 6")
|
|
165
|
+
# => <Naver::ObjectifiedHash:70145842773600 {hash: {:total=>1, :userquery=>"불정로 6", :items=>[{:address=>"경기도 성남시 분당구 불정로 6 NAVER그린팩토리", :addrdetail=>{:country=>"대한민국", :sido=>"경기도", :sigugun=>"성남시 분당구", :dongmyun=>"불정로", :rest=>" 6 NAVER그린팩토리"}, :is_road_address=>true, :point=>{:x=>127.1052133, :y=>37.3595316}}]}}
|
|
165
166
|
# => [#<Naver::ObjectifiedHash:70284981985920 {hash: {
|
|
166
167
|
"address"=>"경기도 성남시 분당구 불정로 6 NAVER그린팩토리",
|
|
167
168
|
"addrdetail"=>{"country"=>"대한민국", "sido"=>"경기도", "sigugun"=>"성남시 분당구", "dongmyun"=>"불정로", "rest"=>" 6 NAVER그린팩토리"},
|
|
168
|
-
"
|
|
169
|
+
"is_road_address"=>true,
|
|
169
170
|
"point"=>{"x"=>127.1052133, "y"=>37.3595316}}}
|
|
170
171
|
]
|
|
171
172
|
|
|
@@ -183,8 +184,8 @@ response = Naver::Map.reverse_geocode(lat: "127.1141382", lng: "37.3599968")
|
|
|
183
184
|
# => [#<Naver::ObjectifiedHash:70284981856220 {hash: {
|
|
184
185
|
"address"=>"경기도 성남시 분당구 정자동 257-1",
|
|
185
186
|
"addrdetail"=>{"country"=>"대한민국", "sido"=>"경기도", "sigugun"=>"성남시 분당구", "dongmyun"=>"정자동", "rest"=>"257-1"},
|
|
186
|
-
"
|
|
187
|
-
"
|
|
187
|
+
"is_adm_address"=>false,
|
|
188
|
+
"is_road_address"=>false,
|
|
188
189
|
"point"=>{"x"=>127.1164925, "y"=>37.3597611}}
|
|
189
190
|
},
|
|
190
191
|
...
|
|
@@ -205,7 +206,7 @@ response = Naver::Shorturl.shorten(url: "https://github.com/kimsuelim")
|
|
|
205
206
|
# => #<Naver::ObjectifiedHash:70284972276780 {hash: {
|
|
206
207
|
"hash"=>"Fr4K6WFj",
|
|
207
208
|
"url"=>"http://me2.do/Fr4K6WFj",
|
|
208
|
-
"
|
|
209
|
+
"org_url"=>"https://github.com/kimsuelim"}
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
puts response.url
|
|
@@ -226,7 +227,7 @@ Naver::Share.url(url: "https://github.com/kimsuelim", title: "The unofficial NAV
|
|
|
226
227
|
```ruby
|
|
227
228
|
search_results = Naver::Search.blog(query: "블로그")
|
|
228
229
|
# => <Naver::ObjectifiedHash:70284981057980 {hash: {
|
|
229
|
-
"
|
|
230
|
+
"last_build_date"=>"Sat, 24 Jun 2017 19:11:02 +0900", "total"=>26223046, "start"=>1, "display"=>10,
|
|
230
231
|
"items"=>[
|
|
231
232
|
{
|
|
232
233
|
"title"=>"<b>블로그</b>마케팅교육 어떻게 시작해야 할까요?",
|
|
@@ -251,14 +252,14 @@ puts search_results.items[0].bloggername
|
|
|
251
252
|
```ruby
|
|
252
253
|
search_results = Naver::Search.news(query: "뉴스")
|
|
253
254
|
# => #<Naver::ObjectifiedHash:70284981108020 {hash: {
|
|
254
|
-
"
|
|
255
|
+
"last_build_date"=>"Sat, 24 Jun 2017 19:17:32 +0900", "total"=>31804178, "start"=>1, "display"=>10,
|
|
255
256
|
"items"=>[
|
|
256
257
|
{
|
|
257
258
|
"title"=>"'믿듣맘무' 마마무, 걸그룹 음원차트 평정… 멜론 누적 이용자수 94만명 돌파",
|
|
258
259
|
"originallink"=>"http://enews24.tving.com/news/article.asp?nsID=1221358",
|
|
259
260
|
"link"=>"http://news.naver.com/main/read.nhn?mode=LSD&mid=sec&sid1=106&oid=404&aid=0000180862",
|
|
260
261
|
"description"=>"녹아져 있는, 밉지 않은 귀여운 허세가 인상적인 큐티 허세송이다. 한편 마마무는 24일 MBC '쇼! 음악중심' 무대에 오른다. 사진 = RBW 제공 이지영 기자 [Copyright ⓒ Asia No.1 연예<b>뉴스</b> enews24.net 무단전재 및 재배포 금지]",
|
|
261
|
-
"
|
|
262
|
+
"pub_date"=>"Sat, 24 Jun 2017 19:15:00 +0900"
|
|
262
263
|
},
|
|
263
264
|
...
|
|
264
265
|
]
|
|
@@ -272,7 +273,7 @@ puts search_results.items[0].title
|
|
|
272
273
|
```ruby
|
|
273
274
|
search_results = Naver::Search.book(query: "책")
|
|
274
275
|
# => #<Naver::ObjectifiedHash:70284982544600 {hash: {
|
|
275
|
-
"
|
|
276
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:08:46 +0900", "total"=>555896, "start"=>1, "display"=>10,
|
|
276
277
|
"items"=>[
|
|
277
278
|
{
|
|
278
279
|
"title"=>"너의 이름은",
|
|
@@ -309,7 +310,7 @@ puts response.adult
|
|
|
309
310
|
```ruby
|
|
310
311
|
search_results = Naver::Search.encyc(query: "백과 사전")
|
|
311
312
|
# => #<Naver::ObjectifiedHash:70284982397080 {hash: {
|
|
312
|
-
"
|
|
313
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:12:58 +0900", "total"=>4332, "start"=>1, "display"=>10,
|
|
313
314
|
"items"=>[
|
|
314
315
|
{
|
|
315
316
|
"title"=>"<b>백과사전</b>",
|
|
@@ -329,17 +330,17 @@ puts search_results.items[0].title
|
|
|
329
330
|
```ruby
|
|
330
331
|
search_results = Naver::Search.movie(query: "킬빌")
|
|
331
332
|
# => #<Naver::ObjectifiedHash:70284982296880 {hash: {
|
|
332
|
-
"
|
|
333
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:15:41 +0900", "total"=>3, "start"=>1, "display"=>3,
|
|
333
334
|
"items"=>[
|
|
334
335
|
{
|
|
335
336
|
"title"=>"<b>킬 빌</b> - 2부",
|
|
336
337
|
"link"=>"http://movie.naver.com/movie/bi/mi/basic.nhn?code=37493",
|
|
337
338
|
"image"=>"http://imgmovie.naver.com/mdi/mit110/0374/C7493-00.jpg",
|
|
338
339
|
"subtitle"=>"Kill Bill: Vol. 2",
|
|
339
|
-
"
|
|
340
|
+
"pub_date"=>"2004",
|
|
340
341
|
"director"=>"쿠엔틴 타란티노|",
|
|
341
342
|
"actor"=>"우마 서먼|데이빗 캐러딘|",
|
|
342
|
-
"
|
|
343
|
+
"user_rating"=>"7.48"
|
|
343
344
|
},
|
|
344
345
|
...
|
|
345
346
|
]
|
|
@@ -353,7 +354,7 @@ puts search_results.items[0].title
|
|
|
353
354
|
```ruby
|
|
354
355
|
search_results = Naver::Search.cafearticle(query: "카페글")
|
|
355
356
|
# => #<Naver::ObjectifiedHash:70284982183260 {hash: {
|
|
356
|
-
"
|
|
357
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:17:56 +0900", "total"=>216425, "start"=>1, "display"=>10,
|
|
357
358
|
"items"=>[
|
|
358
359
|
{
|
|
359
360
|
"title"=>"예전 <b>카페글</b> 복습하기",
|
|
@@ -374,7 +375,7 @@ puts search_results.items[0].title
|
|
|
374
375
|
```ruby
|
|
375
376
|
search_results = Naver::Search.kin(query: "지식인")
|
|
376
377
|
# => #<Naver::ObjectifiedHash:70284982086840 {hash: {
|
|
377
|
-
"
|
|
378
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:20:19 +0900", "total"=>6931274, "start"=>1, "display"=>10,
|
|
378
379
|
"items"=>[
|
|
379
380
|
{
|
|
380
381
|
"title"=>"<b>지식인</b> 디렉토리 변경",
|
|
@@ -393,7 +394,7 @@ puts search_results.items[0].title
|
|
|
393
394
|
```ruby
|
|
394
395
|
search_results = Naver::Search.local(query: "제주도")
|
|
395
396
|
# => #<Naver::ObjectifiedHash:70284981059020 {hash: {
|
|
396
|
-
"
|
|
397
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:51:22 +0900", "total"=>75791, "start"=>1, "display"=>10,
|
|
397
398
|
"items"=>[
|
|
398
399
|
{
|
|
399
400
|
"title"=>"제주특별자치도청",
|
|
@@ -402,7 +403,7 @@ search_results = Naver::Search.local(query: "제주도")
|
|
|
402
403
|
"description"=>"제주 뉴스, 생활민원, 여권발급, 문화, <b>제주도</b> 관광, 산업경제, 복지, 여성 정보 수록.",
|
|
403
404
|
"telephone"=>"",
|
|
404
405
|
"address"=>"제주특별자치도 제주시 연동 312-1 ",
|
|
405
|
-
"
|
|
406
|
+
"road_address"=>"제주특별자치도 제주시 문연로 6 ",
|
|
406
407
|
"mapx"=>"260641",
|
|
407
408
|
"mapy"=>"100237"
|
|
408
409
|
},
|
|
@@ -429,7 +430,7 @@ puts response.errata
|
|
|
429
430
|
```ruby
|
|
430
431
|
search_results = Naver::Search.webkr(query: "웹문서")
|
|
431
432
|
# => #<Naver::ObjectifiedHash:70284981547180 {hash: {
|
|
432
|
-
"
|
|
433
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:53:29 +0900", "total"=>1904994, "start"=>1, "display"=>10,
|
|
433
434
|
"items"=>[
|
|
434
435
|
{
|
|
435
436
|
"title"=>"카카오톡 <b>웹문서</b> 수집 인정 "다음 검색 연동 중단" - 오마이뉴스",
|
|
@@ -448,7 +449,7 @@ puts search_results.items[0].title
|
|
|
448
449
|
```ruby
|
|
449
450
|
search_results = Naver::Search.image(query: "이미지")
|
|
450
451
|
# => #<Naver::ObjectifiedHash:70284981346800 {hash: {
|
|
451
|
-
"
|
|
452
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:54:58 +0900", "total"=>1627087, "start"=>1, "display"=>10,
|
|
452
453
|
"items"=>[
|
|
453
454
|
{
|
|
454
455
|
"title"=>"볼매뿌뿌's StyleShare",
|
|
@@ -469,7 +470,7 @@ puts search_results.items[0].title
|
|
|
469
470
|
```ruby
|
|
470
471
|
search_results = Naver::Search.shop(query: "쇼핑")
|
|
471
472
|
# => #<Naver::ObjectifiedHash:70284981152140 {hash: {
|
|
472
|
-
"
|
|
473
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:56:19 +0900", "total"=>8895965, "start"=>1, "display"=>10,
|
|
473
474
|
"items"=>[
|
|
474
475
|
{
|
|
475
476
|
"title"=>"팩앤롤 접이식 휴대용 핸드 <b>쇼핑</b>카트",
|
|
@@ -478,8 +479,8 @@ search_results = Naver::Search.shop(query: "쇼핑")
|
|
|
478
479
|
"lprice"=>"10400",
|
|
479
480
|
"hprice"=>"0",
|
|
480
481
|
"mallName"=>"베이직기프트",
|
|
481
|
-
"
|
|
482
|
-
"
|
|
482
|
+
"product_id"=>"11449581836",
|
|
483
|
+
"product_type"=>"2"
|
|
483
484
|
},
|
|
484
485
|
...
|
|
485
486
|
]
|
|
@@ -493,7 +494,7 @@ puts search_results.items[0].title
|
|
|
493
494
|
```ruby
|
|
494
495
|
search_results = Naver::Search.doc(query: "전문자료")
|
|
495
496
|
# => #<Naver::ObjectifiedHash:70284980468480 {hash: {
|
|
496
|
-
"
|
|
497
|
+
"last_build_date"=>"Sat, 24 Jun 2017 20:57:34 +0900", "total"=>41554, "start"=>1, "display"=>10,
|
|
497
498
|
"items"=>[
|
|
498
499
|
{
|
|
499
500
|
"title"=>"이미지 검색 기능을 가진 문서간 <b>전문자료</b>의 유사도 검색 시스템",
|
data/lib/naver/client.rb
CHANGED
|
@@ -10,8 +10,10 @@ module Naver # :nodoc:
|
|
|
10
10
|
# Converts the response body to an ObjectifiedHash.
|
|
11
11
|
def self.parse(body)
|
|
12
12
|
if body.is_a?(Hash)
|
|
13
|
+
body = body.to_underscore_keys
|
|
13
14
|
ObjectifiedHash.new(body)
|
|
14
15
|
elsif body.is_a?(Array)
|
|
16
|
+
body = body.to_underscore_keys
|
|
15
17
|
body.collect! { |e| ObjectifiedHash.new(e) }
|
|
16
18
|
elsif body
|
|
17
19
|
true
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Hash.to_underscore_keys
|
|
2
|
+
class Hash
|
|
3
|
+
# Recursively converts CamelCase hash keys to underscore
|
|
4
|
+
def to_underscore_keys(value = self)
|
|
5
|
+
case value
|
|
6
|
+
when Array
|
|
7
|
+
value.map { |v| to_underscore_keys(v) }
|
|
8
|
+
when Hash
|
|
9
|
+
underscore_hash(value)
|
|
10
|
+
else
|
|
11
|
+
value
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def underscore_hash(value)
|
|
18
|
+
Hash[value.map { |k, v| [underscore_key(k), to_underscore_keys(v)] }]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def underscore_key(key)
|
|
22
|
+
if key.is_a?(Symbol)
|
|
23
|
+
underscore(key.to_s).to_sym
|
|
24
|
+
elsif key.is_a?(String)
|
|
25
|
+
underscore(key)
|
|
26
|
+
else
|
|
27
|
+
key # can't snakify anything except strings and symbols
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def underscore(camel_cased_word)
|
|
32
|
+
return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/
|
|
33
|
+
word = camel_cased_word.to_s.gsub("::".freeze, "/".freeze)
|
|
34
|
+
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2'.freeze)
|
|
35
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2'.freeze)
|
|
36
|
+
word.tr!("-".freeze, "_".freeze)
|
|
37
|
+
word.downcase!
|
|
38
|
+
word
|
|
39
|
+
end
|
|
40
|
+
end
|
data/lib/naver/map.rb
CHANGED
|
@@ -5,14 +5,14 @@ module Naver # :nodoc:
|
|
|
5
5
|
# 주소 -> 좌표 변환
|
|
6
6
|
# @param params [Hash] Params for the search
|
|
7
7
|
def geocode(params = {})
|
|
8
|
-
parse(JSON.parse(connection.get("/v1/map/geocode", params).body)["result"]
|
|
8
|
+
parse(JSON.parse(connection.get("/v1/map/geocode", params).body)["result"])
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
# 좌표 -> 주소 변환
|
|
12
12
|
# @param params [Hash] Params for the search
|
|
13
13
|
def reverse_geocode(params = {})
|
|
14
14
|
params = { query: "#{params[:lat]}, #{params[:lng]}" }
|
|
15
|
-
parse(JSON.parse(connection.get("/v1/map/reversegeocode", params).body)["result"]
|
|
15
|
+
parse(JSON.parse(connection.get("/v1/map/reversegeocode", params).body)["result"])
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|
data/lib/naver/papago.rb
CHANGED
|
@@ -17,7 +17,12 @@ module Naver # :nodoc:
|
|
|
17
17
|
# @return [Hash] 변환 결과
|
|
18
18
|
def romanization(query:)
|
|
19
19
|
params = { query: query }
|
|
20
|
-
|
|
20
|
+
result = JSON.parse(connection.get("/v1/krdict/romanization", params).body)["aResult"][0]
|
|
21
|
+
if result
|
|
22
|
+
result["firstName"] = result.delete("sFirstName")
|
|
23
|
+
result["items"] = result.delete("aItems")
|
|
24
|
+
end
|
|
25
|
+
parse(result)
|
|
21
26
|
end
|
|
22
27
|
end
|
|
23
28
|
end
|
data/lib/naver/sdk.rb
CHANGED
data/lib/naver/sdk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: naver-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Surim Kim
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-06-
|
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -136,6 +136,7 @@ files:
|
|
|
136
136
|
- lib/naver/config.rb
|
|
137
137
|
- lib/naver/connection.rb
|
|
138
138
|
- lib/naver/error.rb
|
|
139
|
+
- lib/naver/ext/hash/to_underscore_keys.rb
|
|
139
140
|
- lib/naver/map.rb
|
|
140
141
|
- lib/naver/oauth.rb
|
|
141
142
|
- lib/naver/objectified_hash.rb
|