polylink_api 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95a0826a248317f30e0372c9cce792c863b239ae
4
- data.tar.gz: 9deb89aad40ba5208f616efd4b5278b910de37f7
3
+ metadata.gz: ed98dff3cc4c2404894c0cc8db169f7daa7d33da
4
+ data.tar.gz: 670ce00f365af2dad674d441465da7ff4bc13f88
5
5
  SHA512:
6
- metadata.gz: 01cfbff77bee1a5183d63ffedfc2fc28a200c5f81f319636b50f1d85047a7a3d5c5eb959dc8b36dcd624a17849711a868ef2e577cbaaf0c31357a5faa5c00ff6
7
- data.tar.gz: b335ca902ebdcffcc8135a51bcbbb571e4a18fa6f04fc01719bfff66f91773ded3f9cdcc762bb20a408d994efd1e66ca7eefb8665d6794ff1e811d35afc2480f
6
+ metadata.gz: ed9a339fc23af838d087a7b3570ae116cd538a5015fb1b3cbcd4c434e1fa9aa45f2bf94703d4d703e5bfdd7020d0d6f29d8a0fa764d976d8dbe4e6a3cc6937da
7
+ data.tar.gz: fa977dcbd7dc0716da4ac59217390f2b866199a65469834c3d4b3fd8502cb808b5ca6fe0d0173d87289679a6d9964a4bb246099b2aa20aa8ba63caa67925a1da
@@ -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 InvalidDataError, "开始时间不能大于结束时间"
58
- when "511" then raise InvalidDataError, "查询类型和开始结束时间不匹配"
59
- when "516" then raise InvalidDataError, "V2CID已存在"
60
- when "517" then raise InvalidDataError, "DID不存在"
61
- when "518" then raise InvalidDataError, "V2CID不存在"
62
- when "519" then raise InvalidDataError, "虚拟总机DID不存在"
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)
@@ -1,3 +1,3 @@
1
1
  module PolylinkApi
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-02 00:00:00.000000000 Z
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