class Comet::EmailOptions
EmailOptions
is a typed class wrapper around the underlying Comet
Server API data structure.
Attributes
from_email[RW]
@type [String] from_email
from_name[RW]
@type [String] from_name
mode[RW]
@type [String] mode
smtpallow_invalid_certificate[RW]
@type [Boolean] smtpallow_invalid_certificate
smtpallow_unencrypted[RW]
@type [Boolean] smtpallow_unencrypted
smtphost[RW]
@type [String] smtphost
smtppassword[RW]
@type [String] smtppassword
smtpport[RW]
@type [Number] smtpport
smtpusername[RW]
@type [String] smtpusername
unknown_json_fields[RW]
@type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
Public Class Methods
new()
click to toggle source
# File lib/comet/models/email_options.rb, line 47 def initialize clear end
Public Instance Methods
clear()
click to toggle source
# File lib/comet/models/email_options.rb, line 51 def clear @mode = '' @from_email = '' @from_name = '' @smtphost = '' @smtpport = 0 @smtpusername = '' @smtppassword = '' @unknown_json_fields = {} end
from_hash(obj)
click to toggle source
@param [Hash] obj The complete object as a Ruby hash
# File lib/comet/models/email_options.rb, line 70 def from_hash(obj) raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash obj.each do |k, v| case k when 'Mode' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @mode = v when 'FromEmail' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @from_email = v when 'FromName' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @from_name = v when 'SMTPHost' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @smtphost = v when 'SMTPPort' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @smtpport = v when 'SMTPUsername' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @smtpusername = v when 'SMTPPassword' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @smtppassword = v when 'SMTPAllowInvalidCertificate' @smtpallow_invalid_certificate = v when 'SMTPAllowUnencrypted' @smtpallow_unencrypted = v else @unknown_json_fields[k] = v end end end
from_json(json_string)
click to toggle source
@param [String] json_string The complete object in JSON format
# File lib/comet/models/email_options.rb, line 63 def from_json(json_string) raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String from_hash(JSON.parse(json_string)) end
to_h()
click to toggle source
@return [Hash] The complete object as a Ruby hash
# File lib/comet/models/email_options.rb, line 144 def to_h to_hash end
to_hash()
click to toggle source
@return [Hash] The complete object as a Ruby hash
# File lib/comet/models/email_options.rb, line 114 def to_hash ret = {} ret['Mode'] = @mode ret['FromEmail'] = @from_email ret['FromName'] = @from_name unless @smtphost.nil? ret['SMTPHost'] = @smtphost end unless @smtpport.nil? ret['SMTPPort'] = @smtpport end unless @smtpusername.nil? ret['SMTPUsername'] = @smtpusername end unless @smtppassword.nil? ret['SMTPPassword'] = @smtppassword end unless @smtpallow_invalid_certificate.nil? ret['SMTPAllowInvalidCertificate'] = @smtpallow_invalid_certificate end unless @smtpallow_unencrypted.nil? ret['SMTPAllowUnencrypted'] = @smtpallow_unencrypted end @unknown_json_fields.each do |k, v| ret[k] = v end ret end
to_json(options = {})
click to toggle source
@return [String] The complete object as a JSON string
# File lib/comet/models/email_options.rb, line 149 def to_json(options = {}) to_hash.to_json(options) end