🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

pushlayer

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pushlayer

0.9.1
Rubygems
Version published
Maintainers
2
Created
Source

Pushlayer

Send iOS push notifications using the PushLayer.com service.

Installation

Add pushlayer to your Gemfile:

gem pushlayer

Be sure to run bundle install afterwards.

Alernatively, you can install it locally:

gem install pushlayer

Requirements

PushLayer depends on ruby 1.9+, rest-client, and multi_json.

Getting Started

First, you need an account with PushLayer.com, and an application. An application defines the certificate to use with Apple, and gives you a corresponding api_key to reference when sending push notifications. Lastly, each application has a unique ID, and can be found by clicking on your application name. The URL will look something like https://www.pushlayer.com/applications/123, where 123 is the application ID.

Second, you need to tell the Pushlayer library about your ID and api_key:

Pushlayer.api_id = 123
Pushlayer.api_key = 'my api key'

Third, you need to know the device token you wish to send a notification to. A device token is generated by iOS in response to the user agreeing to receive push notifications from your app. Check out the documentation on how to request this permission.

Sending a notification

To send a notification, simply:

Pushlayer.post_notification 'device_token', 'Hello iOS!'

This will tell PushLayer to construct a payload consisting of the alert message 'Hello iOS!' and send it to the specified device token. If everything goes well, your iOS app should receive the notification.

The result will be a Ruby hash of the PushLayer notification object, similar to:

{
  "action_loc_key":null,
  "alert_body":"Hello from PushLayer!",
  "application_id":1,
  "badge":null,
  "created_at":
  "2013-01-08T03:50:06Z",
  "custom_payload":null,
  "device_token":"123abc",
  "id":3,
  "launch_image":null,
  "loc_args":null,
  "loc_key":null,
  "sound":null,
  "state":"pending",
  "status_code":null,
  "updated_at":"2013-01-08T03:50:06Z"
}

Help

If you find a bug, open an Issue. Pull Requests are welcome. If you get stuck and need help, feel free to contact us at info@pushlayer.com.

FAQs

Package last updated on 10 Jan 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts