ucpaas 0.1.3 → 0.1.4
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/README.md +28 -1
- data/lib/ucpaas/call.rb +7 -5
- data/lib/ucpaas/manage.rb +3 -3
- data/lib/ucpaas/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8b2d12ecffd9b5cf37b8afef1368399919e31e4
|
4
|
+
data.tar.gz: 6a011b30867a62b5fa364d52c9cabbe5249ae322
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a794a345fd96d553191a9ef48afcd9b61d6a057f37a91d31dd3d05c9115863dd1c79fa2a55d30af322558e113f4841733fccf0e5292e1e11d9bdc5499d2830e7
|
7
|
+
data.tar.gz: e088c774e4d1d650451befe3ae83f6b6e8f8fa22756dcb13701b22311f5d325eb0825942d613ccae6d84de09b6a411387d9cc81cda62fcbec15845a62cbf41fc
|
data/README.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1
1
|
# 云之讯 UCPAAS Ruby REST API Client
|
2
|
+
[](https://circleci.com/gh/lazing/ucpaas-rb)
|
3
|
+
[](http://badge.fury.io/rb/ucpaas)
|
2
4
|
|
3
|
-
|
5
|
+
https://github.com/lazing/ucpaas-rb
|
6
|
+
|
7
|
+
针对云之讯 Rest 接口(http://docs.ucpaas.com/doku.php) 做实现
|
8
|
+
|
9
|
+
## 使用方式
|
10
|
+
````ruby
|
11
|
+
gem 'ucpaas'
|
12
|
+
|
13
|
+
# worker.rb
|
14
|
+
|
15
|
+
client = Ucpaas::Client.new 'sid', 'token'
|
16
|
+
|
17
|
+
# 短信
|
18
|
+
client.send_sms 'appid', 'tmp_id', 'mobile', 'param1', 'param2', ...
|
19
|
+
|
20
|
+
# 根据手机号码创建或获取账户
|
21
|
+
client.find_or_create_client 'appid', '+8618888888888'
|
22
|
+
|
23
|
+
# 根据号码创建双向回拨(未使用的号码会自动创建账号),最后的 hash 用于提供可选参数,参考 ucpaas 文档
|
24
|
+
client.dull_call('appid', 'from_mobile', 'to_mobile', fromSerNum: '400xxxxxxx')
|
25
|
+
|
26
|
+
````
|
27
|
+
|
28
|
+
|
29
|
+
## 贡献
|
30
|
+
新功能请直接提交 Merge Request
|
data/lib/ucpaas/call.rb
CHANGED
@@ -5,11 +5,13 @@ module Ucpaas
|
|
5
5
|
client = find_or_create_client(app_id, from_number)
|
6
6
|
client_number = client['clientNumber']
|
7
7
|
data = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
callback: {
|
9
|
+
appId: app_id,
|
10
|
+
fromClient: client_number,
|
11
|
+
to: to_number
|
12
|
+
}.merge(options)
|
13
|
+
}
|
14
|
+
response = post('/Calls/callBack.json', data)
|
13
15
|
response['resp']['callback']
|
14
16
|
end
|
15
17
|
|
data/lib/ucpaas/manage.rb
CHANGED
@@ -3,14 +3,14 @@ module Ucpaas
|
|
3
3
|
module Manage
|
4
4
|
def find_or_create_client(app_id, mobile, options = {})
|
5
5
|
mob = mobile.gsub(/^\+?86/, '')
|
6
|
-
client_info = get('/ClientsByMobile', appId: app_id, mobile: mob)
|
6
|
+
client_info = get('/ClientsByMobile.json', appId: app_id, mobile: mob)
|
7
7
|
return client_info['resp']['client'] if client_info['resp']['client']
|
8
8
|
params = {
|
9
9
|
appId: app_id,
|
10
10
|
clientType: 0,
|
11
11
|
mobile: mob
|
12
12
|
}.merge(options)
|
13
|
-
new_client = post('/Clients', params)
|
13
|
+
new_client = post('/Clients.json', params)
|
14
14
|
new_client['resp']['client']
|
15
15
|
end
|
16
16
|
|
@@ -22,7 +22,7 @@ module Ucpaas
|
|
22
22
|
limit: limit
|
23
23
|
}
|
24
24
|
}
|
25
|
-
response = post('/clientList', params)
|
25
|
+
response = post('/clientList.json', params)
|
26
26
|
response['resp']['client']
|
27
27
|
end
|
28
28
|
end
|
data/lib/ucpaas/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucpaas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Wong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|