class Cwbot::Cwbot
Attributes
api_key[RW]
Public Class Methods
new(key)
click to toggle source
# File lib/cwbot.rb, line 9 def initialize(key) if key !~ /[a-z|0-9]+/ raise CwbotException, "invalid api key" return end @api_key = key @api_url = "https://api.chatwork.com/v1" end
Public Instance Methods
get_rooms()
click to toggle source
# File lib/cwbot.rb, line 19 def get_rooms url = @api_url+"/rooms" res = ApiRequest.get_request(url,@api_key) end
post_message(to_room,body)
click to toggle source
# File lib/cwbot.rb, line 24 def post_message(to_room,body) url = @api_url+"/rooms/#{to_room}/messages" res = ApiRequest.post_request(url,body,@api_key) end