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
Direct Known Subclasses
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxMail::MailClient) create_non_shared(vertx = nil, config = nil)
create a non shared instance of the mail client.
-
+ (::VertxMail::MailClient) create_shared(vertx = nil, config = nil, poolName = nil)
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) send_mail(email = nil) { ... }
send a single mail via MailClient.
Class Method Details
+ (Boolean) accept?(obj)
20 21 22 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 20 def @@j_api_type.accept?(obj) obj.class == MailClient end |
+ (::VertxMail::MailClient) create_non_shared(vertx = nil, config = nil)
create a non shared instance of the mail client
39 40 41 42 43 44 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 39 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)
Create a Mail client which shares its connection pool with any other Mail clients created with the same
pool name
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 51 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 |
+ (Object) DEFAULT_POOL_NAME
The name of the default pool
79 80 81 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 79 def self.DEFAULT_POOL_NAME Java::IoVertxExtMail::MailClient.DEFAULT_POOL_NAME end |
+ (Object) j_api_type
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 29 def self.j_api_type @@j_api_type end |
+ (Object) j_class
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 32 def self.j_class Java::IoVertxExtMail::MailClient.java_class end |
+ (Object) unwrap(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 26 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 23 def @@j_api_type.wrap(obj) MailClient.new(obj) end |
Instance Method Details
- (void) close
This method returns an undefined value.
close the MailClient
72 73 74 75 76 77 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 72 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) { ... }
send a single mail via MailClient
63 64 65 66 67 68 69 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mail/mail_client.rb', line 63 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 |