yunpiansms 1.0.4 → 1.0.5

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: 4885a534f39a2986a88bf3b33ae04abeba92cc3d
4
- data.tar.gz: 15ee1e158dd6e010c32868d6835f11ea3fbb1bb2
3
+ metadata.gz: 0ce4c5c3e182704883685e452ffaee69c213e75d
4
+ data.tar.gz: f7c0f333743e089a2c54467adb1040a33cc368a5
5
5
  SHA512:
6
- metadata.gz: 8d985f8ca0959a5055d59a9b51644447aad1884be0d5dba6adea8897280f2b985e01a58bd2ca37167ad342cb2daf9fe9425577616e1abf536dd5f770994cfce0
7
- data.tar.gz: 6e7efe51738b08cfaf1514468ad5892ffe1c06d0df0f8b274aa88464916dbfc5c2b2acebf09dd02e59b4a6a51e24505c8e14e452146043a7e8f7413fa0c0dcc7
6
+ metadata.gz: 5865438b91cbd21f702554eff3bcdc2bd23b9c510acd5e7e5c34b097a28e1b98b966c77e6f862c12bd2984fe6c2476a3f0acfb6340718e89d301393e6e243181
7
+ data.tar.gz: b1e625c37de59dc860e1265049e034c09b059a67b7775ecfdafb66c02530a3c054b7642a1eb6748018d7b0e4873012b7f8cc5ce5b1db2d9f175e112fcd602370
data/README.md CHANGED
@@ -21,9 +21,39 @@ Or install it yourself as:
21
21
  $ gem install yunpiansms
22
22
 
23
23
  ## Usage
24
+ The main method
25
+ ```ruby
26
+ def send_to(content, mobiles = nil)
27
+ http.post(Yunpiansms::SmsResources::SEND_URL,params_data(content, mobiles))
28
+ end
29
+
30
+ def tpl_send_to(content, mobiles = nil, tpl_id = nil, tpl_value=nil)
31
+ http.post(Yunpiansms::SmsResources::TPL_SEND_URL,params_data_tpl(content, mobiles, tpl_id,tpl_value))
32
+ end
33
+
34
+ def get_record(options={})
35
+ http.get(Yunpiansms::SmsResources::GET_URL,format_content(options))
36
+ end
37
+ ```
38
+ Usage
39
+ ```ruby
40
+ @yunpiansms_service = Yunpiansms::Service.config do |s|
41
+ s.apikey = "" # apikey
42
+ s.connection_adapter = :net_http # default
43
+ end
44
+
45
+ content = {mobile: "1367777777,1367777777",text: "123",uid: "15279"}
46
+ result = @yunpiansms_service.send_to(content)
24
47
 
25
- TODO: Write usage instructions here
48
+ content = {text: "123",uid: "15279"}
49
+ result = @yunpiansms_service.send_to(content,["1367777777","1367777777"])
50
+ result = @yunpiansms_service.send_to(content,"1367777777,1367777777")
26
51
 
52
+ content = {mobile: "1367777777,1367777777",tpl_value: {key:"1245",key1:"23"},uid: "15279",tpl_id:1}
53
+ result = @yunpiansms_service.tpl_send_to(content)
54
+
55
+ result = @yunpiansms_service.get_record({start_time: Time.now,end_time:Time.now,page_num:1,page_size:100,mobile:"15279058466"})
56
+ ```
27
57
  ## Development
28
58
 
29
59
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,7 +1,7 @@
1
1
  module Yunpiansms
2
2
  class SmsResources
3
3
  SEND_DOMAIN = "https://sms.yunpian.com"
4
- GET_URL = "/v1/sms/get.json"
4
+ GET_URL = "/v1/sms/get_record.json"
5
5
  SEND_URL = "/v1/sms/send.json"
6
6
  TPL_SEND_URL = "/v1/sms/tpl_send.json"
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module Yunpiansms
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
data/lib/yunpiansms.rb CHANGED
@@ -25,6 +25,10 @@ module Yunpiansms
25
25
  http.post(Yunpiansms::SmsResources::TPL_SEND_URL,params_data_tpl(content, mobiles, tpl_id,tpl_value))
26
26
  end
27
27
 
28
+ def get_record(options={})
29
+ http.get(Yunpiansms::SmsResources::GET_URL,format_content(options))
30
+ end
31
+
28
32
  private
29
33
 
30
34
  def params_data(content, mobiles)
data/test.rb CHANGED
@@ -25,4 +25,6 @@ content = {
25
25
  text: {key:"1245",key1:"23"},
26
26
  uid: "15279"
27
27
  }
28
- result = @yunpiansms_service.send_to(content,"")
28
+ result = @yunpiansms_service.send_to(content,"")
29
+
30
+ result = @yunpiansms_service.get_record({})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yunpiansms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - trycatch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-10 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday