yunpiansms 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0e7056a94ec81d61a56ff8b38d77c41dfc0a2c3
4
- data.tar.gz: 684f24fa0ba6159b85cfff2b57ac232fc9c49c2f
3
+ metadata.gz: beabd58086a4a4e5116caeb1407f306760ef07bd
4
+ data.tar.gz: 386e12ba0ccaf85f6a765a21f0e3bca8092b7a70
5
5
  SHA512:
6
- metadata.gz: 230125dde1c80c07f58cb3826004a4f8aa2bc942ee27d7f8807d050b944078f7a58aacc2bff3631d2d852ead13bdb5e2db36f51b005b8701fddfe8c6955cc8e6
7
- data.tar.gz: 939b4fa74dc1c37f49a2439bde242b60473a49cae61f5e1cdafc50d39bcb53dd996905614babc95c45350debe1205736c8d0908196e09a87a53cb395eb248317
6
+ metadata.gz: fc2ad764a4ffe63d5b4c31817204ddd924428e59479eed1d2efbb0495b884185c4497b5096027b3794b28a87fb70bd11916b370657ae177df00c1838febc9237
7
+ data.tar.gz: 0375d6e367e096b3c8b865565a62c1d4e2e9d47d6172c2b4c0c32b4b4a58e064df4cbfe8d3346c9165968b0bf14b2a046f1876702a7562fc42cd1dc517db3827
@@ -0,0 +1,28 @@
1
+ require 'net/http'
2
+ require 'faraday'
3
+
4
+ module Yunpiansms
5
+ class HttpBase
6
+ attr_accessor :secret_key, :url, :host
7
+
8
+ def initialize(host="", connection_adapter = :net_http, headers={}, debug_flg=false)
9
+ @host = host
10
+ @connection_adapter = connection_adapter
11
+ @headers = headers
12
+ end
13
+
14
+ def post(url, body={}); conn.post url, body end
15
+ def get(url, params={}); conn.get url, params end
16
+
17
+ def conn
18
+ Faraday.new(:url => @host, :headers => @headers) do |faraday|
19
+ faraday.request :url_encoded
20
+ faraday.response :logger, @logger, :bodies => true
21
+ faraday.options.timeout = 5 # open/read timeout in seconds
22
+ faraday.options.open_timeout = 2 # connection open timeout in seconds
23
+ faraday.adapter @connection_adapter
24
+ end
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ module Yunpiansms
2
+ class SmsResources
3
+ SEND_DOMAIN = "https://sms.yunpian.com"
4
+ GET_URL = "/v1/sms/get.json"
5
+ SEND_URL = "/v1/sms/send.json"
6
+ TPL_SEND_URL = "/v1/sms/tpl_send.json"
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Yunpiansms
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
data/lib/yunpiansms.rb CHANGED
@@ -1,6 +1,6 @@
1
- require "yunpiansms/version"
2
- require "yunpiansms/sms_resources"
3
- require "yunpiansms/http_base"
1
+ require 'yunpiansms/version'
2
+ require 'yunpiansms/sms_resources'
3
+ require 'yunpiansms/http_base'
4
4
 
5
5
 
6
6
  module Yunpiansms
data/test.rb ADDED
@@ -0,0 +1,15 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ Dir[File.dirname(__FILE__) + '/lib/*.rb'].each {|file| require file }
4
+ @yunpiansms_service = Yunpiansms::Service.config do |s|
5
+ s.apikey = ""
6
+ s.signature = "TryCatch"
7
+ s.connection_adapter = :net_http # default
8
+ end
9
+ content = {
10
+ apikey: "",
11
+ mobile: "15279058411",
12
+ text: "测试一下短信发送",
13
+ uid: "15279"
14
+ }
15
+ result = @yunpiansms_service.send_to(content,"15279058411")
data/yunpiansms.gemspec CHANGED
@@ -9,7 +9,6 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["trycatch"]
10
10
  spec.email = ["guoyoujin123@gmail.com"]
11
11
  spec.summary = ["trycatch"]
12
- spec.summary = %q{yunpian send sms Ruby Server SDK.}
13
12
  spec.description = %q{yunpian send sms Ruby Server SDK.}
14
13
  spec.homepage = "https://github.com/guoyoujin/xiaomipush."
15
14
  spec.license = "MIT"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yunpiansms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - trycatch
@@ -66,7 +66,10 @@ files:
66
66
  - bin/console
67
67
  - bin/setup
68
68
  - lib/yunpiansms.rb
69
+ - lib/yunpiansms/http_base.rb
70
+ - lib/yunpiansms/sms_resources.rb
69
71
  - lib/yunpiansms/version.rb
72
+ - test.rb
70
73
  - yunpiansms.gemspec
71
74
  homepage: https://github.com/guoyoujin/xiaomipush.
72
75
  licenses:
@@ -91,5 +94,5 @@ rubyforge_project:
91
94
  rubygems_version: 2.6.4
92
95
  signing_key:
93
96
  specification_version: 4
94
- summary: yunpian send sms Ruby Server SDK.
97
+ summary: '["trycatch"]'
95
98
  test_files: []