xiaohuangji 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xiaohuangji.rb +3 -3
- data/lib/xiaohuangji/simsimi.rb +6 -14
- data/xiaohuangji.gemspec +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17df627f74a5b77c903420c7b9ecece4fe1b4b66
|
4
|
+
data.tar.gz: e51ed8aa3472e7e7eaabc5cc16bf2ea9e6a462b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eec150fe66faa24bba53d0c4e12ac9e07bdf05d7df44fea16b530f9c2183846ec53a799fe4004ef4be480477a0169a975c8f87b3f45c8a46fee16b8aff323322
|
7
|
+
data.tar.gz: a5b4ffdd39143ddbbfcbf28d6c03c7a8b24a26b0fa7cd41495bfa8f01ddbf5a968b6c429f42bd538ac4e409ee1bee7d946d51eebbc53b8bd8149e7abbaebcf5c
|
data/lib/xiaohuangji.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
#Copyright (c) 2013-2015 zhhailon <zhhailon@gmail.com>
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) 2013-2015 zhhailon <zhhailon@gmail.com>
|
3
3
|
|
4
4
|
require 'xiaohuangji/simsimi'
|
5
5
|
|
6
6
|
module Xiaohuangji
|
7
|
-
def self.chat(msg='')
|
7
|
+
def self.chat(msg = '')
|
8
8
|
SimSimi.new.chat msg
|
9
9
|
end
|
10
10
|
end
|
data/lib/xiaohuangji/simsimi.rb
CHANGED
@@ -1,35 +1,27 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
#Copyright (c) 2013-2015 zhhailon <zhhailon@gmail.com>
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) 2013-2015 zhhailon <zhhailon@gmail.com>
|
3
3
|
|
4
4
|
require 'open-uri'
|
5
5
|
require 'json'
|
6
6
|
|
7
7
|
module Xiaohuangji
|
8
8
|
class SimSimi
|
9
|
+
attr_accessor :chat_url
|
9
10
|
def initialize
|
10
11
|
self.chat_url = 'http://www.simsimi.com/requestChat?lc=ch&ft=1.0&req=%s'
|
11
12
|
end
|
12
13
|
|
13
14
|
def chat(msg)
|
14
|
-
|
15
|
+
if !msg.nil? && !msg.empty?
|
15
16
|
ans = ''
|
16
|
-
open(URI.encode(chat_url % msg))
|
17
|
+
open(URI.encode(chat_url % msg)) do |f|
|
17
18
|
res = JSON.parse f.read
|
18
19
|
ans = res['res']
|
19
|
-
|
20
|
+
end
|
20
21
|
ans
|
21
22
|
else
|
22
23
|
'?'
|
23
24
|
end
|
24
25
|
end
|
25
|
-
|
26
|
-
private
|
27
|
-
def chat_url
|
28
|
-
@chat_url
|
29
|
-
end
|
30
|
-
|
31
|
-
def chat_url=(url='')
|
32
|
-
@chat_url = url
|
33
|
-
end
|
34
26
|
end
|
35
27
|
end
|
data/xiaohuangji.gemspec
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'xiaohuangji'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.5'
|
4
4
|
s.authors = ['ZHANG Hailong']
|
5
|
-
s.date = '2015-07-
|
5
|
+
s.date = '2015-07-18'
|
6
6
|
s.summary = 'A chatting robot based on SimSimi.'
|
7
7
|
s.description = 'Xiaohuangji is a chatting robot based on SimSimi.'
|
8
8
|
s.email = 'zhhailon@gmail.com'
|
9
9
|
s.homepage = 'https://github.com/zhhailon/my-xiaohuangji'
|
10
10
|
s.files = [
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
'xiaohuangji.gemspec',
|
12
|
+
'README.md',
|
13
|
+
'lib/xiaohuangji.rb',
|
14
|
+
'lib/xiaohuangji/simsimi.rb'
|
15
|
+
]
|
16
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xiaohuangji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ZHANG Hailong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Xiaohuangji is a chatting robot based on SimSimi.
|
14
14
|
email: zhhailon@gmail.com
|