chuanglan 1.0.0 → 1.1.0

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: 6b8b4f4a43937f6cc143da99126052b225cfa1bb
4
- data.tar.gz: ce6c6b8cc58f4e2b87f01e6cc5f2da24dc3ada0c
3
+ metadata.gz: f4c18627fb61bbe7f5840e0ee0ab5afd3765422f
4
+ data.tar.gz: 123da4b43d187b94c0a990a832a75c459f9deb98
5
5
  SHA512:
6
- metadata.gz: c8437d052a19f82b2903543af9925dd5eba6011f3b9526bd618d0cf1dad2856710d22494e4ef115c3c33fe1d2fa3b29c17a8b5b2df046cf2928c662a5c350c4c
7
- data.tar.gz: b04da6407495a827620c45961654b6e393540080240792f91d449db6d80d0f067726a24c4ee02895b7762aa0b458088a6f39394fb7e3b6151c321a65b6f7dbd0
6
+ metadata.gz: 9c0c22d246251043f1ea961e4dcef4012781aa9b594889aefe17a5ef8ad2a25cd41b53957f94ae15b4f0b6edc76bea842241dca19d3d8dba2dc471ad3b37f493
7
+ data.tar.gz: 2a7a648f5d59efb09a6957576a4c35f8bd31065c5e405434e220d721b91f8c2b0535d5b8a286a8977f75838584109fefb2bd87877bfe7b4ce6c8418e4ca2218b
data/README.md CHANGED
@@ -21,11 +21,13 @@ Or install it yourself as:
21
21
  ### Config
22
22
 
23
23
  ```ruby
24
- Chuanglan.username = 'username'
25
- Chuanglan.password = 'password'
24
+ Chuanglan.username = 'username'
25
+ Chuanglan.password = 'password'
26
+ Chuanglan.signature = '【签名】'
26
27
 
27
- Chuanglan::International.username = 'international_username'
28
- Chuanglan::International.password = 'international_password'
28
+ Chuanglan::International.username = 'international_username'
29
+ Chuanglan::International.password = 'international_password'
30
+ Chuanglan::International.signature = '【签名】'
29
31
  ```
30
32
 
31
33
  ### Send SMS
@@ -33,7 +35,7 @@ Chuanglan::International.password = 'international_password'
33
35
  ```ruby
34
36
  Chuanglan.send_to!('10086', '流量唔够用啊')
35
37
  Chuanglan.send_to!(['10086', '10010'], '信号好差啊')
36
- Chuanglan.send_to!('10086', '流量唔够用啊', un: 'un', pw: 'pw', rd: 0, ex: 'ex')
38
+ Chuanglan.send_to!('10086', '流量唔够用啊', un: 'un', pw: 'pw', rd: 0, ex: 'ex', signature: '【覆盖签名】')
37
39
  ```
38
40
 
39
41
  ### Check balance
@@ -46,7 +48,7 @@ Chuanglan.balance # => 100
46
48
 
47
49
  ```ruby
48
50
  Chuanglan::International.send_to!('8613612345678', '流量唔够用啊')
49
- Chuanglan::International.send_to!('8613612345678', '流量唔够用啊', un: 'un', pw: 'pw', dc: 15, rf: 1, tf: 3)
51
+ Chuanglan::International.send_to!('8613612345678', '流量唔够用啊', un: 'un', pw: 'pw', dc: 15, rf: 1, tf: 3, signature: '【覆盖签名】')
50
52
  ```
51
53
 
52
54
  ## Development
@@ -3,12 +3,12 @@ module Chuanglan
3
3
  GATEWAY = 'https://intapi.253.com'
4
4
 
5
5
  class << self
6
- attr_accessor :username, :password, :timeout
6
+ attr_accessor :username, :password, :timeout, :signature
7
7
 
8
8
  def send_to!(recipients, message, params = {})
9
9
  params = base_params.merge(params)
10
10
  params[:da] = Array(recipients).join(',')
11
- params[:sm] = message
11
+ params[:sm] = "#{params.fetch(:signature, signature)}#{message}"
12
12
  rsp = Request.new("#{GATEWAY}/mt", params).perform
13
13
  success_or_raise_exception(rsp)
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module Chuanglan
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/chuanglan.rb CHANGED
@@ -8,12 +8,12 @@ module Chuanglan
8
8
  @timeout = 5
9
9
 
10
10
  class << self
11
- attr_accessor :username, :password, :timeout
11
+ attr_accessor :username, :password, :timeout, :signature
12
12
 
13
13
  def send_to!(recipients, message, params = {})
14
14
  params = base_params.merge(params)
15
15
  params[:phone] = Array(recipients).join(',')
16
- params[:msg] = message
16
+ params[:msg] = "#{params.fetch(:signature, signature)}#{message}"
17
17
  rsp = Request.new("#{GATEWAY}/msg/send", params).perform
18
18
  success_or_raise_exception(rsp)
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chuanglan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HungYuHei
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-02 00:00:00.000000000 Z
11
+ date: 2017-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler