Class: Gossip::CampfireCrony
- Inherits:
-
Crony
- Object
- Crony
- Gossip::CampfireCrony
show all
- Defined in:
- lib/gossip/cronies/campfire.rb
Overview
Instance Attribute Summary
Attributes inherited from Crony
#is_bff_by_default, #user_choices
Instance Method Summary
collapse
Methods inherited from Crony
#add_bff_choice, #checked, #df, #initialize, #is_bff?, #is_bff_by_default?, #postprocess_user_choices
Constructor Details
This class inherits a constructor from Gossip::Crony
Instance Method Details
#add_configuration_choices(builder) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/gossip/cronies/campfire.rb', line 26
def add_configuration_choices(builder)
builder.add_choice(:campfire_login,
:default => checked(:default_login)) { | command_line |
command_line.uses_option("--campfire-login LOGIN",
"Your Campfire login, an email address",
df(:default_login)
)
}
builder.add_choice(:campfire_password,
:default => checked(:default_password)) { | command_line |
command_line.uses_option("--campfire-password PASSWORD",
"Your Campfire password.",
df(:default_password)
)
}
builder.add_choice(:campfire_subdomain,
:default => checked(:default_subdomain)) { | command_line |
command_line.uses_option("--campfire-subdomain NAME",
"Your Campfire subdomain.",
"(As in 'subdomain.campfire.com')",
df(:default_subdomain)
)
}
builder.add_choice(:campfire_room,
:default => checked(:default_room)) { | command_line |
command_line.uses_option("--campfire-room NAME",
"A campfire room to receive the message.",
df(:default_room)
)
}
end
|
#command_line_description ⇒ Object
20
21
22
23
24
|
# File 'lib/gossip/cronies/campfire.rb', line 20
def command_line_description
["-c", "--campfire",
"Control display to Campfire chat room.",
"Defaults to #{is_bff_by_default?}."]
end
|
#hear(scandal, details) ⇒ Object
62
63
64
65
66
67
68
69
|
# File 'lib/gossip/cronies/campfire.rb', line 62
def hear(scandal, details)
connection = Tinder::Campfire.new(@user_choices[:campfire_subdomain])
connection.login(@user_choices[:campfire_login], @user_choices[:campfire_password])
raise StandardError, "Login to Campfire failed." unless connection.logged_in?
room = connection.find_room_by_name(@user_choices[:campfire_room])
room.paste([scandal, details].join("\n"))
connection.logout
end
|
#name ⇒ Object
17
|
# File 'lib/gossip/cronies/campfire.rb', line 17
def name; "campfire"; end
|
#symbol ⇒ Object
18
|
# File 'lib/gossip/cronies/campfire.rb', line 18
def symbol; :campfire; end
|