Class: SimpleSlack::Poster

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_slack/poster.rb

Instance Method Summary collapse

Constructor Details

#initialize(slack, simple_slack) ⇒ Poster

Returns a new instance of Poster.



3
4
5
6
# File 'lib/simple_slack/poster.rb', line 3

def initialize(slack, simple_slack)
  @slack = slack
  @simple_slack = simple_slack
end

Instance Method Details

#channel(to:, text:, name: "slacker", **options) ⇒ Object



15
16
17
18
# File 'lib/simple_slack/poster.rb', line 15

def channel(to: , text: , name: "slacker", **options)
  id = convert_channel_to_id(to.to_s)
  send_chat({ username: name, channel: id, text: text }.merge(options))
end

#channels(to:, text:, name: "slacker", **options) ⇒ Object



8
9
10
11
12
13
# File 'lib/simple_slack/poster.rb', line 8

def channels(to: , text: , name: "slacker", **options)
  to.all? do |t|
    id = convert_channel_to_id(t.to_s)
    send_chat({ username: name, channel: id, text: text }.merge(options))
  end
end

#chat(channel: nil, user: nil, text:, name: "slacker", **options) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/simple_slack/poster.rb', line 24

def chat(channel: nil, user: nil, text: , name: "slacker", **options)
  if channel
    self.channel({ to: channel, text: text, name: name }.merge(options))
  elsif user
    "yet"
  end
end

#im(to:, text:, name: "slacker", **options) ⇒ Object



39
40
41
42
# File 'lib/simple_slack/poster.rb', line 39

def im(to: , text: , name: "slacker", **options)
  id = convert_im_to_id(to.to_s)
  send_chat({ username: name, channel: id, text: text }.merge(options))
end

#ims(to:, text:, name: "slacker", **options) ⇒ Object



32
33
34
35
36
37
# File 'lib/simple_slack/poster.rb', line 32

def ims(to: , text: , name: "slacker", **options)
  to.all? do |t|
    id = convert_im_to_id(t.to_s)
    send_chat({ username: name, channel: id, text: text }.merge(options))
  end
end

#user(to:, text:, name: "slacker") ⇒ Object



20
21
22
# File 'lib/simple_slack/poster.rb', line 20

def user(to: , text: , name: "slacker")
  "yet"
end