emay_sms 0.0.2 → 0.1.0
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/Gemfile.lock +31 -60
- data/emay_sms.gemspec +3 -5
- data/lib/emay_sms.rb +21 -15
- data/lib/emay_sms/configuration.rb +4 -4
- data/lib/emay_sms/version.rb +1 -1
- data/spec/lib/emay_sms/service_spec.rb +10 -4
- data/spec/spec_helper.rb +3 -3
- metadata +7 -22
- data/lib/emay_sms/models/log.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 210eaed850c7962be7034e344865788d2de1df1a
|
4
|
+
data.tar.gz: e9972ebcb8d60ecf500f256ee9b16a4f55efde1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b276ff8a464827928b021e29f7e8218a8686838f81ffea2aa1be6126fc474a21573696253c3a21f6c7d54a41ef02e5260872501d815890cdd739b857fcaffba
|
7
|
+
data.tar.gz: c85a902b5fbf0b90a9413d67071f0be26312c0c22ac6e12cf082437257180db1f5bd392b06eb9beb50edf5ece25d84fec66f4e17dd19ae9b84051fd586acf6b0
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
emay_sms (0.0
|
5
|
-
|
6
|
-
savon (~> 2.6.0)
|
4
|
+
emay_sms (0.1.0)
|
5
|
+
savon (~> 2.7.2)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
activemodel (4.1.5)
|
12
|
-
activesupport (= 4.1.5)
|
13
|
-
builder (~> 3.1)
|
14
|
-
activesupport (4.1.5)
|
15
|
-
i18n (~> 0.6, >= 0.6.9)
|
16
|
-
json (~> 1.7, >= 1.7.7)
|
17
|
-
minitest (~> 5.1)
|
18
|
-
thread_safe (~> 0.1)
|
19
|
-
tzinfo (~> 1.1)
|
20
10
|
akami (1.2.2)
|
21
11
|
gyoku (>= 0.4.0)
|
22
12
|
nokogiri
|
23
|
-
bson (2.3.0)
|
24
13
|
builder (3.2.2)
|
25
|
-
celluloid (0.
|
26
|
-
timers (~>
|
27
|
-
codeclimate-test-reporter (0.4.
|
14
|
+
celluloid (0.16.0)
|
15
|
+
timers (~> 4.0.0)
|
16
|
+
codeclimate-test-reporter (0.4.1)
|
28
17
|
simplecov (>= 0.7.1, < 1.0.0)
|
29
18
|
coderay (1.1.0)
|
30
|
-
connection_pool (2.0.0)
|
31
19
|
diff-lcs (1.2.5)
|
32
20
|
docile (1.1.5)
|
33
|
-
ffi (1.9.
|
21
|
+
ffi (1.9.6)
|
34
22
|
formatador (0.2.5)
|
35
23
|
guard (2.6.1)
|
36
24
|
formatador (>= 0.2.4)
|
@@ -43,11 +31,10 @@ GEM
|
|
43
31
|
rspec (>= 2.14, < 4.0)
|
44
32
|
gyoku (1.1.1)
|
45
33
|
builder (>= 2.1.2)
|
46
|
-
|
34
|
+
hitimes (1.2.2)
|
35
|
+
httpi (2.2.7)
|
47
36
|
rack
|
48
|
-
|
49
|
-
json (1.8.1)
|
50
|
-
listen (2.7.9)
|
37
|
+
listen (2.7.11)
|
51
38
|
celluloid (>= 0.15.2)
|
52
39
|
rb-fsevent (>= 0.9.3)
|
53
40
|
rb-inotify (>= 0.9)
|
@@ -55,46 +42,33 @@ GEM
|
|
55
42
|
macaddr (1.7.1)
|
56
43
|
systemu (~> 2.6.2)
|
57
44
|
method_source (0.8.2)
|
58
|
-
|
59
|
-
mini_portile (0.6.0)
|
60
|
-
minitest (5.4.1)
|
61
|
-
mongoid (4.0.0)
|
62
|
-
activemodel (~> 4.0)
|
63
|
-
moped (~> 2.0.0)
|
64
|
-
origin (~> 2.1)
|
65
|
-
tzinfo (>= 0.3.37)
|
66
|
-
moped (2.0.0)
|
67
|
-
bson (~> 2.2)
|
68
|
-
connection_pool (~> 2.0)
|
69
|
-
optionable (~> 0.2.0)
|
45
|
+
mini_portile (0.6.2)
|
70
46
|
multi_json (1.10.1)
|
71
|
-
nokogiri (1.6.
|
72
|
-
mini_portile (
|
47
|
+
nokogiri (1.6.6.2)
|
48
|
+
mini_portile (~> 0.6.0)
|
73
49
|
nori (2.4.0)
|
74
|
-
optionable (0.2.0)
|
75
|
-
origin (2.1.1)
|
76
50
|
pry (0.10.1)
|
77
51
|
coderay (~> 1.1.0)
|
78
52
|
method_source (~> 0.8.1)
|
79
53
|
slop (~> 3.4)
|
80
|
-
rack (1.
|
54
|
+
rack (1.6.0)
|
81
55
|
rake (10.3.2)
|
82
56
|
rb-fsevent (0.9.4)
|
83
57
|
rb-inotify (0.9.5)
|
84
58
|
ffi (>= 0.5.0)
|
85
|
-
rspec (3.
|
86
|
-
rspec-core (~> 3.
|
87
|
-
rspec-expectations (~> 3.
|
88
|
-
rspec-mocks (~> 3.
|
89
|
-
rspec-core (3.
|
90
|
-
rspec-support (~> 3.
|
91
|
-
rspec-expectations (3.
|
59
|
+
rspec (3.1.0)
|
60
|
+
rspec-core (~> 3.1.0)
|
61
|
+
rspec-expectations (~> 3.1.0)
|
62
|
+
rspec-mocks (~> 3.1.0)
|
63
|
+
rspec-core (3.1.7)
|
64
|
+
rspec-support (~> 3.1.0)
|
65
|
+
rspec-expectations (3.1.2)
|
92
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
93
|
-
rspec-support (~> 3.
|
94
|
-
rspec-mocks (3.
|
95
|
-
rspec-support (~> 3.
|
96
|
-
rspec-support (3.
|
97
|
-
savon (2.
|
67
|
+
rspec-support (~> 3.1.0)
|
68
|
+
rspec-mocks (3.1.3)
|
69
|
+
rspec-support (~> 3.1.0)
|
70
|
+
rspec-support (3.1.2)
|
71
|
+
savon (2.7.2)
|
98
72
|
akami (~> 1.2.0)
|
99
73
|
builder (>= 2.1.2)
|
100
74
|
gyoku (~> 1.1.0)
|
@@ -103,23 +77,20 @@ GEM
|
|
103
77
|
nori (~> 2.4.0)
|
104
78
|
uuid (~> 2.3.7)
|
105
79
|
wasabi (~> 3.3.0)
|
106
|
-
simplecov (0.9.
|
80
|
+
simplecov (0.9.1)
|
107
81
|
docile (~> 1.1.0)
|
108
|
-
multi_json
|
82
|
+
multi_json (~> 1.0)
|
109
83
|
simplecov-html (~> 0.8.0)
|
110
84
|
simplecov-html (0.8.0)
|
111
85
|
slop (3.6.0)
|
112
|
-
systemu (2.6.
|
86
|
+
systemu (2.6.5)
|
113
87
|
thor (0.19.1)
|
114
|
-
|
115
|
-
|
116
|
-
tzinfo (1.2.2)
|
117
|
-
thread_safe (~> 0.1)
|
88
|
+
timers (4.0.1)
|
89
|
+
hitimes
|
118
90
|
uuid (2.3.7)
|
119
91
|
macaddr (~> 1.0)
|
120
|
-
wasabi (3.3.
|
92
|
+
wasabi (3.3.1)
|
121
93
|
httpi (~> 2.0)
|
122
|
-
mime-types (< 2.0.0)
|
123
94
|
nokogiri (>= 1.4.0)
|
124
95
|
|
125
96
|
PLATFORMS
|
data/emay_sms.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'emay_sms/version'
|
@@ -8,8 +7,8 @@ Gem::Specification.new do |spec|
|
|
8
7
|
spec.version = EmaySms::VERSION
|
9
8
|
spec.authors = ["liuzelei"]
|
10
9
|
spec.email = ["liuzelei@gmail.com"]
|
11
|
-
spec.summary = "
|
12
|
-
spec.description = "
|
10
|
+
spec.summary = "亿美短信接口"
|
11
|
+
spec.description = "就是那个亿美啦"
|
13
12
|
spec.homepage = ""
|
14
13
|
spec.license = "MIT"
|
15
14
|
|
@@ -25,6 +24,5 @@ Gem::Specification.new do |spec|
|
|
25
24
|
spec.add_development_dependency "guard-rspec"
|
26
25
|
spec.add_development_dependency "codeclimate-test-reporter"
|
27
26
|
|
28
|
-
spec.add_dependency "savon", "~> 2.
|
29
|
-
spec.add_dependency "mongoid", "~> 4.0.0"
|
27
|
+
spec.add_dependency "savon", "~> 2.7.2"
|
30
28
|
end
|
data/lib/emay_sms.rb
CHANGED
@@ -28,12 +28,9 @@ module EmaySms
|
|
28
28
|
"#{EmaySms.config.sign}#{message}"
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
# @client.call(:regist_ex, message: { softwareSerialNo: EmaySms.config.account,
|
33
|
-
# key: EmaySms.config.secrect,
|
34
|
-
# serialpass: EmaySms.config.password })
|
31
|
+
def active
|
35
32
|
response = client.call(:regist_ex, message: { arg0: EmaySms.config.account,
|
36
|
-
arg1: EmaySms.config.
|
33
|
+
arg1: EmaySms.config.secret,
|
37
34
|
arg2: EmaySms.config.password })
|
38
35
|
if response.body[:regist_ex_response].nil? || response.body[:regist_ex_response][:return] != "0"
|
39
36
|
return false
|
@@ -42,18 +39,27 @@ module EmaySms
|
|
42
39
|
end
|
43
40
|
end
|
44
41
|
|
42
|
+
def register(hash = {})
|
43
|
+
response = client.call(:regist_detail_info, message: { arg0: EmaySms.config.account,
|
44
|
+
arg1: EmaySms.config.secret,
|
45
|
+
arg2: hash[:name],
|
46
|
+
arg3: hash[:contact],
|
47
|
+
arg4: hash[:phone_number],
|
48
|
+
arg5: hash[:mobile],
|
49
|
+
arg6: hash[:email],
|
50
|
+
arg7: hash[:fax],
|
51
|
+
arg8: hash[:address],
|
52
|
+
arg9: hash[:post_code]})
|
53
|
+
if response.body[:regist_detail_info_response].nil? || response.body[:regist_detail_info_response][:return] != "0"
|
54
|
+
return false
|
55
|
+
else
|
56
|
+
return true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
45
60
|
def send(message, mobiles = [])
|
46
|
-
# response = @client.call(:send_sms, message: { softwareSerialNo: EmaySms.config.account,
|
47
|
-
# key: EmaySms.config.secrect,
|
48
|
-
# sendTime: "",
|
49
|
-
# mobiles: mobiles,
|
50
|
-
# smsContent: message,
|
51
|
-
# addSerial: "",
|
52
|
-
# srcCharset: "UTF-8",
|
53
|
-
# smsPriority: 1,
|
54
|
-
# smsID: 0 })
|
55
61
|
response = client.call(:send_sms, message: { arg0: EmaySms.config.account,
|
56
|
-
arg1: EmaySms.config.
|
62
|
+
arg1: EmaySms.config.secret,
|
57
63
|
arg2: "",
|
58
64
|
arg3: mobiles,
|
59
65
|
arg4: EmaySms.sign_message(message),
|
@@ -24,12 +24,12 @@ module EmaySms
|
|
24
24
|
@password = password
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
@
|
27
|
+
def secret
|
28
|
+
@secret ||= SecureRandom.hex(10)
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
@
|
31
|
+
def secret=(secret)
|
32
|
+
@secret = secret
|
33
33
|
end
|
34
34
|
|
35
35
|
def sign
|
data/lib/emay_sms/version.rb
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "Service" do
|
4
|
-
it "should
|
5
|
-
|
6
|
-
expect(
|
4
|
+
it "should active new key" do
|
5
|
+
response = EmaySms.active
|
6
|
+
expect(response).to be true
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should register info" do
|
10
|
+
data = { name: '一个神奇的网站', contact: '大理石', phone_number: '021-12345678', mobile: '13800138000', email: 'test@test.com', fax: '021-12345678', address: '天朝', post_code: '200100' }
|
11
|
+
response = EmaySms.register(data)
|
12
|
+
expect(response).to be true
|
7
13
|
end
|
8
14
|
|
9
15
|
it "should send message" do
|
10
16
|
response = EmaySms.send("测试 #{Time.now.to_i}", ["13817513107", "18101801755", "18616015606"])
|
11
|
-
expect(response).
|
17
|
+
expect(response).to be true
|
12
18
|
end
|
13
19
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,9 +8,9 @@ Bundler.setup
|
|
8
8
|
|
9
9
|
EmaySms.setup do |config|
|
10
10
|
config.server = "http://sdk4report.eucp.b2m.cn:8080/sdk/SDKService?wsdl"
|
11
|
-
config.account = "
|
12
|
-
config.password = "
|
13
|
-
config.
|
11
|
+
config.account = "6SDK-EMY-6688-KIUQS"
|
12
|
+
config.password = "887958"
|
13
|
+
config.secret = "JztJpw4013"
|
14
14
|
#config.sign = "就诊通"
|
15
15
|
end
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emay_sms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- liuzelei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,29 +100,15 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.
|
103
|
+
version: 2.7.2
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.
|
111
|
-
|
112
|
-
name: mongoid
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 4.0.0
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 4.0.0
|
125
|
-
description: "就是那个易美啦"
|
110
|
+
version: 2.7.2
|
111
|
+
description: "就是那个亿美啦"
|
126
112
|
email:
|
127
113
|
- liuzelei@gmail.com
|
128
114
|
executables: []
|
@@ -141,7 +127,6 @@ files:
|
|
141
127
|
- emay_sms.gemspec
|
142
128
|
- lib/emay_sms.rb
|
143
129
|
- lib/emay_sms/configuration.rb
|
144
|
-
- lib/emay_sms/models/log.rb
|
145
130
|
- lib/emay_sms/version.rb
|
146
131
|
- spec/lib/emay_sms/service_spec.rb
|
147
132
|
- spec/spec_helper.rb
|
@@ -165,10 +150,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
150
|
version: '0'
|
166
151
|
requirements: []
|
167
152
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.4.5
|
169
154
|
signing_key:
|
170
155
|
specification_version: 4
|
171
|
-
summary: "
|
156
|
+
summary: "亿美短信接口"
|
172
157
|
test_files:
|
173
158
|
- spec/lib/emay_sms/service_spec.rb
|
174
159
|
- spec/spec_helper.rb
|
data/lib/emay_sms/models/log.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require "mongoid"
|
2
|
-
|
3
|
-
module EmaySms
|
4
|
-
module Models
|
5
|
-
class Log
|
6
|
-
include Mongoid::Document
|
7
|
-
field :method, type: String
|
8
|
-
field :params, type: Hash
|
9
|
-
field :response, type: Hash
|
10
|
-
field :logged_at, type: DateTime
|
11
|
-
|
12
|
-
before_create do
|
13
|
-
self.logged_at = Time.now
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|