Inspiration comes from umeng
Add this line to your application's Gemfile:
gem 'umengo'
And then execute:
$ bundle
Or install it yourself as:
$ gem install umengo
-
params require :data, :payload, :body
-
params optional :extra, :extra, :policy
android_params = {
data: {
alias_type: "xx",
alias: "xx",
file_id: "xx",
filter: {},
production_mode: "true/false",
description: "xx",
thirdparty_id: "xx"
},
payload: {
display_type: "notifcation/message"
},
body: {
ticker: "xxx",
title: "xxx",
text: "content",
after_open: "xx",
activity: "xx"
icon: "xx",
largeIcon: "xx",
img: "xx",
sound: "xx",
builder_id: "xx",
play_vibrate: "true/false",
play_lights:" true/false",
play_sound: "true/false",
url: "xx",
custom: "xx"/{}
}
extra: {
key1: "value1",
},
policy: {
start_time: "xx",
expire_time: "xx",
max_send_num: "xx",
out_biz_no: "xx"
}
}
ios_params = {
data: {
alias_type: "xx",
alias: "xx",
file_id: "xx",
filter: {},
production_mode: "false",
description: "xx",
thirdparty_id: "xx"
},
body: {
alert: "content",
badge: "xx",
sound: "xx",
"content-available" => "xx",
category: "xx"
icon: "xx",
largeIcon: "xx",
img: "xx",
sound: "xx",
builder_id: "xx",
play_vibrate: "true/false",
play_lights:" true/false",
play_sound: "true/false",
url: "xx",
custom: "xx"/{}
}
extra: {
key1: "value1",
},
policy: {
start_time: "xx",
expire_time: "xx",
max_send_num: "xx",
out_biz_no: "xx"
}
}
plantform = "ios/android"
client = Umengo::Client.new(appkey, app_master_secret, plantform)
client.broadcast(android_params)
client.unicast(device_tokens, android_params)
client.listcast(device_tokens, android_params)
- Spec tests
- Make the parameters more easily assembled
- ios and android more easily distinguish
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/umengo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.