umengo 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7045f5cce6b6d6c224e55209f57659d58169594c
4
- data.tar.gz: 3ea83a80f9de070c9a937942234222275e7b8f71
3
+ metadata.gz: da164f68aece947fc6c4cd65c5c7e6e4e72edcf9
4
+ data.tar.gz: b653920c70e3441719ccdb5c9f82bf36308e26a3
5
5
  SHA512:
6
- metadata.gz: ab2cec7616252384a30b832556a436855ceb89f621ddfc93bc0d23f3e0e9a45441ab72061ca7b9b92e49e7cd31e4327f3d00c8eed9b8b05dca309745abc783f5
7
- data.tar.gz: f1c6477610d004de1d8714556fb128752ec8f657c399e1f766cf3aceccb9e95893641266b887285edfbc8472617d609b7a06e66c60fc64087d52f80ef81ccba4
6
+ metadata.gz: 8ac9a5410487c0d69f81e7d1f30ddc7c3c3eb6b8add8848d8bb10d69b3c0c66e41b0937d8f72fc456d532dadfa592e0d7ca96ddafcd400ffca7c27a91141d73c
7
+ data.tar.gz: b1c691793588182d55e428674d47b0eb4a2d2307f6aad519a61f0b79015a34540dff08826e08d6580a75d176677e45db956ecb660d8f357278610e7d619d14cc
data/README.md CHANGED
@@ -20,13 +20,126 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ - params require :data, :payload, :body
24
+
25
+ - params optional :extra, :extra, :policy
26
+
27
+ #### Android push params
28
+
29
+ ```ruby
30
+ android_params = {
31
+ data: {
32
+ alias_type: "xx",
33
+ alias: "xx",
34
+ file_id: "xx",
35
+ filter: {},
36
+ production_mode: "true/false",
37
+ description: "xx",
38
+ thirdparty_id: "xx"
39
+ },
40
+ payload: {
41
+ display_type: "notifcation/message"
42
+ },
43
+ body: {
44
+ ticker: "xxx",
45
+ title: "xxx",
46
+ text: "content",
47
+ after_open: "xx",
48
+ activity: "xx"
49
+ icon: "xx",
50
+ largeIcon: "xx",
51
+ img: "xx",
52
+ sound: "xx",
53
+ builder_id: "xx",
54
+ play_vibrate: "true/false",
55
+ play_lights:" true/false",
56
+ play_sound: "true/false",
57
+ url: "xx",
58
+ custom: "xx"/{}
59
+ }
60
+ extra: {
61
+ key1: "value1",
62
+ },
63
+ policy: {
64
+ start_time: "xx",
65
+ expire_time: "xx",
66
+ max_send_num: "xx",
67
+ out_biz_no: "xx"
68
+ }
69
+ }
70
+
71
+ ```
72
+
73
+ #### Ios push params
74
+ ```ruby
75
+ ios_params = {
76
+ data: {
77
+ alias_type: "xx",
78
+ alias: "xx",
79
+ file_id: "xx",
80
+ filter: {},
81
+ production_mode: "false",
82
+ description: "xx",
83
+ thirdparty_id: "xx"
84
+ },
85
+ body: {
86
+ alert: "content",
87
+ badge: "xx",
88
+ sound: "xx",
89
+ "content-available" => "xx",
90
+ category: "xx"
91
+ icon: "xx",
92
+ largeIcon: "xx",
93
+ img: "xx",
94
+ sound: "xx",
95
+ builder_id: "xx",
96
+ play_vibrate: "true/false",
97
+ play_lights:" true/false",
98
+ play_sound: "true/false",
99
+ url: "xx",
100
+ custom: "xx"/{}
101
+ }
102
+ extra: {
103
+ key1: "value1",
104
+ },
105
+ policy: {
106
+ start_time: "xx",
107
+ expire_time: "xx",
108
+ max_send_num: "xx",
109
+ out_biz_no: "xx"
110
+ }
111
+ }
112
+ ```
113
+
114
+ ```ruby
115
+ plantform = "ios/android"
116
+ client = Umengo::Client.new(appkey, app_master_secret, plantform)
117
+ ```
118
+
119
+ ##### broadcast
120
+ ```
121
+ client.broadcast(android_params)
122
+ ```
123
+
124
+
125
+ ##### unicast
126
+ ```
127
+ client.unicast(device_tokens, android_params)
128
+ ```
129
+
130
+ ##### listcast
131
+ ```
132
+ client.listcast(device_tokens, android_params)
133
+ ```
134
+
24
135
 
25
136
  ## Development
26
137
 
27
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
138
+ ### TODO
28
139
 
29
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
140
+ - Spec tests
141
+ - Make the parameters more easily assembled
142
+ - ios and android more easily distinguish
30
143
 
31
144
  ## Contributing
32
145
 
data/lib/umengo/util.rb CHANGED
@@ -5,7 +5,7 @@ module Umengo
5
5
  def generate_sign(uri, params)
6
6
  method = 'POST'
7
7
  url = [Umengo::UMENG_HOST, '/', uri]
8
- post_body = Oj.dump(params)
8
+ post_body = JSON.dump(params)
9
9
  Digest::MD5.hexdigest([method, url, post_body, @app_master_secret].join)
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module Umengo
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umengo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jed_Huo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-03 00:00:00.000000000 Z
11
+ date: 2016-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday