Class: PeertransferChat::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/peertransfer_chat/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



15
16
17
18
19
20
# File 'lib/peertransfer_chat/client.rb', line 15

def initialize
  if block_given?
    @config = Config.new
    yield(@config)
  end
end

Instance Attribute Details

#config=(value) ⇒ Object

Sets the attribute config

Parameters:

  • value

    the value to set the attribute config to.



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



27
28
29
30
# File 'lib/peertransfer_chat/client.rb', line 27

def speak(message)
  slack = Slackr.connect(team, incoming_token, slack_opts)
  slack.say(message)
end

#upload(filename) ⇒ Object



22
23
24
25
# File 'lib/peertransfer_chat/client.rb', line 22

def upload(filename)
  slack = Slackr.connect(team, api_token, slack_opts)
  slack.upload(filename, { 'channels' => channel_id })
end