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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4caa42a3a922ed32c5314d13c4991e4e4a8e8c3d
4
- data.tar.gz: c1f3b39c7b22b073467340b7852a4af325f9aa9d
3
+ metadata.gz: 80408b57302945a3b42613cf4d6b6742f226767a
4
+ data.tar.gz: 13c8d28b8861fe7e4e12eec75ec082d94f96c06b
5
5
  SHA512:
6
- metadata.gz: bcd2fe854b411dc285e8699e6f26486ff944d1d8c54f0e0fbffea08b8f540ce2492d562effc7ec3e12d168218d16e02d4761d52b1c55543b7540046d1d539914
7
- data.tar.gz: 6948aa926a8a70bef6f83433a85ff025abaf7c57e2999834c428d331aac5210d9d8ac3537ccdb43c95001ccba78be697002249484d2a85e14b9bc99587547a74
6
+ metadata.gz: f86503462b02b7154fe6c85862a158f5ca1a56d78db5ce059d77079fa84798554e6e37e63971c428b4da2c832099ac2e8d0ca8f332ba0d3a90131c896069b016
7
+ data.tar.gz: f6c898ae7c1ae509f981675b977f346fed887daaefc0ddd6c12c9abe0f79a161272885b7de9c63bd6412038487b8e9d21a7ceabe0783fd08eade9fe0c134bdb3
@@ -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.to_json
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
- raise ArgumentError, "click_action 参数可选值为:'open_app', 'open_url', 'intent'"
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
- puts params.inspect
45
- res = RestClient.post(server, params.to_json, :content_type => :json)
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
@@ -1,3 +1,3 @@
1
1
  module Ixintui
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
data/readme.md CHANGED
@@ -6,7 +6,7 @@
6
6
  Add ixintui to your gemfile
7
7
 
8
8
  ```
9
- gem 'ixintui', '~> 1.0.0'
9
+ gem 'ixintui', '~> 1.0.4'
10
10
  ```
11
11
 
12
12
  ### Step 2
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.3
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-17 00:00:00.000000000 Z
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client