xmpush 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -2
- data/lib/xmpush/ios_builder.rb +4 -3
- data/lib/xmpush/version.rb +1 -1
- data/lib/xmpush.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44f85f5a73cf1632ceeb931450724c905bc3c3dc
|
4
|
+
data.tar.gz: 9f9c0248d068a678c0d4fb0f6b01734a46cef49e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aea95504ca6c437000b492ae4e1c8e2f33073187524a39968c4b7fa3e5e1e7bced716329b901f154e73efeea5a7471247e00c287b35cf0d6fb331f9dc0bf5240
|
7
|
+
data.tar.gz: d63a39eb712b59b7a872faac1e8a84918a081e144355a6685c375cd3424badcc3b56661b0bb0ad810b38128ce54873390519f725c59ca5f36b6aa99ccc80c0a4
|
data/README.md
CHANGED
@@ -2,7 +2,20 @@
|
|
2
2
|
|
3
3
|
[XiaoMi push](dev.xiaomi.com) Ruby SDK
|
4
4
|
|
5
|
-
##
|
5
|
+
## Install
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem install xmpush
|
9
|
+
```
|
10
|
+
|
11
|
+
in Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'xmpush'
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
6
19
|
|
7
20
|
```ruby
|
8
21
|
@xm_service = Xmpush::Service.config do |s|
|
@@ -19,7 +32,7 @@ message1 = {description: 'hello'}
|
|
19
32
|
@message1 = @xm_service.build(:ios, message1)
|
20
33
|
@xm_service.push(:all, @message1)
|
21
34
|
|
22
|
-
message2 = {description: 'hello alias'}
|
35
|
+
message2 = {description: 'hello alias', extra: {pid: 111}}
|
23
36
|
@message2 = @xm_service.build(:ios, message2)
|
24
37
|
|
25
38
|
@xm_service.push(:alias, @message2, alias: '1043478')
|
data/lib/xmpush/ios_builder.rb
CHANGED
@@ -3,10 +3,11 @@ module Xmpush
|
|
3
3
|
attr_accessor :sound_url, :badge
|
4
4
|
|
5
5
|
def initialize(**message)
|
6
|
-
|
7
|
-
badge = message.delete(:badge) || 1
|
6
|
+
extra = message.delete(:extra) if message[:extra]
|
8
7
|
super(message)
|
9
|
-
|
8
|
+
extra_message = {sound_url: "", badge: 1}
|
9
|
+
extra_message.merge!(extra) if extra
|
10
|
+
@extra = extra_message
|
10
11
|
end
|
11
12
|
|
12
13
|
def build
|
data/lib/xmpush/version.rb
CHANGED
data/lib/xmpush.rb
CHANGED