Class: Netbout::Message
- Inherits:
-
Object
- Object
- Netbout::Message
- Defined in:
- lib/netbout/message.rb
Overview
Message.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
- #attach(flag) ⇒ Object
- #author ⇒ Object
- #detach(flag) ⇒ Object
- #flags ⇒ Object
- #id ⇒ Object
-
#initialize(iri, token, json) ⇒ Message
constructor
A new instance of Message.
- #text ⇒ Object
Constructor Details
#initialize(iri, token, json) ⇒ Message
Returns a new instance of Message.
29 30 31 32 33 |
# File 'lib/netbout/message.rb', line 29 def initialize(iri, token, json) @iri = iri @token = token @json = json end |
Instance Method Details
#attach(flag) ⇒ Object
51 52 53 54 |
# File 'lib/netbout/message.rb', line 51 def attach(flag) Netbout::Http.new(@iri.append('/m').append(id).append('/attach'), @token) .post('name' => flag) end |
#author ⇒ Object
39 40 41 |
# File 'lib/netbout/message.rb', line 39 def @json['author'] end |
#detach(flag) ⇒ Object
56 57 58 |
# File 'lib/netbout/message.rb', line 56 def detach(flag) Netbout::Http.new(@iri.append('/m').append(id).append('/detach').add(name: flag), @token).get end |
#flags ⇒ Object
47 48 49 |
# File 'lib/netbout/message.rb', line 47 def flags JSON.parse(Netbout::Http.new(@iri.append('/flags').append(id), @token).get.response_body) end |
#id ⇒ Object
35 36 37 |
# File 'lib/netbout/message.rb', line 35 def id @json['id'].to_i end |
#text ⇒ Object
43 44 45 |
# File 'lib/netbout/message.rb', line 43 def text @json['text'] end |