Class: VertxMail::MailService

Inherits:
MailClient show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from MailClient

create_non_shared, create_shared

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


19
20
21
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb', line 19

def @@j_api_type.accept?(obj)
  obj.class == MailService
end

+ (::VertxMail::MailService) create_event_bus_proxy(vertx = nil, address = nil)

create a proxy of MailService that delegates to the mail service running somewhere else via the event bus

Parameters:

  • vertx (::Vertx::Vertx) (defaults to: nil)
    the Vertx instance the proxy will be run in
  • address (String) (defaults to: nil)
    the eb address of the mail service running somewhere, default is "vertx.mail"

Returns:

Raises:

  • (ArgumentError)


38
39
40
41
42
43
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb', line 38

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

+ (Object) DEFAULT_POOL_NAME

The name of the default pool


62
63
64
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb', line 62

def self.DEFAULT_POOL_NAME
  Java::IoVertxExtMail::MailService.DEFAULT_POOL_NAME
end

+ (Object) j_api_type



28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb', line 28

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb', line 31

def self.j_class
  Java::IoVertxExtMail::MailService.java_class
end

+ (Object) unwrap(obj)



25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb', line 25

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb', line 22

def @@j_api_type.wrap(obj)
  MailService.new(obj)
end

Instance Method Details

- (void) close

This method returns an undefined value.

Raises:

  • (ArgumentError)


55
56
57
58
59
60
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.rb', line 55

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

- (self) send_mail(email = nil) { ... }

Parameters:

  • email (Hash) (defaults to: nil)

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


47
48
49
50
51
52
53
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_service.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