Git Product home page Git Product logo

acts_as_hoc_pushable's Introduction

ActsAsHocPushable

Installation

Add this line to your application's Gemfile:

gem 'acts_as_hoc_pushable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install acts_as_hoc_pushable

Usage

Make application ready for acts_as_hoc_pushable

Install by running:

$ rails generate acts_as_hoc_pushable:install

This will create, models, migrations and initializer

Extend model

Add the acts_as_hoc_pushable to the model you want to be extended with push functionallity - eg. user.

#app/models/user.rb
class User < ApplicationRecord
  acts_as_hoc_pushable
end

now you have the following functionallity added to the model

  • Add a device to an user user.add_device(token:, platform:, platform_version:, push_environment:) user.add_device(params) user.add_device!(params)
  • Get active devices user.active_devices
  • Get platform specific devices user.ios_devices user.android_devices
  • Send push notification user.send_push_notification(title:, message:, **data)
  • Send silent push notification send_silent_push_notification(**data)

Other functions

Send to topic:

You can send push notifications to a topic with:

  ActsAsHocPushable::PushNotification.send_push_notification_to_topic(topic:, title: nil, message: nil, **data)

or for silent notification:

  ActsAsHocPushable::PushNotification.send_silent_push_notification_to_topic(topic:, **data)

Send to many devices:

  ActsAsHocPushable::PushNotification.send_push_notification(devices:, title: nil, message: nil, **data)

or for silent notification:

  ActsAsHocPushable::PushNotification.send_silent_push_notification(devices:, **data)

License

The gem is available as open source under the terms of the MIT License.

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.