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 +4 -4
- data/lib/yunpiansms/http_base.rb +28 -0
- data/lib/yunpiansms/sms_resources.rb +8 -0
- data/lib/yunpiansms/version.rb +1 -1
- data/lib/yunpiansms.rb +3 -3
- data/test.rb +15 -0
- data/yunpiansms.gemspec +0 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beabd58086a4a4e5116caeb1407f306760ef07bd
|
4
|
+
data.tar.gz: 386e12ba0ccaf85f6a765a21f0e3bca8092b7a70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/yunpiansms/version.rb
CHANGED
data/lib/yunpiansms.rb
CHANGED
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.
|
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:
|
97
|
+
summary: '["trycatch"]'
|
95
98
|
test_files: []
|