Class: VertxMail::MailClient
- Inherits:
-
Object
- Object
- VertxMail::MailClient
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb
Overview
SMTP mail client for Vert.x
A simple asynchronous API for sending mails from Vert.x applications
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxMail::MailClient) createNonShared(vertx, config)
create a non shared instance of the mail client.
-
+ (::VertxMail::MailClient) create_shared(*args)
Create a Mail client which shares its connection pool with any other Mail clients created with the same pool name.
-
+ (Object) DEFAULT_POOL_NAME
The name of the default pool.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) close
close the MailClient.
-
- (self) sendMail(email, resultHandler) { ... }
send a single mail via MailClient.
Class Method Details
+ (Boolean) accept?(obj)
22 23 24 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 22 def @@j_api_type.accept?(obj) obj.class == MailClient end |
+ (::VertxMail::MailClient) createNonShared(vertx, config)
create a non shared instance of the mail client
86 87 88 89 90 91 92 93 94 95 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 86 def self.create_non_shared(*args) if args[0].class.method_defined?(:j_del) && args[1].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(args[0].j_del,Java::IoVertxExtMail::MailConfig.new(::Vertx::Util::Utils.to_json_object(args[1]))),::VertxMail::MailClient) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling create_non_shared(#{args[0]},#{args[1]})" end end |
+ (::VertxMail::MailClient) createShared(vertx, config) + (::VertxMail::MailClient) createShared(vertx, config, poolName)
Create a Mail client which shares its connection pool with any other Mail clients created with the same
pool name
69 70 71 72 73 74 75 76 77 78 79 80 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 69 def self.create_shared(*args) if args[0].class.method_defined?(:j_del) && args[1].class == Hash && !block_given? && args[2] == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtMail::MailClient.java_method(:createShared, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtMail::MailConfig.java_class]).call(args[0].j_del,Java::IoVertxExtMail::MailConfig.new(::Vertx::Util::Utils.to_json_object(args[1]))),::VertxMail::MailClient) elsif args[0].class.method_defined?(:j_del) && args[1].class == Hash && args[2].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(args[0].j_del,Java::IoVertxExtMail::MailConfig.new(::Vertx::Util::Utils.to_json_object(args[1])),args[2]),::VertxMail::MailClient) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling create_shared(#{args[0]},#{args[1]},#{args[2]})" end end |
+ (Object) DEFAULT_POOL_NAME
The name of the default pool
110 111 112 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 110 def self.DEFAULT_POOL_NAME Java::IoVertxExtMail::MailClient.DEFAULT_POOL_NAME end |
+ (Object) j_api_type
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 31 def self.j_api_type @@j_api_type end |
+ (Object) j_class
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 34 def self.j_class Java::IoVertxExtMail::MailClient.java_class end |
+ (Object) unwrap(obj)
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 28 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
25 26 27 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 25 def @@j_api_type.wrap(obj) MailClient.new(obj) end |
Instance Method Details
- (void) close
This method returns an undefined value.
close the MailClient
99 100 101 102 103 104 105 106 107 108 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 99 def close if !block_given? return @j_del.java_method(:close, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling close()" end end |
- (self) sendMail(email, resultHandler) { ... }
send a single mail via MailClient
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 42 def send_mail(*args) if args[0].class == Hash && true if (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(args[0])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @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(args[0])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtMail::MailResult)) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling send_mail(#{args[0]})" end end |