Class List Method List File List

# Class: VertxMail::MailClient

Inherits:
  Object
  - Object
  - VertxMail::MailClient
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-mail-client/vertx-mail-service/src/main/resources/vertx-mail/mail_client.rb

## Direct Known Subclasses

MailService

## Class Method Summary (collapse)

- + (::VertxMail::MailClient) create_non_shared(vertx = nil, config = nil)
- + (::VertxMail::MailClient) create_shared(vertx = nil, config = nil, poolName = nil)

## Instance Method Summary (collapse)

- - (void) close
- - (self) send_mail(arg0 = nil) { ... }

## Class Method Details

### + (`::VertxMail::MailClient`) create_non_shared(vertx = nil, config = nil)

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)
- config (`Hash`) (defaults to: `nil`)

Returns:

- (`::VertxMail::MailClient`)

Raises:

- (`ArgumentError`)

    19
    20
    21
    22
    23
    24
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-mail-client/vertx-mail-service/src/main/resources/vertx-mail/mail_client.rb', line 19

    def self.create_non_shared(vertx=nil,config=nil)
      if vertx.class.method_defined?(:j_del) && config.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtMail::MailClient.java_method(:createNonShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtMail::MailConfig.java_class]).call(vertx.j_del,Java::IoVertxExtMail::MailConfig.new(::Vertx::Util::Utils.to_json_object(config))),::VertxMail::MailClient)
      end
      raise ArgumentError, "Invalid arguments when calling create_non_shared(vertx,config)"
    end

### + (`::VertxMail::MailClient`) create_shared(vertx = nil, config = nil, poolName = nil)

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)
- config (`Hash`) (defaults to: `nil`)
- poolName (`String`) (defaults to: `nil`)

Returns:

- (`::VertxMail::MailClient`)

Raises:

- (`ArgumentError`)

    29
    30
    31
    32
    33
    34
    35
    36
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-mail-client/vertx-mail-service/src/main/resources/vertx-mail/mail_client.rb', line 29

    def self.create_shared(vertx=nil,config=nil,poolName=nil)
      if vertx.class.method_defined?(:j_del) && config.class == Hash && !block_given? && poolName == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtMail::MailClient.java_method(:createShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtMail::MailConfig.java_class]).call(vertx.j_del,Java::IoVertxExtMail::MailConfig.new(::Vertx::Util::Utils.to_json_object(config))),::VertxMail::MailClient)
      elsif vertx.class.method_defined?(:j_del) && config.class == Hash && poolName.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtMail::MailClient.java_method(:createShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtMail::MailConfig.java_class,Java::java.lang.String.java_class]).call(vertx.j_del,Java::IoVertxExtMail::MailConfig.new(::Vertx::Util::Utils.to_json_object(config)),poolName),::VertxMail::MailClient)
      end
      raise ArgumentError, "Invalid arguments when calling create_shared(vertx,config,poolName)"
    end

## Instance Method Details

### - (`void`) close

This method returns an undefined value.

Raises:

- (`ArgumentError`)

    48
    49
    50
    51
    52
    53
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-mail-client/vertx-mail-service/src/main/resources/vertx-mail/mail_client.rb', line 48

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

### - (`self`) send_mail(arg0 = nil) { ... }

Parameters:

- arg0 (`Hash`) (defaults to: `nil`)

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    40
    41
    42
    43
    44
    45
    46
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-mail-client/vertx-mail-service/src/main/resources/vertx-mail/mail_client.rb', line 40

    def send_mail(arg0=nil)
      if arg0.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(arg0)),(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(arg0)"
    end