Giter Club home page Giter Club logo

j7w1's Introduction

J7W1

A gem to send the push notification to mobile app via Amazon Simple Notification Service (SNS). Currently supports only iOS platform at production quality. The support for Android is experimentally implemented.

Installation

Add this line to your application's Gemfile:

gem 'j7w1'

And then execute:

$ bundle

Or install it yourself as:

$ gem install j7w1

Usage

First, configure your app.

J7W1.configure 'config.yml'

Or, you may configure programatically as below:

configuration = {
    app_endpoint: {
        ios: {arn: ...},
    },
    account: {
        ...
    }
}
J7W1.configure 

Configuration is expected to have the structure as below:

app_endpoint:
    ios:
        arn: "<The ARN of your app.>"
	android:
		arn: "<The ARN of your android app.>"
account:
    access_key_id: "<Your Access Key>"
    secret_access_key: "<Your Secret Key>"
    region: '<Your Region>'

If you use this with RoR, top-level environmental definition can be available.

Registering device to SNS

J7W1::PushClient.create_device_endpoint.

J7W1::PushClient.create_device_identifier device_identifier, platform

This method returns the arn registered.

Sending push

J7W1::PushClient.push.

J7W1::PushClient.push endpoint_arn, platform, message: some_message, badge: badge_count, sound: xxx

endpoint_arn should be the return value of the :create_device_endpoint above.

RoR Integration

The generator j7w1:model must be useful for you. It provides the items below:

  1. The model J7W1ApplicationDevice. This model enables you to store the device information and to push easily.
  2. The migration for the model above.
  3. Asyncronous SNS Syncing support. Currently delayed_job and sidekiq are supported. If you use this feature, invoke j7w1:model generation with --async-engine=(delayed_job|sidekiq).

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author

TOYODA Naoto https://github.com/condor

j7w1's People

Contributors

condor avatar

Watchers

James Cloos avatar Mohamed Sharaf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.