nannoqServicesGcm.notifications_service.rb Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fcm Show documentation
Show all versions of fcm Show documentation
FCM Layer of Nannoq Tools
require 'vertx/util/utils.rb'
# Generated from com.nannoq.tools.fcm.server.services.NotificationsService
module NannoqServicesGcm
class NotificationsService
# @private
# @param j_del [::NannoqServicesGcm::NotificationsService] the java delegate
def initialize(j_del)
@j_del = j_del
end
# @private
# @return [::NannoqServicesGcm::NotificationsService] the underlying java delegate
def j_del
@j_del
end
@@j_api_type = Object.new
def @@j_api_type.accept?(obj)
obj.class == NotificationsService
end
def @@j_api_type.wrap(obj)
NotificationsService.new(obj)
end
def @@j_api_type.unwrap(obj)
obj.j_del
end
def self.j_api_type
@@j_api_type
end
def self.j_class
Java::ComNannoqToolsFcmServerServices::NotificationsService.java_class
end
# @param [Hash{String => Object}] messageBody
# @yield
# @return [self]
def send_topic_notification(messageBody=nil)
if messageBody.class == Hash && block_given?
@j_del.java_method(:sendTopicNotification, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(messageBody),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling send_topic_notification(#{messageBody})"
end
# @param [Hash{String => Object}] messageBody
# @yield
# @return [self]
def send_user_notification(messageBody=nil)
if messageBody.class == Hash && block_given?
@j_del.java_method(:sendUserNotification, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(messageBody),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling send_user_notification(#{messageBody})"
end
# @return [void]
def close
if !block_given?
return @j_del.java_method(:close, []).call()
end
raise ArgumentError, "Invalid arguments when calling close()"
end
end
end