Class List Method List File List

# Class: VertxMail::MailClient

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

## Direct Known Subclasses

MailService

## Class Method Summary (collapse)

- + (Object) create_non_shared(vertx = nil, config = nil)
- + (Object) create_shared(vertx = nil, config = nil, poolName = nil)

## Instance Method Summary (collapse)

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

## Constructor Details

### - (`MailClient`) initialize(j_del)

Returns a new instance of MailClient

    11
    12
    13
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_client.rb', line 11

    def initialize(j_del)
      @j_del = j_del
    end

## Class Method Details

### + (`Object`) create_non_shared(vertx = nil, config = nil)

Raises:

- (`ArgumentError`)

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

    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

### + (`Object`) create_shared(vertx = nil, config = nil, poolName = nil)

Raises:

- (`ArgumentError`)

    35
    36
    37
    38
    39
    40
    41
    42
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_client.rb', line 35

    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

### - (`Object`) close

Raises:

- (`ArgumentError`)

    56
    57
    58
    59
    60
    61
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_client.rb', line 56

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

### - (`Object`) j_del

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

    def j_del
      @j_del
    end

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

Raises:

- (`ArgumentError`)

    47
    48
    49
    50
    51
    52
    53
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mail/mail_client.rb', line 47

    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