Class: PeertransferChat::Client
- Inherits:
-
Object
- Object
- PeertransferChat::Client
- Defined in:
- lib/peertransfer_chat/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
writeonly
Sets the attribute config.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #speak(message) ⇒ Object
- #upload(filename, opts = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#config=(value) ⇒ Object
Sets the attribute config
5 6 7 |
# File 'lib/peertransfer_chat/client.rb', line 5 def config=(value) @config = value end |
Class Method Details
.speak(something) ⇒ Object
11 12 13 |
# File 'lib/peertransfer_chat/client.rb', line 11 def self.speak(something) new.speak(something) end |
.upload(filename) ⇒ Object
7 8 9 |
# File 'lib/peertransfer_chat/client.rb', line 7 def self.upload(filename) new.upload(filename) end |
Instance Method Details
#speak(message) ⇒ Object
33 34 35 |
# File 'lib/peertransfer_chat/client.rb', line 33 def speak() client.chat_postMessage(channel: channel, text: , as_user: true, username: username) end |
#upload(filename, opts = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/peertransfer_chat/client.rb', line 22 def upload(filename, opts = {}) client.files_upload( channels: channel, as_user: true, file: Faraday::UploadIO.new(filename, 'image/png'), title: 'output.txt', filename: filename, initial_comment: 'Attachment' ) end |