twsms2 1.2.0 → 1.2.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/README.md +53 -3
- data/lib/twsms2/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: d39c490008149fc9f2d6a6738c1de1bdcba3ed8b
|
4
|
+
data.tar.gz: 1db018aafffe92c2124f607ded73d47d1959c7b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67f2cc587cbbfaa478827e217b3d5d4451e68f6d0fb7f53776d2a0b7b6899e7483bd58f2ad20c5ec2be5ffea35e4743e3b8991645433ef3ef5a5718afbc57931
|
7
|
+
data.tar.gz: ae2e987cfbd410d852c064b290a583ca84d2ea9d41c319ee7a250e6870009bc69a136930c57ebe20d0d1d1b84e7c4287c46a64575332bcb8688c1ade197fda9b
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Ruby 2 以上的版本,也可在 Ruby On Rails 專案引入
|
|
22
22
|
請在您的 Ruby 或 Rails 專案裡的 Gemfile 加入以下指令
|
23
23
|
|
24
24
|
```ruby
|
25
|
-
gem 'twsms2', '~> 1.
|
25
|
+
gem 'twsms2', '~> 1.2.0'
|
26
26
|
```
|
27
27
|
|
28
28
|
然後執行 bundle install 更新套件組
|
@@ -145,7 +145,7 @@ error code 的部分,請以 台灣簡訊 API 文件的定義為主,本套件
|
|
145
145
|
|
146
146
|
----
|
147
147
|
|
148
|
-
###
|
148
|
+
### 查詢目前帳號所持有的簡訊餘額
|
149
149
|
|
150
150
|
若你需要查詢您會員帳號的簡訊餘額,可以用以下指令處理
|
151
151
|
|
@@ -153,7 +153,7 @@ error code 的部分,請以 台灣簡訊 API 文件的定義為主,本套件
|
|
153
153
|
sms_client.get_balance
|
154
154
|
```
|
155
155
|
|
156
|
-
###
|
156
|
+
### 查詢目前帳號所持有的簡訊餘額 的 回傳結果
|
157
157
|
|
158
158
|
#### 得到簡訊餘額
|
159
159
|
|
@@ -176,6 +176,56 @@ message_quota 則是簡訊餘額,代表你還剩幾封可以用,若為 0 就
|
|
176
176
|
{:access_success=>false, :message_quota=>0, :error=>"TWSMS:00010"}
|
177
177
|
```
|
178
178
|
|
179
|
+
### 查詢特定的簡訊發送狀態
|
180
|
+
|
181
|
+
若你需要查詢特定的簡訊發送狀態,您可以指定 手機號碼 跟 message id 向簡訊商查詢該封簡訊最後是否已發送成功
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
sms_client.get_message_status(message_id: '在 send_message 得到的 message_id', phone_number: '手機號碼')
|
185
|
+
```
|
186
|
+
|
187
|
+
### 查詢特定的簡訊發送狀態 的 回傳結果
|
188
|
+
|
189
|
+
#### 得到發送狀況
|
190
|
+
|
191
|
+
當你執行完成後,get_message_status 方法會回傳一組 hash 型態的結果
|
192
|
+
|
193
|
+
只要 access_success 的值為 true 就一定代表系統有成功取得資料
|
194
|
+
|
195
|
+
is_delivered 代表是否已寄到用戶手機,true 為是、false 為有發生 delivered 以外的狀況
|
196
|
+
|
197
|
+
message_status 代表訊息狀態,可以知道是否已抵達 或是 發生通信上的錯誤 等等的相關資訊
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
{:access_success=>true, :is_delivered=>true, :message_status=>"delivered", :error=>nil}
|
201
|
+
```
|
202
|
+
|
203
|
+
#### get_message_status 裡的 message_status 涵義
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
'delivered' # 簡訊已抵達
|
207
|
+
'expired' # 簡訊寄送超過有效時間
|
208
|
+
'deleted' # 已被刪除
|
209
|
+
'undelivered' # 無法送達
|
210
|
+
'transmitting' # 傳輸中,正在接收
|
211
|
+
'unknown' # 未知錯誤,可能無效
|
212
|
+
'rejected' # 被拒絕
|
213
|
+
'incorrect_sms_system_syntax' # 簡訊商編碼錯誤
|
214
|
+
'incorrect_phone_number' # 不正確的電話號碼
|
215
|
+
'incorrect_content' # 不正確的內容
|
216
|
+
'sms_system_other_error' # 簡訊商系統錯誤
|
217
|
+
'illegal_content' # 不合法的簡訊內容
|
218
|
+
'status_undefined' # 核心 API 無法得知狀況
|
219
|
+
```
|
220
|
+
|
221
|
+
#### 發生錯誤時
|
222
|
+
|
223
|
+
若 access_success 為 false 則表示過程有出現錯誤,同時 is_delivered 會為 false,message_status 也會是 nil
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
{:access_success=>false, :is_delivered=>false, :message_status=>nil, :error=>"TWSMS:00010"})
|
227
|
+
```
|
228
|
+
|
179
229
|
----
|
180
230
|
|
181
231
|
例外狀況的處理
|
data/lib/twsms2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twsms2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guanting Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|