Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acts_as_hoc_pushable

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acts_as_hoc_pushable

  • 1.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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.

FAQs

Package last updated on 10 Sep 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc