Class: TempmailSdk::Email
- Inherits:
-
Object
- Object
- TempmailSdk::Email
- Defined in:
- lib/tempmail_sdk/types.rb
Overview
标准化的邮件对象
Instance Attribute Summary collapse
-
#attachments ⇒ Object
Returns the value of attribute attachments.
-
#date ⇒ Object
Returns the value of attribute date.
-
#from_addr ⇒ Object
Returns the value of attribute from_addr.
-
#html ⇒ Object
Returns the value of attribute html.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_read ⇒ Object
Returns the value of attribute is_read.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#text ⇒ Object
Returns the value of attribute text.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(id: "", from_addr: "", to: "", subject: "", text: "", html: "", date: "", is_read: false, attachments: nil) ⇒ Email
constructor
rubocop:disable Metrics/ParameterLists.
-
#to_h ⇒ Object
rubocop:enable Metrics/ParameterLists.
Constructor Details
#initialize(id: "", from_addr: "", to: "", subject: "", text: "", html: "", date: "", is_read: false, attachments: nil) ⇒ Email
rubocop:disable Metrics/ParameterLists
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/tempmail_sdk/types.rb', line 67 def initialize(id: "", from_addr: "", to: "", subject: "", text: "", html: "", date: "", is_read: false, attachments: nil) @id = id @from_addr = from_addr @to = to @subject = subject @text = text @html = html @date = date @is_read = is_read @attachments = || [] end |
Instance Attribute Details
#attachments ⇒ Object
Returns the value of attribute attachments.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def @attachments end |
#date ⇒ Object
Returns the value of attribute date.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def date @date end |
#from_addr ⇒ Object
Returns the value of attribute from_addr.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def from_addr @from_addr end |
#html ⇒ Object
Returns the value of attribute html.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def html @html end |
#id ⇒ Object
Returns the value of attribute id.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def id @id end |
#is_read ⇒ Object
Returns the value of attribute is_read.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def is_read @is_read end |
#subject ⇒ Object
Returns the value of attribute subject.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def subject @subject end |
#text ⇒ Object
Returns the value of attribute text.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def text @text end |
#to ⇒ Object
Returns the value of attribute to.
64 65 66 |
# File 'lib/tempmail_sdk/types.rb', line 64 def to @to end |
Instance Method Details
#to_h ⇒ Object
rubocop:enable Metrics/ParameterLists
81 82 83 84 85 86 87 |
# File 'lib/tempmail_sdk/types.rb', line 81 def to_h { id: @id, from_addr: @from_addr, to: @to, subject: @subject, text: @text, html: @html, date: @date, is_read: @is_read, attachments: @attachments.map { |a| a.respond_to?(:to_h) ? a.to_h : a } } end |