All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nannoqServicesGcm.notifications_service.rb Maven / Gradle / Ivy

There is a newer version: 1.1.7
Show newest version
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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy