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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +53 -3
  3. data/lib/twsms2/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c9b64329c26980a4442660b5d63122cf0e0f716
4
- data.tar.gz: d9c410f2c1024f1c2debc649d1ece684e1856427
3
+ metadata.gz: d39c490008149fc9f2d6a6738c1de1bdcba3ed8b
4
+ data.tar.gz: 1db018aafffe92c2124f607ded73d47d1959c7b6
5
5
  SHA512:
6
- metadata.gz: 4a604ca2daab6d18ce54609f2b0c85aa877d7c03c11a2bc7a55b540a4fb08711b79d3d5845fe43b48161df8cc68b2650a34fca050ab907ffcc0480d873a55e59
7
- data.tar.gz: d85225365844f09670f052985419df9d43615bf77c728d170c3e22c45c723fe61340e374fbc3b139182d4682b9cb95e23c55fedb47226e49bc84a9038a7444f0
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.1.0'
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
  例外狀況的處理
@@ -1,3 +1,3 @@
1
1
  module Twsms2
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
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.0
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-05 00:00:00.000000000 Z
11
+ date: 2016-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler