# File lib/god/contacts/campfire.rb, line 32 def find_room_id_by_name(room) url = URI.parse("#{base_url}/rooms.json") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true if @options[:ssl] req = Net::HTTP::Get.new(url.path) req.basic_auth(@options[:token], 'X') res = http.request(req) case res when Net::HTTPSuccess rooms = JSON.parse(res.body) room = rooms['rooms'].select { |x| x['name'] == room } rooms.empty? ? nil : room.first['id'] else raise res.error! end end