rong_cloud_server 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82f88e70a08efe992ba2736c8db0ab8b4425589a
4
- data.tar.gz: d9efa695a5402e686f0d942836dcd4d6c027874e
3
+ metadata.gz: 467c538f9677d96d1d2c508ffb43d5ff0861196e
4
+ data.tar.gz: c61c622482007dd0a7ad00a5bebe6b10b8751180
5
5
  SHA512:
6
- metadata.gz: 964d72d2a924d9e8b5c11328fd67fc4a90fae37cede3640c3b18ebd6bef3a241d5fece396b802aeb1c35fb82e10dad66c72ceff003595b95277723467ea4e888
7
- data.tar.gz: 4ab2768d2e86928f927ef3b5da23bbe1d82aaf36240f73703599d9e0cb294b91ddbabc003ae2926e02cdbfd8e162e1d5a35bc709cf92f797c26646a02b22b9dd
6
+ metadata.gz: 8862213ffc65c7189e48e4d7fd3a6cd482fb740b928f829c1db81afddfed30549d8e05364a616eed4ea6a13ad7cbb32c6d0c8dbc7d46089f8f794c1bc690b09c
7
+ data.tar.gz: 5d7bf432889a2ec4084e7862d422fb4c539f4820b4a1d1a5282e89f15554bb9c24215d882b8be56f559f174ca83e59e6cffe12910b2dc42b46fbda81aa3c2e6e
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
- /config.yml
2
1
  .byebug_history
3
2
  rong_cloud.log
4
3
  /doc
5
- .yardoc/
4
+ .yardoc/
5
+ Gemfile.lock
6
+ coverage/
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ - 2.1
5
+ - 2.0
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'rake'
7
+ end
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  [RongCloud](http://rongcloud.cn/) Server API SDK in Ruby
2
2
  ===
3
+ [![Build Status](https://travis-ci.org/Martin91/rong_cloud.svg?branch=master)](https://travis-ci.org/Martin91/rong_cloud)
4
+ [![Coverage Status](https://coveralls.io/repos/github/Martin91/rong_cloud/badge.svg?branch=master)](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', '~> 0.0.2'
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.secret_key = "SECRET_KEY"
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
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs = ["test"]
6
+ t.pattern = "test/**/*_test.rb"
7
+
8
+ end
9
+ task :default => :test
@@ -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, :host, :logger
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.0'
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
- $settings.each do |setting, value|
11
- config.send("#{setting}=", value)
12
- end
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.0
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-02-25 00:00:00.000000000 Z
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
- - config.example.yml
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
@@ -1,3 +0,0 @@
1
- app_key: APP_KEY
2
- app_secret: APP_SECRET
3
- host: https://api.cn.ronghub.com
data/run_tests.sh DELETED
@@ -1 +0,0 @@
1
- echo "Dir.glob('./test/**/*_test.rb').each { |file| require file}" | ruby -Itest -Ilib