rong_cloud_server 0.1.0 → 0.1.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 +4 -4
- data/.gitignore +3 -2
- data/.travis.yml +5 -0
- data/Gemfile +7 -0
- data/README.md +7 -3
- data/Rakefile +9 -0
- data/lib/rong_cloud/configuration.rb +2 -10
- data/rong_cloud.gemspec +5 -1
- data/test/rong_cloud/configuration_test.rb +0 -6
- data/test/rong_cloud/services/chatroom_test.rb +0 -1
- data/test/test_helper.rb +16 -6
- metadata +48 -5
- data/config.example.yml +0 -3
- data/run_tests.sh +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 467c538f9677d96d1d2c508ffb43d5ff0861196e
|
|
4
|
+
data.tar.gz: c61c622482007dd0a7ad00a5bebe6b10b8751180
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8862213ffc65c7189e48e4d7fd3a6cd482fb740b928f829c1db81afddfed30549d8e05364a616eed4ea6a13ad7cbb32c6d0c8dbc7d46089f8f794c1bc690b09c
|
|
7
|
+
data.tar.gz: 5d7bf432889a2ec4084e7862d422fb4c539f4820b4a1d1a5282e89f15554bb9c24215d882b8be56f559f174ca83e59e6cffe12910b2dc42b46fbda81aa3c2e6e
|
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
[RongCloud](http://rongcloud.cn/) Server API SDK in Ruby
|
|
2
2
|
===
|
|
3
|
+
[](https://travis-ci.org/Martin91/rong_cloud)
|
|
4
|
+
[](https://coveralls.io/github/Martin91/rong_cloud?branch=master)
|
|
3
5
|
|
|
4
6
|
To view the README in Chinese, visit [README.zh-CN.md](./README.zh-CN.md)
|
|
5
7
|
|
|
@@ -15,16 +17,18 @@ This repository implements most essential apis for [RongCloud Server API](http:/
|
|
|
15
17
|
or, install it in Gemfile:
|
|
16
18
|
|
|
17
19
|
```ruby
|
|
18
|
-
gem 'rong_cloud_server'
|
|
20
|
+
gem 'rong_cloud_server'
|
|
19
21
|
```
|
|
20
22
|
|
|
21
23
|
2. Append the following configurations in a initializer file:
|
|
22
24
|
|
|
23
25
|
```ruby
|
|
26
|
+
require 'rong_cloud'
|
|
27
|
+
|
|
24
28
|
RongCloud.configure do |config|
|
|
25
29
|
config.app_key = "APP_KEY"
|
|
26
|
-
config.
|
|
27
|
-
config.host = "http://api.cn.ronghub.com" # default: https://api.cn.ronghub.com, use http here is just convenient for debugging
|
|
30
|
+
config.app_secret = "SECRET_KEY"
|
|
31
|
+
# config.host = "http://api.cn.ronghub.com" # default: https://api.cn.ronghub.com, use http here is just convenient for debugging
|
|
28
32
|
end
|
|
29
33
|
```
|
|
30
34
|
3. Use the instance of `RongCloud::Service` to talk to RongCloud Server:
|
data/Rakefile
ADDED
|
@@ -8,22 +8,14 @@ module RongCloud
|
|
|
8
8
|
DEFAULT_HOST = "https://api.cn.ronghub.com".freeze
|
|
9
9
|
|
|
10
10
|
module ModuleMethods
|
|
11
|
-
attr_accessor :app_key, :app_secret
|
|
11
|
+
attr_accessor :app_key, :app_secret
|
|
12
|
+
attr_writer :host
|
|
12
13
|
|
|
13
14
|
# Fetch the api host, the default is: https://api.cn.ronghub.com
|
|
14
15
|
#
|
|
15
16
|
def host
|
|
16
17
|
@host || DEFAULT_HOST
|
|
17
18
|
end
|
|
18
|
-
|
|
19
|
-
# Fetch the logger, the default is STDOUT
|
|
20
|
-
def logger
|
|
21
|
-
@logger || default_logger
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def default_logger
|
|
25
|
-
@default_logger ||= ::Logger.new(STDOUT)
|
|
26
|
-
end
|
|
27
19
|
end
|
|
28
20
|
extend ModuleMethods
|
|
29
21
|
end
|
data/rong_cloud.gemspec
CHANGED
|
@@ -4,10 +4,14 @@ Gem::Specification.new do |s|
|
|
|
4
4
|
s.require_path = 'lib'
|
|
5
5
|
s.summary = 'RongCloud Server API SDK'
|
|
6
6
|
s.description = 'RongCloud Server API in Ruby,http://www.rongcloud.cn/docs/server.html'
|
|
7
|
-
s.version = '0.1.
|
|
7
|
+
s.version = '0.1.1'
|
|
8
8
|
s.files = `git ls-files`.split("\n")
|
|
9
9
|
s.authors = ['Martin Hong']
|
|
10
10
|
s.email = 'hongzeqin@gmail.com'
|
|
11
11
|
s.homepage = 'http://blog.hackerpie.com/rong_cloud/'
|
|
12
12
|
s.license = 'MIT'
|
|
13
|
+
|
|
14
|
+
s.add_development_dependency 'minitest', '>= 3'
|
|
15
|
+
s.add_development_dependency 'byebug'
|
|
16
|
+
s.add_development_dependency 'coveralls'
|
|
13
17
|
end
|
|
@@ -18,12 +18,6 @@ module RongCloud
|
|
|
18
18
|
assert_equal "test_secret", RongCloud::Configuration.app_secret
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def test_logger_setting_and_reading
|
|
22
|
-
logger = ::Logger.new("rong_cloud.log")
|
|
23
|
-
RongCloud::Configuration.logger = logger
|
|
24
|
-
assert_equal logger, RongCloud::Configuration.logger
|
|
25
|
-
end
|
|
26
|
-
|
|
27
21
|
def test_default_host_and_setting_and_reading
|
|
28
22
|
assert_equal "https://api.cn.ronghub.com", RongCloud::Configuration.host
|
|
29
23
|
RongCloud::Configuration.host = "http://other.host.com"
|
|
@@ -46,7 +46,6 @@ module RongCloud
|
|
|
46
46
|
def test_query_chatroom_with_existed_chatroom_ids
|
|
47
47
|
create_chatrooms({10007 => "room7", 10008 => "room8"})
|
|
48
48
|
chatrooms = @service.query_chatroom(%w(10007 10008))["chatRooms"]
|
|
49
|
-
chatroom_ids = chatrooms.map{ |chatroom| chatroom["chrmId"] }
|
|
50
49
|
room = chatrooms.detect{ |chatroom| chatroom["chrmId"] == "10007" }
|
|
51
50
|
assert_equal 2, chatrooms.count
|
|
52
51
|
assert_equal "room7", room["name"]
|
data/test/test_helper.rb
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'simplecov'
|
|
3
|
+
require 'coveralls'
|
|
4
|
+
|
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
|
6
|
+
SimpleCov::Formatter::HTMLFormatter,
|
|
7
|
+
Coveralls::SimpleCov::Formatter
|
|
8
|
+
]
|
|
9
|
+
SimpleCov.start
|
|
10
|
+
rescue LoadError => e
|
|
11
|
+
warn e.message
|
|
12
|
+
end
|
|
13
|
+
|
|
1
14
|
require 'minitest/autorun'
|
|
2
15
|
require 'byebug'
|
|
3
16
|
require 'rong_cloud'
|
|
4
|
-
require 'yaml'
|
|
5
|
-
|
|
6
|
-
$settings = YAML.load_file("./config.yml")
|
|
7
17
|
|
|
8
18
|
def rong_cloud_configure_with_settings
|
|
9
19
|
RongCloud.configure do |config|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
config.app_key = ENV["RONGCLOUD_APP_KEY"]
|
|
21
|
+
config.app_secret = ENV["RONGCLOUD_APP_SECRET"]
|
|
22
|
+
config.host = ENV["RONGCLOUD_API_HOST"] || "https://api.cn.ronghub.com"
|
|
13
23
|
end
|
|
14
24
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,57 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rong_cloud_server
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Hong
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
12
|
-
dependencies:
|
|
11
|
+
date: 2017-03-19 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: minitest
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: byebug
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: coveralls
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
13
55
|
description: RongCloud Server API in Ruby,http://www.rongcloud.cn/docs/server.html
|
|
14
56
|
email: hongzeqin@gmail.com
|
|
15
57
|
executables: []
|
|
@@ -17,9 +59,11 @@ extensions: []
|
|
|
17
59
|
extra_rdoc_files: []
|
|
18
60
|
files:
|
|
19
61
|
- ".gitignore"
|
|
62
|
+
- ".travis.yml"
|
|
63
|
+
- Gemfile
|
|
20
64
|
- README.md
|
|
21
65
|
- README.zh-CN.md
|
|
22
|
-
-
|
|
66
|
+
- Rakefile
|
|
23
67
|
- lib/core_ext/array.rb
|
|
24
68
|
- lib/rong_cloud.rb
|
|
25
69
|
- lib/rong_cloud/configuration.rb
|
|
@@ -35,7 +79,6 @@ files:
|
|
|
35
79
|
- lib/rong_cloud/services/wordfilter.rb
|
|
36
80
|
- lib/rong_cloud/signature.rb
|
|
37
81
|
- rong_cloud.gemspec
|
|
38
|
-
- run_tests.sh
|
|
39
82
|
- test/rong_cloud/configuration_test.rb
|
|
40
83
|
- test/rong_cloud/request_test.rb
|
|
41
84
|
- test/rong_cloud/service_test_setup.rb
|
data/config.example.yml
DELETED
data/run_tests.sh
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
echo "Dir.glob('./test/**/*_test.rb').each { |file| require file}" | ruby -Itest -Ilib
|