emay_soap 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/emay_soap.gemspec +1 -1
- data/lib/emay_soap/client.rb +3 -1
- data/lib/emay_soap/configurable.rb +3 -2
- data/lib/emay_soap/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8be0af4346fed71759e026206e514492567e3ec7
|
4
|
+
data.tar.gz: bcf6f257a7b1c222c2429891ae9a2d97ff32169f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e065f78b0c33ca84d8bbbcd86d7049e4835a7947ff5de335fc590f1cda2f31289cbaad182098f7c8f3d8a5d84ae3f9389154ede91ea0f44fb1533e66a4b6bc75
|
7
|
+
data.tar.gz: 0a15531035f9761d9edc58e1ec8f365f5b943586cfcdf7ecfe1ab5cbacba1025416a7df9f0108b894ab1737923892d19786b8c5027b17c052c27abe89033c968
|
data/.travis.yml
ADDED
data/emay_soap.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "https://github.com/lenage/emay_soap"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.add_runtime_dependency 'savon'
|
16
|
+
spec.add_runtime_dependency 'savon'
|
17
17
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0")
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
data/lib/emay_soap/client.rb
CHANGED
@@ -50,6 +50,7 @@ module EmaySoap
|
|
50
50
|
def send_sms(mobiles, content, options = {})
|
51
51
|
send_at = format_sent_at(options[:send_at]) unless options[:send_at].blank?
|
52
52
|
mobiles = mobiles.is_a?(String) ? [mobiles] : mobiles
|
53
|
+
content = "#{prefix} #{content}" unless prefix.nil?
|
53
54
|
msg = { arg2: send_at, arg3: mobiles, arg4: content, arg5: options[:kind], arg6: nil, arg7: options[:priority], arg8: options[:id] }
|
54
55
|
call(:send_sms, msg)
|
55
56
|
end
|
@@ -79,7 +80,8 @@ module EmaySoap
|
|
79
80
|
|
80
81
|
def call(action, message)
|
81
82
|
msg = { arg0: @cdkey, arg1: @key }.merge message
|
82
|
-
savon.call(action, message: msg)
|
83
|
+
result = savon.call(action, message: msg)
|
84
|
+
result.body if result.success?
|
83
85
|
end
|
84
86
|
|
85
87
|
def format_sent_at send_at
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module EmaySoap
|
2
2
|
module Configurable
|
3
|
-
attr_accessor :cdkey, :key, :password
|
3
|
+
attr_accessor :prefix, :cdkey, :key, :password
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def default_options
|
7
7
|
{
|
8
|
+
prefix: ENV['EMAY_PREFIX'],
|
8
9
|
cdkey: ENV['EMAY_CDKEY'],
|
9
10
|
key: ENV['EMAY_KEY'], # session key, max length is 15
|
10
11
|
password: ENV['EMAY_PASSWORD']
|
@@ -12,7 +13,7 @@ module EmaySoap
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def setup_keys
|
15
|
-
@setup_keys ||= [:cdkey, :key, :password]
|
16
|
+
@setup_keys ||= [:prefix, :cdkey, :key, :password]
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
data/lib/emay_soap/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emay_soap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuan He
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: savon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
|
+
- ".travis.yml"
|
78
79
|
- Gemfile
|
79
80
|
- LICENSE.txt
|
80
81
|
- README.md
|