Class List Method List File List

# Class: VertxMail::MailService

Inherits:
  MailClient
  - Object
  - MailClient
  - VertxMail::MailService
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_service.rb

## Class Method Summary (collapse)

- + (Object) create_event_bus_proxy(vertx = nil, address = nil)

## Instance Method Summary (collapse)

- - (Object) close
- - (MailService) initialize(j_del) constructor
  A new instance of MailService.
- - (Object) j_del
- - (Object) send_mail(email = nil)

### Methods inherited from MailClient

create_non_shared, create_shared

## Constructor Details

### - (`MailService`) initialize(j_del)

Returns a new instance of MailService

    9
    10
    11
    12
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_service.rb', line 9

    def initialize(j_del)
      super(j_del)
      @j_del = j_del
    end

## Class Method Details

### + (`Object`) create_event_bus_proxy(vertx = nil, address = nil)

Raises:

- (`ArgumentError`)

    22
    23
    24
    25
    26
    27
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_service.rb', line 22

    def self.create_event_bus_proxy(vertx=nil,address=nil)
      if vertx.class.method_defined?(:j_del) && address.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtMail::MailService.java_method(:createEventBusProxy, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(vertx.j_del,address),::VertxMail::MailService)
      end
      raise ArgumentError, "Invalid arguments when calling create_event_bus_proxy(vertx,address)"
    end

## Instance Method Details

### - (`Object`) close

Raises:

- (`ArgumentError`)

    39
    40
    41
    42
    43
    44
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_service.rb', line 39

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`Object`) j_del

    15
    16
    17
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_service.rb', line 15

    def j_del
      @j_del
    end

### - (`Object`) send_mail(email = nil)

Raises:

- (`ArgumentError`)

    31
    32
    33
    34
    35
    36
    37
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_service.rb', line 31

    def send_mail(email=nil)
      if email.class == Hash && block_given?
        @j_del.java_method(:sendMail, [Java::IoVertxExtMail::MailMessage.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtMail::MailMessage.new(::Vertx::Util::Utils.to_json_object(email)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling send_mail(email)"
    end