ixintui 1.0.3 → 1.0.4
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/ixintui/service.rb +8 -9
- data/lib/ixintui/version.rb +1 -1
- data/readme.md +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80408b57302945a3b42613cf4d6b6742f226767a
|
4
|
+
data.tar.gz: 13c8d28b8861fe7e4e12eec75ec082d94f96c06b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f86503462b02b7154fe6c85862a158f5ca1a56d78db5ce059d77079fa84798554e6e37e63971c428b4da2c832099ac2e8d0ca8f332ba0d3a90131c896069b016
|
7
|
+
data.tar.gz: f6c898ae7c1ae509f981675b977f346fed887daaefc0ddd6c12c9abe0f79a161272885b7de9c63bd6412038487b8e9d21a7ceabe0783fd08eade9fe0c134bdb3
|
data/lib/ixintui/service.rb
CHANGED
@@ -12,15 +12,13 @@ module Ixintui
|
|
12
12
|
def self.base_data
|
13
13
|
{
|
14
14
|
appkey: app_key,
|
15
|
-
is_notif: 1
|
16
|
-
click_action: 'open_app',
|
17
|
-
open_app: true
|
15
|
+
is_notif: 1
|
18
16
|
}
|
19
17
|
end
|
20
18
|
|
21
19
|
def self.sign(params)
|
22
20
|
data = Hash[params.sort]
|
23
|
-
string = data
|
21
|
+
string = JSON.dump(data)
|
24
22
|
string += app_secret_key
|
25
23
|
Digest::MD5.hexdigest(string)
|
26
24
|
end
|
@@ -30,20 +28,21 @@ module Ixintui
|
|
30
28
|
when 'open_app', 'open_url', 'intent'
|
31
29
|
raise ArgumentError, "设置了 click_action 参数为 '#{params[:click_action]}' 但是没有设置 #{params[:click_action]} 参数" if params[params[:click_action].to_sym].blank?
|
32
30
|
else
|
33
|
-
|
31
|
+
params[:click_action] = 'open_app'
|
32
|
+
params[:open_app] = true
|
34
33
|
end
|
35
34
|
|
36
35
|
raise ArgumentError, "app_key 未设置" if params[:appkey].blank?
|
36
|
+
return params
|
37
37
|
end
|
38
38
|
|
39
39
|
def self.push(options = {})
|
40
40
|
params = base_data.merge(options)
|
41
|
-
validates(params)
|
41
|
+
params = validates(params)
|
42
42
|
params[:sign] = sign(params)
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
res.body
|
44
|
+
res = RestClient.post(server, JSON.dump(params), content_type: :json)
|
45
|
+
JSON.parse(res.body)
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
data/lib/ixintui/version.rb
CHANGED
data/readme.md
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ixintui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shawn Yu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|