alidayu_api 0.0.1 → 0.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: cab21f1519c50334d49a4995425f90cc127cfc48
4
- data.tar.gz: d37fb855fd7ff8317679c407620c285ce0489a70
3
+ metadata.gz: c56c848d099c37c6b3cc9b04150e94fe17be060f
4
+ data.tar.gz: 59cb466274aa8fe829d17b0a99d742db6ff54e16
5
5
  SHA512:
6
- metadata.gz: 1c34f525fe9966fce35b2ceb7047bc69619ef017c862ad1ab3bde7271fb2215fddd209cafd81d7ca5cbf291d95f0a000665c3ce5ec55ecdb575ea45dbfdbc102
7
- data.tar.gz: 27b4aad7118c9ccfb846d9c5b9e6ccf040775ea64f9f30bf1c86698fd54377f03c26e02e568dcf3f3bf306b4e79a526beaf7c02336c32a31b8f7b027f4a24e2f
6
+ metadata.gz: 230cdd4a8a21d7b224e600511b636c2b77f7cb05499312ce47eeb1c266e1731e77f16b0f0977abc714247780a3ad683f7553fe997df4bfb0e749d73de497dd4b
7
+ data.tar.gz: 5742626465d25c308e5b07d311080fe8a7491c8f9877da48b2933427eef79d26437841bd74e8634eeafae81966cc0f56af444a9615efcfc35545c34d0d16aa7b
data/README.md CHANGED
@@ -15,7 +15,7 @@ alidayu api for ruby
15
15
  添加下面的代码到Gemfile中:
16
16
 
17
17
  ```ruby
18
- gem 'alidayu_api'
18
+ gem 'alidayu_api', '~> 0.0.1', require: "alidayu"
19
19
  ```
20
20
 
21
21
  然后执行:
@@ -1,7 +1,5 @@
1
1
  require "alidayu/version"
2
2
  require "alidayu/configuration"
3
- require 'net/http'
4
- require "json"
5
3
  require "alidayu/helper"
6
4
  require "alidayu/sms"
7
5
  require "alidayu/tts"
@@ -1,3 +1,6 @@
1
+ require 'net/http'
2
+ require "json"
3
+
1
4
  module Alidayu
2
5
  module Helper
3
6
  # 获得响应结果
@@ -41,6 +44,5 @@ module Alidayu
41
44
  hmac_sign = OpenSSL::HMAC.hexdigest(digest, secret, data).upcase
42
45
  return hmac_sign
43
46
  end
44
-
45
47
  end
46
48
  end
@@ -15,9 +15,13 @@ module Alidayu
15
15
  params[:sms_type] = 'normal'
16
16
  params[:sms_free_sign_name] = params.delete(:sign_name) || Alidayu.config.sign_name
17
17
  if params[:params].is_a? Hash
18
- sms_param = params[:params].to_json
18
+ # 阿里大鱼的JSON参数接受字符串值。例如{"code":"123456"},不接收{"code":123456}
19
+ sms_param = params[:params]
20
+ sms_param.each do |k,v|
21
+ sms_param[k] = v.to_s
22
+ end
19
23
  params.delete(:params)
20
- params[:sms_param] = sms_param
24
+ params[:sms_param] = sms_param.to_json
21
25
  end
22
26
  params[:rec_num] = params.delete(:mobiles)
23
27
  params[:sms_template_code] = params.delete(:template_code)
@@ -1,3 +1,3 @@
1
1
  module Alidayu
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -18,11 +18,27 @@ describe "test sms api" do
18
18
  end
19
19
 
20
20
  it "should query message record" do
21
- options = { mobile: '13681695220', query_date: '20160304', current_page: 1, page_size: 10 }
21
+ options = { mobile: '13681695220', query_date: '20160401', current_page: 1, page_size: 10 }
22
22
 
23
23
  data = Alidayu::Sms.query(options)
24
24
 
25
25
  expect(data["alibaba_aliqin_fc_sms_num_query_response"]).to be_an_instance_of(Hash)
26
26
  end
27
27
 
28
+ it "should send message success by invalid json param" do
29
+ options = {
30
+ mobiles: "13681695220",
31
+ template_code: "SMS_7245708",
32
+ params: {
33
+ order_id: 12345678,
34
+ register_mobile: 13681695220,
35
+ patient_name: "张三",
36
+ contact_mobile: 13681695220
37
+ }
38
+ }
39
+
40
+ data = Alidayu::Sms.send(options)
41
+ expect(data["alibaba_aliqin_fc_sms_num_send_response"]["result"]["success"]).to eq(true)
42
+ end
43
+
28
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alidayu_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - wangrui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-06 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler