rcloud 0.0.1
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 +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +105 -0
- data/Rakefile +9 -0
- data/lib/rcloud.rb +152 -0
- data/lib/rcloud/version.rb +3 -0
- data/rcloud.gemspec +27 -0
- data/test/test_rcloud.rb +188 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 56ce826f07b16ead28300941d10ec2301512d35e
|
4
|
+
data.tar.gz: da31518d2bb7110800e8682731e266dcd19fb5e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2d9e01f3e6dd5f6d18859f50345ec371a1443e0a2d25b976a6026f93949ebd561158b23d1ba0a21d5bb0a52c1b2e2d70e253e306f9dff5823084c3803e8b6a89
|
7
|
+
data.tar.gz: fa307cddcf4b92b0408c6390b4181cf64cff32f9679c937c7d1a778b564f6fd77e2b26db87eb53f5c5dcbe661e6d0759a85264f36669352180bf771c199a5fb2
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Linxiangyu
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# RCloud
|
2
|
+
|
3
|
+
融云 Ruby SDK
|
4
|
+
|
5
|
+
<http://docs.rongcloud.cn/>
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rcloud'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rcloud
|
22
|
+
|
23
|
+
## 使用
|
24
|
+
|
25
|
+
|
26
|
+
### 基本使用
|
27
|
+
|
28
|
+
使用 `RCloud::Request` 类生成一个请求实例,调用它的方法进行请求。
|
29
|
+
|
30
|
+
方法列表见下一个小节。
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
request = RCloud::Request.new("mgb7ka1nb5dfg", "krO8vJkvpu1yj")
|
34
|
+
p request.user_get_token("jjjj","","")
|
35
|
+
```
|
36
|
+
如果正常请求,会返回一个Hash对象,如
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
{"code"=>200, "userId"=>"fkdskf", "token"=>"cSM+0tuXKeQ8x1DHvzI8uj1M2VmLzSGbhpswesn2LhvH6WoIIAXxUBoMXfPT/DVHIq0Sl9S2VhNgUSr2U3LF3g=="}
|
40
|
+
```
|
41
|
+
|
42
|
+
|
43
|
+
### 方法名和 url 映射规则, 以及http参数
|
44
|
+
|
45
|
+
<http://docs.rongcloud.cn/server.html>
|
46
|
+
|
47
|
+
所有 Server API 的 url 会被映射为 Ruby 的方法,规则:`method_name = url.downcase.gsub(/\//, '_')[1..-1].to_sym`
|
48
|
+
|
49
|
+
比如: /user/getToken => user_gettoken
|
50
|
+
|
51
|
+
而 HTTP 的参数会按照文档次序映射为方法的参数。
|
52
|
+
|
53
|
+
如果融云API文档中允许传入多个参数,那么可以传入一个参数的值或者数组。
|
54
|
+
|
55
|
+
**例外**
|
56
|
+
|
57
|
+
'/chatroom/create' 和 '/group/sync' 两个 API 有的参数需要不定长度的键值对,所以实现上有一些例外。
|
58
|
+
|
59
|
+
`/chatroom/create` 的参数是一个 Hash, key 是 groupId, value 是 groupName
|
60
|
+
|
61
|
+
`/group/sync` 的第一个参数是 user, 第二个参数是一个 Hash, key 是 groupId, value 是 groupName
|
62
|
+
|
63
|
+
它们对应的方法名称也支持自定义规则。
|
64
|
+
|
65
|
+
### 自定义方法名和 url 映射规则
|
66
|
+
|
67
|
+
支持自定义url和方法映射规则。Proc接收一个 '/user/getToken' 这样的字符串参数,返回一个方法名字的 symbol对象。
|
68
|
+
|
69
|
+
```
|
70
|
+
map = Proc.new do |url|
|
71
|
+
url.downcase.gsub(/\//, '')[0..-1].to_sym
|
72
|
+
end
|
73
|
+
|
74
|
+
request = RCloud::Request.new("mgb7ka1nb5dfg", "krO8vJkvpu1yj", map)
|
75
|
+
|
76
|
+
request.usergettoken('fkdskf')
|
77
|
+
|
78
|
+
```
|
79
|
+
|
80
|
+
### 第三方依赖
|
81
|
+
|
82
|
+
SDK 使用 rest-client 进行访问,如果认证错误或者其他问题,会触发 RestClient::Exception
|
83
|
+
|
84
|
+
关于 rest-client: <https://github.com/rest-client/rest-client>
|
85
|
+
|
86
|
+
使用 <https://github.com/seattlerb/minitest> 作为测试框架
|
87
|
+
|
88
|
+
## Contributing
|
89
|
+
|
90
|
+
1. Fork it ( https://github.com/[my-github-username]/rcloud/fork )
|
91
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
92
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
93
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
94
|
+
5. Create a new Pull Request
|
95
|
+
|
96
|
+
## TODO
|
97
|
+
|
98
|
+
1. 更好的错误控制和反馈与日志输出
|
99
|
+
2. 产品级别的测试
|
100
|
+
3. 联系发布到官方页面
|
101
|
+
|
102
|
+
## Author
|
103
|
+
|
104
|
+
Lin Xiangyu
|
105
|
+
<lxyweb@gmail.com>
|
data/Rakefile
ADDED
data/lib/rcloud.rb
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
require "rcloud/version"
|
2
|
+
require "rest-client"
|
3
|
+
require 'digest/sha1'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
|
7
|
+
module RCloud
|
8
|
+
|
9
|
+
class Request
|
10
|
+
BASE_URL = "https://api.cn.rong.io"
|
11
|
+
|
12
|
+
URLS = ["/user/getToken",
|
13
|
+
"/user/refresh",
|
14
|
+
"/user/checkOnline",
|
15
|
+
"/user/block",
|
16
|
+
"/user/unblock",
|
17
|
+
"/user/block/query",
|
18
|
+
"/user/blacklist/add",
|
19
|
+
"/user/blacklist/remove",
|
20
|
+
"/user/blacklist/query",
|
21
|
+
"/message/private/publish",
|
22
|
+
"/message/system/publish",
|
23
|
+
"/message/group/publish",
|
24
|
+
"/message/chatroom/publish",
|
25
|
+
"/message/broadcast",
|
26
|
+
"/message/history",
|
27
|
+
"/message/history/delete",
|
28
|
+
"/group/sync",
|
29
|
+
"/group/create",
|
30
|
+
"/group/join",
|
31
|
+
"/group/quit",
|
32
|
+
"/group/dismiss",
|
33
|
+
"/group/refresh",
|
34
|
+
"/chatroom/create",
|
35
|
+
"/chatroom/destroy",
|
36
|
+
"/chatroom/query",
|
37
|
+
"/chatroom/user/query"]
|
38
|
+
|
39
|
+
SUFFIX = ".json"
|
40
|
+
|
41
|
+
PARAMS = [ [:userId, :name, :portraitUri], # user
|
42
|
+
[:userId, :name, :portraitUri],
|
43
|
+
[:userId],
|
44
|
+
[:userId, :minute], # block
|
45
|
+
[:userId],
|
46
|
+
[],
|
47
|
+
[:userId, :blackUserId], # blacklist
|
48
|
+
[:userId, :blackUserId],
|
49
|
+
[:userId],
|
50
|
+
[:fromUserId, :toUserId, :objectName, :content, :pushContent, :pushData ], #message
|
51
|
+
[:fromUserId, :toUserId, :objectName, :content, :pushContent, :pushData ],
|
52
|
+
[:fromUserId, :toGroupId, :objectName, :content, :pushContent, :pushData ],
|
53
|
+
[:fromUserId, :toChatroomId, :objectName, :content, :pushContent, :pushData ],
|
54
|
+
[:fromUserId, :objectName, :content, :pushContent, :pushData ],
|
55
|
+
[:date], # message history
|
56
|
+
[:date],
|
57
|
+
[:userId], # Group Sync redefine
|
58
|
+
[:userId, :groupId, :groupName] ,
|
59
|
+
[:userId, :groupId, :groupName] ,
|
60
|
+
[:userId, :groupId],
|
61
|
+
[:userId, :groupId],
|
62
|
+
[:groupId, :groupName],
|
63
|
+
[:userId],# Chatroom redefine
|
64
|
+
[:chatroomId],#
|
65
|
+
[:chatroomId],#
|
66
|
+
[:chatroomId]#
|
67
|
+
]
|
68
|
+
|
69
|
+
|
70
|
+
@@app_key = ""
|
71
|
+
@@app_sec = ""
|
72
|
+
@@mapping = Proc.new do |url|
|
73
|
+
url.downcase.gsub(/\//, '_')[1..-1].to_sym
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.creat_api_method(method_name, url, params)
|
77
|
+
self.send(:define_method, method_name) do |*args|
|
78
|
+
p = Hash.new
|
79
|
+
params.each_with_index do |k, i|
|
80
|
+
p[k] = *args[i]
|
81
|
+
p[k] = p[k][0].to_s
|
82
|
+
end
|
83
|
+
resp = nil
|
84
|
+
begin
|
85
|
+
resp = RestClient.post BASE_URL + url + SUFFIX , p , http_header
|
86
|
+
rescue => e
|
87
|
+
p e
|
88
|
+
end
|
89
|
+
result = JSON.parse(resp)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
def initialize(app_key, app_sec, mapping = nil)
|
96
|
+
@@app_key = app_key
|
97
|
+
@@app_sec = app_sec
|
98
|
+
@@mapping = mapping if mapping
|
99
|
+
|
100
|
+
URLS.each_with_index do |url, index|
|
101
|
+
Request.creat_api_method(@@mapping.call(url), url, PARAMS[index])
|
102
|
+
end
|
103
|
+
|
104
|
+
self.class.send(:define_method, @@mapping.call("/chatroom/create") ) do |hash|
|
105
|
+
p = {}
|
106
|
+
hash.each do |k,v|
|
107
|
+
p["chatroom[#{k}]"] = v
|
108
|
+
end
|
109
|
+
resp = RestClient.post BASE_URL + "/chatroom/create" + SUFFIX , p , http_header
|
110
|
+
result = JSON.parse(resp)
|
111
|
+
end
|
112
|
+
|
113
|
+
self.class.send(:define_method, @@mapping.call("/group/sync") ) do |*args|
|
114
|
+
p = {}
|
115
|
+
p["userId"] = args[0].to_s
|
116
|
+
hash = *args[1]
|
117
|
+
hash.each do |k,v|
|
118
|
+
p["group[#{k}]"] = v
|
119
|
+
end
|
120
|
+
resp = RestClient.post BASE_URL + "/group/sync" + SUFFIX , p , http_header
|
121
|
+
result = JSON.parse(resp)
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
def http_header
|
130
|
+
time = Time.now.to_i
|
131
|
+
r = Random.new
|
132
|
+
random = r.rand(100000000)
|
133
|
+
sig_str = @@app_sec + random.to_s + time.to_s
|
134
|
+
sig = Digest::SHA1.hexdigest sig_str
|
135
|
+
header = {
|
136
|
+
"RC-App-Key" => @@app_key,
|
137
|
+
"RC-Nonce" => random,
|
138
|
+
"RC-Timestamp" => time,
|
139
|
+
"RC-Signature" => sig
|
140
|
+
}
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
Agent = Request
|
146
|
+
Client = Request
|
147
|
+
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
|
data/rcloud.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rcloud/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rcloud"
|
8
|
+
spec.version = Rcloud::VERSION
|
9
|
+
spec.authors = ["Lin Xiangyu"]
|
10
|
+
spec.email = ["lxyweb@gmail.com"]
|
11
|
+
spec.summary = %q{RongCloud Ruby SDK}
|
12
|
+
spec.description = %q{RongCloud Ruby SDK.}
|
13
|
+
spec.homepage = "https://github.com/oa414/RCloud"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'rest_client', '~> 1.8.3' ,'>= 1.8.0'
|
22
|
+
spec.add_runtime_dependency 'json', '~> 1.8.2', '>= 1.8.0'
|
23
|
+
|
24
|
+
spec.add_development_dependency "minitest", '~> 5.6.0', '>= 5.6.0'
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
data/test/test_rcloud.rb
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
require "./lib/rcloud.rb"
|
2
|
+
|
3
|
+
|
4
|
+
require "minitest/autorun"
|
5
|
+
|
6
|
+
class TestMeme < Minitest::Test
|
7
|
+
|
8
|
+
|
9
|
+
USERA = "mockuser"
|
10
|
+
USERB = "mock_block"
|
11
|
+
GROUPA = "mock_group"
|
12
|
+
CHATROOMA = "1001"
|
13
|
+
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@request = RCloud::Request.new("mgb7ka1nb5dfg", "krO8vJkvpu1yj")
|
17
|
+
@request.user_gettoken(USERB)
|
18
|
+
@user_id = nil
|
19
|
+
@user_token = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
# user
|
23
|
+
|
24
|
+
def test_user_gettoken
|
25
|
+
# {"code":200, "USERA":"jlk456j5", "token":"sfd9823ihufi"}
|
26
|
+
resp = @request.user_gettoken(USERA)
|
27
|
+
@user_id = resp["user_id"]
|
28
|
+
@user_token = resp["token"]
|
29
|
+
assert_equal 200, resp["code"]
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_user_refresh
|
33
|
+
# {"code":200, "USERA":"jlk456j5", "token":"sfd9823ihufi"}
|
34
|
+
resp = @request.user_gettoken(USERA)
|
35
|
+
assert_equal 200, resp["code"]
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_user_checkonline
|
39
|
+
resp = @request.user_checkonline(USERA)
|
40
|
+
assert_equal 200, resp["code"]
|
41
|
+
end
|
42
|
+
|
43
|
+
# block
|
44
|
+
|
45
|
+
def test_user_block
|
46
|
+
resp = @request.user_block(USERA, 1)
|
47
|
+
assert_equal 200, resp["code"]
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_user_unblock
|
51
|
+
resp = @request.user_unblock(USERA)
|
52
|
+
assert_equal 200, resp["code"]
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_user_block_query
|
56
|
+
resp = @request.user_block_query()
|
57
|
+
assert_equal 200, resp["code"]
|
58
|
+
end
|
59
|
+
|
60
|
+
# blacklist
|
61
|
+
def test_user_blacklist_add
|
62
|
+
resp = @request.user_blacklist_add(USERA, USERB)
|
63
|
+
assert_equal 200, resp["code"]
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_user_blacklist_remove
|
68
|
+
resp = @request.user_blacklist_remove(USERA, USERB)
|
69
|
+
assert_equal 200, resp["code"]
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_user_blacklist_query
|
73
|
+
resp = @request.user_blacklist_query
|
74
|
+
assert_equal 200, resp["code"]
|
75
|
+
end
|
76
|
+
|
77
|
+
# Message
|
78
|
+
|
79
|
+
def test_message_private_publish
|
80
|
+
resp = @request.message_private_publish(USERA, USERB, "RC:TxtMsg", JSON.generate({"content" => "hello", "extra" => "helloExtra"}))
|
81
|
+
assert_equal 200, resp["code"]
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
def test_message_system_publish
|
86
|
+
resp = @request.message_system_publish(USERA, USERB, "RC:TxtMsg", JSON.generate({"content" => "hello", "extra" => "helloExtra"}))
|
87
|
+
assert_equal 200, resp["code"]
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_message_group_publish
|
91
|
+
resp = @request.group_create(USERA, "1001", GROUPA)
|
92
|
+
resp = @request.group_join(USERA, GROUPA)
|
93
|
+
resp = @request.message_group_publish(USERA, "1001", "RC:TxtMsg", JSON.generate({"content" => "hello", "extra" => "helloExtra"}))
|
94
|
+
assert_equal 200, resp["code"]
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_message_chatroom_publish
|
98
|
+
resp = @request.chatroom_create({CHATROOMA => GROUPA})
|
99
|
+
resp = @request.message_chatroom_publish(USERA, CHATROOMA, "RC:TxtMsg", JSON.generate({"content" => "hello", "extra" => "helloExtra"}))
|
100
|
+
assert_equal 200, resp["code"]
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_message_broadcast
|
104
|
+
resp = @request.message_broadcast(USERA, "RC:TxtMsg", JSON.generate({"content" => "hello", "extra" => "helloExtra"}))
|
105
|
+
assert_equal 200, resp["code"]
|
106
|
+
end
|
107
|
+
# History
|
108
|
+
|
109
|
+
def test_message_history
|
110
|
+
resp = @request.message_history(DateTime.now.strftime("%Y%m%d%H"))
|
111
|
+
assert_equal 200, resp["code"]
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_message_history_delete
|
115
|
+
resp = @request.message_history_delete("2015042523")
|
116
|
+
assert_equal 200, resp["code"]
|
117
|
+
end
|
118
|
+
|
119
|
+
# Group
|
120
|
+
|
121
|
+
def test_group_sync #
|
122
|
+
resp = @request.group_create(USERA, "1001", GROUPA)
|
123
|
+
assert_equal 200, resp["code"]
|
124
|
+
|
125
|
+
resp = @request.group_sync(USERA, {"1001" => GROUPA})
|
126
|
+
assert_equal 200, resp["code"]
|
127
|
+
|
128
|
+
resp = @request.group_sync(USERA)
|
129
|
+
assert_equal 200, resp["code"]
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_group_create
|
133
|
+
resp = @request.group_create([USERA, USERB], GROUPA, GROUPA)
|
134
|
+
assert_equal 200, resp["code"]
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_group_join
|
138
|
+
resp = @request.group_join([USERA,USERB], GROUPA)
|
139
|
+
assert_equal 200, resp["code"]
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_group_quit
|
143
|
+
resp = @request.group_quit([USERA, USERB], GROUPA)
|
144
|
+
assert_equal 200, resp["code"]
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_group_dismiss
|
149
|
+
resp = @request.group_dismiss(USERA, USERB)
|
150
|
+
assert_equal 200, resp["code"]
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_group_refresh #
|
155
|
+
resp = @request.group_refresh(GROUPA, GROUPA)
|
156
|
+
assert_equal 200, resp["code"]
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
# ChatRoom
|
161
|
+
|
162
|
+
def test_chatroom_create
|
163
|
+
resp = @request.chatroom_create({CHATROOMA => GROUPA})
|
164
|
+
assert_equal 200, resp["code"]
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_chatroom_destroy
|
168
|
+
resp = @request.chatroom_create({CHATROOMA => GROUPA})
|
169
|
+
resp = @request.chatroom_create({"123" => GROUPA})
|
170
|
+
resp = @request.chatroom_destroy([CHATROOMA, "123"])
|
171
|
+
assert_equal 200, resp["code"]
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_chatroom_query
|
175
|
+
resp = @request.chatroom_create({CHATROOMA => GROUPA})
|
176
|
+
resp = @request.chatroom_query(GROUPA)
|
177
|
+
assert_equal 200, resp["code"]
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_chatroom_user_query
|
181
|
+
resp = @request.chatroom_query(CHATROOMA)
|
182
|
+
assert_equal 200, resp["code"]
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
end
|
188
|
+
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rcloud
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lin Xiangyu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest_client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.8.3
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.8.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.8.3
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.8.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: json
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.8.2
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.8.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.8.2
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.8.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: minitest
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 5.6.0
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 5.6.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 5.6.0
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 5.6.0
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: bundler
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '1.7'
|
80
|
+
type: :development
|
81
|
+
prerelease: false
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - "~>"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '1.7'
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: rake
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '10.0'
|
94
|
+
type: :development
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '10.0'
|
101
|
+
description: RongCloud Ruby SDK.
|
102
|
+
email:
|
103
|
+
- lxyweb@gmail.com
|
104
|
+
executables: []
|
105
|
+
extensions: []
|
106
|
+
extra_rdoc_files: []
|
107
|
+
files:
|
108
|
+
- ".gitignore"
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- lib/rcloud.rb
|
114
|
+
- lib/rcloud/version.rb
|
115
|
+
- rcloud.gemspec
|
116
|
+
- test/test_rcloud.rb
|
117
|
+
homepage: https://github.com/oa414/RCloud
|
118
|
+
licenses:
|
119
|
+
- MIT
|
120
|
+
metadata: {}
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 2.4.3
|
138
|
+
signing_key:
|
139
|
+
specification_version: 4
|
140
|
+
summary: RongCloud Ruby SDK
|
141
|
+
test_files:
|
142
|
+
- test/test_rcloud.rb
|