mikamai / onesignal-ruby Goto Github PK
View Code? Open in Web Editor NEWA simple, pure Ruby client to the OneSignal Push Notification API
License: MIT License
A simple, pure Ruby client to the OneSignal Push Notification API
License: MIT License
This is the 0.3.0 onesignal.rb module definition, which is different from the latest in the repo (it's missing the configure method for example). My guess is that whoever is using this is referencing the repo?
require 'onesignal/version'
require 'onesignal/client'
require 'onesignal/request'
require 'onesignal/request_error'
require 'onesignal/app_id_missing_error'
require 'onesignal/models/base_model'
require 'onesignal/models/app'
require 'onesignal/models/player'
require 'onesignal/models/notification'
require 'onesignal/resources/base_resource'
require 'onesignal/resources/app_resource'
require 'onesignal/resources/player_resource'
require 'onesignal/resources/notification_resource'
module OneSignal
DEVICE_TYPES = %w(
ios android amazon mpns chrome_app chrome_website wns safari firefox
).freeze
def self.device_type_as_integer(device_type)
DEVICE_TYPES.index(device_type)
end
end```
NoMethodError: private method `define_method' called for OneSignal::Notification::Headings:Class
error showing when I call
OneSignal::Notification::Headings.new(en: 'Hello!', it: 'Ciao!')
doing this in OneSignnal::Automap fixes it, is this the right way?
def create_readers **attributes
attributes.keys.each do |k|
self.class.send(:define_method, k) do
attributes[k]
end
end
end
Also in response
NoMethodError: private method `attr_reader' called for OneSignal::Responses::Notification:Class
usinng the mattr_reader instead attr_reader fixes it in OneSignal::Responses::BaseResponse. is this the right way?
def initialize attributes = {}
@attributes = attributes.deep_symbolize_keys
.keep_if { |k, _v| self.class::ATTRIBUTES_WHITELIST.include?(k.to_sym) }
self.class.mattr_reader(*self.class::ATTRIBUTES_WHITELIST)
end
gem install onesignal-ruby, '~> 0.4'
ERROR: Could not find a valid gem 'onesignal-ruby,' (>= 0) in any repository
ERROR: Possible alternatives: onesignal-ruby, one_signal, onesignal, EsignRuby, functional-ruby
ERROR: Could not find a valid gem '~> 0.4' (>= 0) in any repository
Rails 6.0.2
onesignal-ruby
currently pins rails between 5-6, but 7.0.1 is out:
onesignal-ruby was resolved to 0.6.0, which depends on
activesupport (>= 5.0.0, < 7)
Hi, Thank you all for this amazing Gem. Actually this is not an issue. Is there any example or possible way of how to send a push notification to a single user using this gem?
Bump faraday version upto 2
NameError (uninitialized constant OneSignal::Buttons)
OneSignal::Buttons not working please go through this is asap. Thanks
When using "include_external_user_ids" I'm getting this error:
could not send push notification Platforms You may only send to one delivery channel at a time. Make sure you are only including one of push platforms, Email, or SMS.
According to the API documentation "channel_for_external_user_ids" must be set to 'push', 'email' or 'sms', but the gem doesn't seem to support this.
Looking at the docs, it's not clear how to include parameters listed in:
https://documentation.onesignal.com/reference#section-appearance
Thanks!
Hello!
Great work and great gem, was wondering if you could deploy it on rubygems? It'd be nice to have a master branch too :P
Also, in the readme, it'd be rather helpful to add that you need to require 'onesignal'
in your initializer :)
Cheers
While there is nothing inherently wrong with using OneSignal.define
I think that Onesignal.configure
would be a slightly better choice.
According to the principle of least surprise many developers may be already accustomed to configure
as many other Ruby libraries use the same method name for that configuration pattern (Rails, Rspec, Capybara, Rollbar, Solidus just to name a few I can recall).
Of course in order to make things easier and avoid breaking any existing code the define
method could be simply aliased to configure
.
Hi, I'm trying to install the gem in my Rails 6.0.0 project and I'm getting the following error:
~$ bundle
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
In snapshot (Gemfile.lock):
activesupport (= 6.0.0)
In Gemfile:
onesignal-ruby (~> 0.3.0) was resolved to 0.3.0, which depends on
activesupport (>= 5.0.0, ~> 5.0)
rails (~> 6.0.0) was resolved to 6.0.0, which depends on
activesupport (= 6.0.0)
Running bundle update
will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I just found this gem and it looks promising! thanks in advance.
The current stable version of faraday is 1.1.0 but, in this project that one is ~> 0.15, >= 0.15.4.
Can you update the dependencies?
Our current company plan doesn't support Actions at the moment.
We'll revert back to CircleCI for integration pipelines.
version is 0.6.0
-> OneSignal.fetch_player(player_id)
Traceback (most recent call last):
ArgumentError (wrong number of arguments (given 2, expected 1))
When calling anything like Onesignal.create_notification you will get
ArgumentError: wrong number of arguments (given 2, expected 1)
I understand this is a super simple gem, I was just wondering if there is a way to add parameters document in
https://documentation.onesignal.com/reference/create-notification ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.