Class: Wikidotrb::Module::PrivateMessage
- Inherits:
-
Object
- Object
- Wikidotrb::Module::PrivateMessage
- Extended by:
- Common::Decorators
- Defined in:
- lib/wikidotrb/module/private_message.rb
Instance Attribute Summary collapse
-
#body
readonly
Returns the value of attribute body.
-
#client
readonly
Returns the value of attribute client.
-
#created_at
readonly
Returns the value of attribute created_at.
-
#id
readonly
Returns the value of attribute id.
-
#recipient
readonly
Returns the value of attribute recipient.
-
#sender
readonly
Returns the value of attribute sender.
-
#subject
readonly
Returns the value of attribute subject.
Class Method Summary collapse
- .from_id(client:, message_id:)
- .login_required(*methods) extended from Common::Decorators
- .send_message(client:, recipient:, subject:, body:)
Instance Method Summary collapse
-
#initialize(client:, id:, sender:, recipient:, subject:, body:, created_at:) ⇒ PrivateMessage
constructor
A new instance of PrivateMessage.
- #to_s
Constructor Details
#initialize(client:, id:, sender:, recipient:, subject:, body:, created_at:) ⇒ PrivateMessage
Returns a new instance of PrivateMessage.
108 109 110 111 112 113 114 115 116 |
# File 'lib/wikidotrb/module/private_message.rb', line 108 def initialize(client:, id:, sender:, recipient:, subject:, body:, created_at:) @client = client @id = id @sender = sender @recipient = recipient @subject = subject @body = body @created_at = created_at end |
Instance Attribute Details
#body (readonly)
Returns the value of attribute body.
106 107 108 |
# File 'lib/wikidotrb/module/private_message.rb', line 106 def body @body end |
#client (readonly)
Returns the value of attribute client.
106 107 108 |
# File 'lib/wikidotrb/module/private_message.rb', line 106 def client @client end |
#created_at (readonly)
Returns the value of attribute created_at.
106 107 108 |
# File 'lib/wikidotrb/module/private_message.rb', line 106 def created_at @created_at end |
#id (readonly)
Returns the value of attribute id.
106 107 108 |
# File 'lib/wikidotrb/module/private_message.rb', line 106 def id @id end |
#recipient (readonly)
Returns the value of attribute recipient.
106 107 108 |
# File 'lib/wikidotrb/module/private_message.rb', line 106 def recipient @recipient end |
#sender (readonly)
Returns the value of attribute sender.
106 107 108 |
# File 'lib/wikidotrb/module/private_message.rb', line 106 def sender @sender end |
#subject (readonly)
Returns the value of attribute subject.
106 107 108 |
# File 'lib/wikidotrb/module/private_message.rb', line 106 def subject @subject end |
Class Method Details
.from_id(client:, message_id:)
122 123 124 |
# File 'lib/wikidotrb/module/private_message.rb', line 122 def self.from_id(client:, message_id:) PrivateMessageCollection.from_ids(client: client, message_ids: []).first end |
.login_required(*methods) Originally defined in module Common::Decorators
.send_message(client:, recipient:, subject:, body:)
126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/wikidotrb/module/private_message.rb', line 126 def self.(client:, recipient:, subject:, body:) client.amc_client.request( bodies: [{ source: body, subject: subject, to_user_id: recipient.id, action: "DashboardMessageAction", event: "send", moduleName: "Empty" }] ) end |
Instance Method Details
#to_s
118 119 120 |
# File 'lib/wikidotrb/module/private_message.rb', line 118 def to_s "PrivateMessage(id=#{id}, sender=#{sender}, recipient=#{recipient}, subject=#{subject})" end |