kotsms2 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/Rakefile +2 -2
- data/bin/console +4 -4
- data/lib/kotsms2/formatter.rb +6 -10
- data/lib/kotsms2/version.rb +1 -1
- data/lib/kotsms2.rb +1 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5296875c0b1b8a755e8552f54a58660f26349f70
|
4
|
+
data.tar.gz: 22e473ec7a42c8b02a2f2c84ea096a0e24e3dc7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e6301990768aa5a7ea71ea42a7bf039bbaf8a75cb7ceefbc827ecdfbe3f413e5fa6eb8eb880f1e96097f131f5d405bfec562579670975452e90f03f964a386a
|
7
|
+
data.tar.gz: f7e1889421d00d4bea51523c8fee0969d18434c29feca67faa556d55128c15b587e9737a872d514b722ff1743a11a9a5832acbedc0669d92fa3b104ba075722d
|
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
Kotsms2 ( 2016 新版 簡訊王 KotSMS API Ruby 版套件 )
|
2
2
|
=================================================
|
3
3
|
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/kotsms2.svg)](https://badge.fury.io/rb/kotsms2)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/kotsms2.svg)](https://badge.fury.io/rb/kotsms2)
|
5
|
+
[![Build Status](https://travis-ci.org/guanting112/kotsms2.svg?branch=master)](https://travis-ci.org/guanting112/kotsms2)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/guanting112/kotsms2/badges/gpa.svg)](https://codeclimate.com/github/guanting112/kotsms2)
|
5
7
|
|
6
8
|
![kotsms](http://i.imgur.com/Q4QbtOP.png)
|
7
9
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'kotsms2'
|
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
|
10
|
+
# require 'pry'
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/lib/kotsms2/formatter.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Kotsms2
|
2
2
|
module Formatter
|
3
|
-
def to_big5(
|
4
|
-
|
3
|
+
def to_big5(original_string)
|
4
|
+
original_string.encode("BIG5", :invalid => :replace, :undef => :replace, :replace => "?")
|
5
5
|
end
|
6
6
|
|
7
|
-
def to_utf8(
|
8
|
-
|
7
|
+
def to_utf8(original_string)
|
8
|
+
original_string.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "?")
|
9
9
|
end
|
10
10
|
|
11
11
|
def match_string(rule, string)
|
@@ -40,9 +40,7 @@ module Kotsms2
|
|
40
40
|
if new_info[:access_success]
|
41
41
|
new_info[:message_id] = code_number.to_s
|
42
42
|
else
|
43
|
-
new_info[:error] = "KOTSMS:CODE_NOT_FOUND"
|
44
|
-
new_info[:error] = "KOTSMS:#{code_text}" unless code_text.nil?
|
45
|
-
new_info[:error].upcase!
|
43
|
+
new_info[:error] = code_text.nil? ? "KOTSMS:CODE_NOT_FOUND" : "KOTSMS:#{code_text}".upcase
|
46
44
|
end
|
47
45
|
|
48
46
|
new_info
|
@@ -63,9 +61,7 @@ module Kotsms2
|
|
63
61
|
if new_info[:access_success]
|
64
62
|
new_info[:message_quota] = code_number
|
65
63
|
else
|
66
|
-
new_info[:error] = "KOTSMS:CODE_NOT_FOUND"
|
67
|
-
new_info[:error] = "KOTSMS:#{code_text}" unless code_text.nil?
|
68
|
-
new_info[:error].upcase!
|
64
|
+
new_info[:error] = code_text.nil? ? "KOTSMS:CODE_NOT_FOUND" : "KOTSMS:#{code_text}".upcase
|
69
65
|
end
|
70
66
|
|
71
67
|
new_info
|
data/lib/kotsms2/version.rb
CHANGED
data/lib/kotsms2.rb
CHANGED
@@ -17,8 +17,7 @@ module Kotsms2
|
|
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={})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kotsms2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.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-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.
|
97
|
+
rubygems_version: 2.5.1
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: 2016 新版 簡訊王 KotSMS API ( 純 Ruby / Rails 專案適用 )
|