polylink_api 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/polylink_api/helper.rb +6 -6
- data/lib/polylink_api/version.rb +1 -1
- data/lib/polylink_api.rb +2 -0
- data/polylink_api.gemspec +1 -1
- data/spec/lib/polylink_api/helper_spec.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed98dff3cc4c2404894c0cc8db169f7daa7d33da
|
4
|
+
data.tar.gz: 670ce00f365af2dad674d441465da7ff4bc13f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed9a339fc23af838d087a7b3570ae116cd538a5015fb1b3cbcd4c434e1fa9aa45f2bf94703d4d703e5bfdd7020d0d6f29d8a0fa764d976d8dbe4e6a3cc6937da
|
7
|
+
data.tar.gz: fa977dcbd7dc0716da4ac59217390f2b866199a65469834c3d4b3fd8502cb808b5ca6fe0d0173d87289679a6d9964a4bb246099b2aa20aa8ba63caa67925a1da
|
data/lib/polylink_api/helper.rb
CHANGED
@@ -54,12 +54,12 @@ module PolylinkApi
|
|
54
54
|
case code
|
55
55
|
when "501" then raise AuthenticationError, "无法登陆远程服务器"
|
56
56
|
when "502" then raise InvalidParameterError, "参数格式错误"
|
57
|
-
when "510" then raise
|
58
|
-
when "511" then raise
|
59
|
-
when "516" then raise
|
60
|
-
when "517" then raise
|
61
|
-
when "518" then raise
|
62
|
-
when "519" then raise
|
57
|
+
when "510" then raise InvalidParameterError, "开始时间不能大于结束时间"
|
58
|
+
when "511" then raise InvalidParameterError, "查询类型和开始结束时间不匹配"
|
59
|
+
when "516" then raise AlreadyExistedError, "V2CID已存在"
|
60
|
+
when "517" then raise NotExistError, "DID不存在"
|
61
|
+
when "518" then raise NotExistError, "V2CID不存在"
|
62
|
+
when "519" then raise NotExistError, "虚拟总机DID不存在"
|
63
63
|
when "600" then raise InvalidResponseError, "远程服务器发生未知错误"
|
64
64
|
end
|
65
65
|
return get_response_data(method, result)
|
data/lib/polylink_api/version.rb
CHANGED
data/lib/polylink_api.rb
CHANGED
@@ -13,6 +13,8 @@ module PolylinkApi
|
|
13
13
|
InvalidMethodError = Class.new(Error)
|
14
14
|
InvalidParameterError = Class.new(Error)
|
15
15
|
InvalidDataError = Class.new(InvalidParameterError)
|
16
|
+
NotExistError = Class.new(InvalidDataError)
|
17
|
+
AlreadyExistedError = Class.new(InvalidDataError)
|
16
18
|
UnknownError = Class.new(Error)
|
17
19
|
|
18
20
|
def self.setup
|
data/polylink_api.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = PolylinkApi::VERSION
|
9
9
|
spec.authors = ["liuzelei"]
|
10
10
|
spec.email = ["liuzelei@gmail.com"]
|
11
|
-
spec.summary = '
|
11
|
+
spec.summary = '聚领通讯对接'
|
12
12
|
spec.description = '跟聚领对接的接口'
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
@@ -43,6 +43,10 @@ describe "Helper" do
|
|
43
43
|
expect { PolylinkApi::Helper.get_response(:unknown, { unknown_response: { out: "502" } }) }.to raise_error(PolylinkApi::InvalidParameterError)
|
44
44
|
expect { PolylinkApi::Helper.get_response(:unknown, { unknown_response: { out: "510" } }) }.to raise_error(PolylinkApi::InvalidParameterError)
|
45
45
|
expect { PolylinkApi::Helper.get_response(:unknown, { unknown_response: { out: "511" } }) }.to raise_error(PolylinkApi::InvalidParameterError)
|
46
|
+
expect { PolylinkApi::Helper.get_response(:unknown, { unknown_response: { out: "516" } }) }.to raise_error(PolylinkApi::AlreadyExistedError)
|
47
|
+
expect { PolylinkApi::Helper.get_response(:unknown, { unknown_response: { out: "517" } }) }.to raise_error(PolylinkApi::NotExistError)
|
48
|
+
expect { PolylinkApi::Helper.get_response(:unknown, { unknown_response: { out: "518" } }) }.to raise_error(PolylinkApi::NotExistError)
|
49
|
+
expect { PolylinkApi::Helper.get_response(:unknown, { unknown_response: { out: "519" } }) }.to raise_error(PolylinkApi::NotExistError)
|
46
50
|
expect { PolylinkApi::Helper.get_response(:unknown, { unknown_response: { out: "600" } }) }.to raise_error(PolylinkApi::InvalidResponseError)
|
47
51
|
data = { unknown_response: { out: "500" } }
|
48
52
|
expect(PolylinkApi::Helper.get_response(:unknown, data)).to eq(nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polylink_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- liuzelei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -175,7 +175,7 @@ rubyforge_project:
|
|
175
175
|
rubygems_version: 2.4.5
|
176
176
|
signing_key:
|
177
177
|
specification_version: 4
|
178
|
-
summary: "
|
178
|
+
summary: "聚领通讯对接"
|
179
179
|
test_files:
|
180
180
|
- spec/config/mongoid.yml
|
181
181
|
- spec/config/test_voice.wav
|