twsms2 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 548eb03c93dd04ba44a85593a17e14a6d77c85da
4
- data.tar.gz: 0eb4402e4e51a566c8476b88d84a43a9c5b40993
3
+ metadata.gz: 604e4232d10dd76ea6064e215fae633f8b020746
4
+ data.tar.gz: 5585e90bff7241bdd4bafdf2562e4e3848b6fed6
5
5
  SHA512:
6
- metadata.gz: 38bd3975a7334dddb430b45269e3f6204ebfd4b6407fe669486b13927c467585342f125be252f41886dae0f06e036d0745d7acfedc03ca03d6a323b682583bd6
7
- data.tar.gz: f9b5043d50a38004a9d8f8948202dc7054f0b0e8c12a8477d45fae48c94e954c09b1a2660c356a0e16250cac265db0da19939fd829be5327b5afcf9d12befb6c
6
+ metadata.gz: 3268a918b026b4f3ff830ffede2457a0a9cd05815121e26a4a7af4164424bc39866026d9b7dd925ddfb43bffb0f486295334aa25fa9a0deaac6670d4726cacc7
7
+ data.tar.gz: bf60f687de9713a89c52bba76200254aad1da2558ae405581f58a3ded581eead607441e49154c4b619af32189cedfc3fcf4e321f273fc6ef5d13281435be237c
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  Twsms2 ( 2016 新版 台灣簡訊 TwSMS API Ruby 版套件 )
2
2
  =================================================
3
3
 
4
- [![Gem Version](https://badge.fury.io/rb/twsms2.svg)](https://badge.fury.io/rb/twsms2) [![Build Status](https://travis-ci.org/guanting112/twsms2.svg?branch=master)](https://travis-ci.org/guanting112/twsms2)
4
+ [![Gem Version](https://badge.fury.io/rb/twsms2.svg)](https://badge.fury.io/rb/twsms2)
5
+ [![Build Status](https://travis-ci.org/guanting112/twsms2.svg?branch=master)](https://travis-ci.org/guanting112/twsms2)
6
+ [![Code Climate](https://codeclimate.com/github/guanting112/twsms2/badges/gpa.svg)](https://codeclimate.com/github/guanting112/twsms2)
5
7
 
6
8
  ![twsms](http://i.imgur.com/KVuaBIm.png)
7
9
 
@@ -42,7 +44,9 @@ gem 'twsms2', '~> 1.1.0'
42
44
  require 'twsms2'
43
45
 
44
46
  # Twsms2 是走 https 的方式進行系統操作
45
- sms_client = Twsms2::Client.new(username: '會員帳號', password: '會員密碼', agent: "Mozilla/5.0 (可自訂 user-agent)")
47
+ sms_client = Twsms2::Client.new(
48
+ username: '會員帳號', password: '會員密碼', agent: "Mozilla/5.0 (可自訂 user-agent)"
49
+ )
46
50
  ```
47
51
 
48
52
  使用範例
@@ -86,7 +90,7 @@ sms_client.send_message to: '手機號碼', content: "預約簡訊測試: #{Time
86
90
 
87
91
  #### 強制直接顯示簡訊內容
88
92
 
89
- 可以加入 popup 參數,讓簡訊在收訊人的手機裝置直接顯示在上面 ( 可能不會被手機儲存 )
93
+ 可以加入 popup 參數,讓簡訊在收訊人的手機上直接顯示,但有可能不會被手機儲存
90
94
 
91
95
  ```ruby
92
96
  sms_client.send_message to: '手機號碼', content: "簡訊內容..", popup: true
@@ -94,9 +98,9 @@ sms_client.send_message to: '手機號碼', content: "簡訊內容..", popup: tr
94
98
 
95
99
  #### 關閉長簡訊支援
96
100
 
97
- 一般發送簡訊時,預設為長簡訊發送
101
+ 一般發送簡訊時,程式預設支援長簡訊發送
98
102
 
99
- 因此,若超 SMS 短信字元長度,將會以第二封起開始計算
103
+ 因此,若超 SMS 簡訊字元長度,將會以第二封起開始計算
100
104
 
101
105
  加入 long 參數,若指定為 false 則不會使用長簡訊格式
102
106
 
@@ -104,6 +108,8 @@ sms_client.send_message to: '手機號碼', content: "簡訊內容..", popup: tr
104
108
  sms_client.send_message to: '手機號碼', content: "簡訊內容..", long: false
105
109
  ```
106
110
 
111
+ 詳細規則請以 台灣簡訊 公告為主
112
+
107
113
  ### 發送簡訊 的 回傳結果
108
114
 
109
115
  #### 發送成功
@@ -155,7 +161,7 @@ message_quota 則是簡訊餘額,代表你還剩幾封可以用,若為 0 就
155
161
  {:access_success=>true, :message_quota=>77, :error=>nil}
156
162
  ```
157
163
 
158
- #### 發生錯誤
164
+ #### 發生錯誤時
159
165
 
160
166
  若 access_success 為 false 則表示過程有出現錯誤,同時 message_quota 會為 0
161
167
 
@@ -176,3 +182,4 @@ LICENSE
176
182
 
177
183
  [twsms_signup]: https://www.twsms.com/accjoin.php
178
184
  [twsms_homepage]: https://www.twsms.com/
185
+
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
3
 
4
4
  task :default => :spec
5
5
 
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "twsms2"
3
+ require 'bundler/setup'
4
+ require 'twsms2'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
10
+ # require 'pry'
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
@@ -32,9 +32,7 @@ module Twsms2
32
32
  if new_info[:access_success]
33
33
  new_info[:message_id] = message_id_text
34
34
  else
35
- new_info[:error] = "TWSMS:CODE_NOT_FOUND"
36
- new_info[:error] = "TWSMS:#{code_text}" unless code_text.nil?
37
- new_info[:error].upcase!
35
+ new_info[:error] = code_text.nil? ? "TWSMS:CODE_NOT_FOUND" : "TWSMS:#{code_text}".upcase
38
36
  end
39
37
 
40
38
  new_info
@@ -55,9 +53,7 @@ module Twsms2
55
53
  if new_info[:access_success]
56
54
  new_info[:message_quota] = point_text.to_i
57
55
  else
58
- new_info[:error] = "TWSMS:CODE_NOT_FOUND"
59
- new_info[:error] = "TWSMS:#{code_text}" unless code_text.nil?
60
- new_info[:error].upcase!
56
+ new_info[:error] = code_text.nil? ? "TWSMS:CODE_NOT_FOUND" : "TWSMS:#{code_text}".upcase
61
57
  end
62
58
 
63
59
  new_info
@@ -1,3 +1,3 @@
1
1
  module Twsms2
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/lib/twsms2.rb CHANGED
@@ -17,8 +17,7 @@ module Twsms2
17
17
 
18
18
  def account_is_available
19
19
  balance_info = get_balance
20
-
21
- ok = balance_info[:message_quota] > 0 && balance_info[:access_success]
20
+ balance_info[:message_quota] > 0 && balance_info[:access_success]
22
21
  end
23
22
 
24
23
  def send_message(options={})
data/twsms2.gemspec CHANGED
@@ -30,6 +30,5 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_development_dependency "bundler", "~> 1.7"
32
32
  spec.add_development_dependency "rake", "~> 10.0"
33
- # spec.add_development_dependency 'webmock', '~> 1.18'
34
33
  spec.add_development_dependency 'minitest', '~> 5.0'
35
34
  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.1.0
4
+ version: 1.1.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-03 00:00:00.000000000 Z
11
+ date: 2016-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.6.4
97
+ rubygems_version: 2.5.1
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: 2016 新版 台灣簡訊 TwSMS API ( 純 Ruby / Rails 專案適用 )