diff --git a/.gitignore b/.gitignore index 8d6a243f..d17a69aa 100644 --- a/.gitignore +++ b/.gitignore @@ -49,8 +49,11 @@ build-iPhoneSimulator/ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc -# Ignore environemnt variables +# Ignore environment variables .env # Ignore cassette files /specs/cassettes/ + +# Ignore slack token verification +slack_token_verification_test.rb diff --git a/bot-settings.json b/bot-settings.json new file mode 100644 index 00000000..c2fbd421 --- /dev/null +++ b/bot-settings.json @@ -0,0 +1 @@ +{"bot_name":"Slackbot","bot_avatar":"jack_o_lantern"} \ No newline at end of file diff --git a/lib/channel.rb b/lib/channel.rb new file mode 100644 index 00000000..4835f985 --- /dev/null +++ b/lib/channel.rb @@ -0,0 +1,39 @@ +module SlackCLI + class Channel < Recipient + attr_reader :topic, :member_count + + def initialize(slack_id:, name:, topic:, member_count:) + super(slack_id, name) + @topic = topic + @member_count = member_count + end + + def get_message_history + url = "https://slack.com/api/conversations.history" + query = { token: ENV["SLACK_API_TOKEN"] , channel: slack_id, limit: 25} + response = HTTParty.get(url, query: query) + + unless response.code == 200 && response.parsed_response["ok"] + raise SlackAPIError, "Error when getting message history, error: #{response.parsed_response["error"]}" + end + + return response + end + + def self.all + channels = [] + + response = Channel.get("channels.list") + + response["channels"].each do |channel| + slack_id = channel["id"] + name = channel["name"] + topic = channel["topic"]["value"] + member_count = channel["num_members"] + + channels << SlackCLI::Channel.new(slack_id: slack_id, name: name, topic: topic, member_count: member_count) + end + return channels + end + end +end diff --git a/lib/errors.rb b/lib/errors.rb new file mode 100644 index 00000000..34742c7c --- /dev/null +++ b/lib/errors.rb @@ -0,0 +1,4 @@ +module SlackCLI + class SlackAPIError < StandardError + end +end diff --git a/lib/recipient.rb b/lib/recipient.rb new file mode 100644 index 00000000..7dd36edd --- /dev/null +++ b/lib/recipient.rb @@ -0,0 +1,28 @@ +module SlackCLI + + class Recipient + attr_reader :slack_id, :name + + def initialize(slack_id, name) + @slack_id = slack_id + @name = name + end + + def self.get(url) + base_url = "https://slack.com/api/" + url = base_url + url + query = { token: ENV["SLACK_API_TOKEN"] } + response = HTTParty.get(url, query: query) + + unless response.code == 200 && response.parsed_response["ok"] + raise SlackAPIError, "Error: #{response.parsed_response["error"]}" + end + + return response + end + + def self.all + raise NotImplementedError + end + end +end diff --git a/lib/slack.rb b/lib/slack.rb index 960cf2f7..be007098 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,11 +1,171 @@ #!/usr/bin/env ruby +require "dotenv" +require "httparty" +require 'table_print' +require_relative "recipient" +require_relative "user" +require_relative "workspace" +require_relative "channel" +require_relative "errors" -def main - puts "Welcome to the Ada Slack CLI!" +Dotenv.load + +PUMPKIN_SPICE = SlackCLI::Workspace.new() + +MAIN_MENU = ["List Users", "List Channels", "Select User", "Select Channel", "Details", "Send Message", "Get Message History", "Change Bot Settings", "Quit"] + +def print_workplace_stats() + puts PUMPKIN_SPICE.get_workplace_stats() +end - # TODO project +def print_menu() + puts "\nMAIN MENU" + MAIN_MENU.each_with_index do |menu_item, index| + puts "#{index + 1}. #{menu_item}" + end + puts "\n" +end + +def print_users + puts "\n" + tp PUMPKIN_SPICE.users, "name", "real_name", "slack_id" +end + +def print_channels + puts "\n" + tp PUMPKIN_SPICE.channels, "name", {"topic" => {:width => 60}}, "member_count", "slack_id" +end - puts "Thank you for using the Ada Slack CLI" +def select_user + print "Please enter the name or Slack ID of the user you want to select: " + search_term = gets.chomp + + result = PUMPKIN_SPICE.select_user(search_term) + + puts + if result + puts "The user #{result.name} was found and selected." + else + puts "No user was found." + end end -main if __FILE__ == $PROGRAM_NAME \ No newline at end of file +def select_channel + print "Please enter the name or Slack ID of the channel you want to select: " + search_term = gets.chomp + + result = PUMPKIN_SPICE.select_channel(search_term) + + puts + if result + puts "The channel #{result.name} was found and selected." + else + puts "No channel was found." + end +end + +def print_details() + puts + if PUMPKIN_SPICE.selected.class == SlackCLI::User + tp PUMPKIN_SPICE.selected, "name", "real_name", "slack_id" + elsif PUMPKIN_SPICE.selected.class == SlackCLI::Channel + tp PUMPKIN_SPICE.selected, "name", {"topic" => {:width => 60}}, "member_count", "slack_id" + else + puts "There is no recipient selected." + end +end + +def get_message() + puts + if PUMPKIN_SPICE.selected + print "Please enter a message: " + message = gets.chomp + + PUMPKIN_SPICE.send_message(message) + else + puts "You need to select a recipient." + end +end + +def format_message_history(response) + table = [] + + response["messages"].each do |message| + if message["username"] + table.push({name: message["username"], text: message["text"]}) + else + found_user = PUMPKIN_SPICE.find_user(message["user"]) + + modified_message = message["text"].gsub(/^<@\w+>/, "#{found_user.name}") + + table.push({name: found_user.name, text: modified_message}) + end + end + + table.reverse! + + tp table, {:name=>{:width => 45}}, {:text=>{:width => 80}} +end + +def main + puts "Welcome to the Ada Slack CLI!" + puts + # lists number of users and channels + print_workplace_stats() + + again = true + while again + # lists menu options + print_menu() + print "What would you like to do? " + answer = gets.chomp.downcase + + case answer + when "list users", "1", "one" + print_users + + when "list channels", "2", "two" + print_channels + + when "select user", "3", "three" + select_user + + when "select channel", "4", "four" + select_channel + + when "details", "5", "five" + print_details + + when "send message", "6", "six" + get_message + + when "get message history", "7", "seven" + if PUMPKIN_SPICE.selected + response = PUMPKIN_SPICE.selected.get_message_history + puts + format_message_history(response) + else + puts "\nYou need to select a recipient." + end + + when "change bot settings", "8", "eight" + print "Please enter the bot's new name: " + name = gets.chomp + PUMPKIN_SPICE.bot_name = name + puts "The bot's new name is #{name}!" + + print "Please enter the bot's new avatar: " + avatar = gets.chomp + PUMPKIN_SPICE.bot_avatar = avatar + puts "The bot's new avatar is #{avatar}!" + + when "quit", "9", "nine", "exit" + PUMPKIN_SPICE.save_settings + again = false + end + end + puts "\nThank you for using the Ada Slack CLI" + end + + main if __FILE__ == $PROGRAM_NAME + \ No newline at end of file diff --git a/lib/user.rb b/lib/user.rb new file mode 100644 index 00000000..75d5b1e0 --- /dev/null +++ b/lib/user.rb @@ -0,0 +1,53 @@ +module SlackCLI + class User < Recipient + attr_reader :real_name + + def initialize(slack_id:, name:, real_name:) + super(slack_id, name) + @real_name = real_name + end + + def get_message_history + im_url = "https://slack.com/api/im.list" + im_query = { token: ENV["SLACK_API_TOKEN"]} + im_response = HTTParty.get(im_url, query: im_query) + + unless im_response.code == 200 && im_response.parsed_response["ok"] + raise SlackAPIError, "Error when getting im list, error: #{im_response.parsed_response["error"]}" + end + + ims = im_response["ims"] + + direct_channel = ims.find do |im| + im["user"] == slack_id + end + + direct_channel_id = direct_channel["id"] + + url = "https://slack.com/api/conversations.history" + query = { token: ENV["SLACK_API_TOKEN"] , channel: direct_channel_id} + response = HTTParty.get(url, query: query) + + unless response.code == 200 && response.parsed_response["ok"] + raise SlackAPIError, "Error when getting conversations history, error: #{response.parsed_response["error"]}" + end + + return response + end + + def self.all + users = [] + + response = User.get("users.list") + + response["members"].each do |member| + slack_id = member["id"] + name = member["name"] + real_name = member["real_name"] + + users << SlackCLI:: User.new(slack_id: slack_id, name: name, real_name: real_name) + end + return users + end + end +end diff --git a/lib/workspace.rb b/lib/workspace.rb new file mode 100644 index 00000000..b47cdf58 --- /dev/null +++ b/lib/workspace.rb @@ -0,0 +1,82 @@ +module SlackCLI + class Workspace + attr_reader :users, :channels + attr_accessor :bot_name, :bot_avatar, :selected + + def initialize() + @users = SlackCLI::User.all + @channels = SlackCLI::Channel.all + @selected = nil + + settings = File.read("bot-settings.json") + settings_hash = JSON.parse(settings) + @bot_name = settings_hash["bot_name"] + @bot_avatar = settings_hash["bot_avatar"] + end + + def get_workplace_stats() + user_count = users.length + channel_count = channels.length + return "This workplace has #{user_count} users and #{channel_count} channels." + end + + def find_user(search_term) + found = users.find do |user| + user.name == search_term.downcase || user.slack_id == search_term.upcase + end + + return found + end + + def find_channel(search_term) + found = channels.find do |channel| + channel.name == search_term.downcase || channel.slack_id == search_term.upcase + end + + return found + end + + def select_user(search_term) + @selected = find_user(search_term) + return selected + end + + def select_channel(search_term) + @selected = find_channel(search_term) + return selected + end + + def send_message(message_text) + if selected.nil? + return nil + end + + bot_avatar_symbol = ":#{bot_avatar}:" + + response = HTTParty.post( + "https://slack.com/api/chat.postMessage", + body: { token: ENV["SLACK_API_TOKEN"], + text: message_text, + channel: selected.slack_id, + as_user: false, + username: bot_name, + icon_emoji: bot_avatar_symbol }, + headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } + ) + + unless response.code == 200 && response.parsed_response["ok"] + raise SlackAPIError, "Error when posting message, error: #{response.parsed_response["error"]}" + end + + return response + end + + def save_settings + settings_hash = {bot_name: bot_name, bot_avatar: bot_avatar} + + File.open("bot-settings.json", "w") do |f| + f.write(settings_hash.to_json) + end + end + end +end diff --git a/slack_token_test.rb b/slack_token_test.rb new file mode 100644 index 00000000..d3de4294 --- /dev/null +++ b/slack_token_test.rb @@ -0,0 +1,14 @@ +require "dotenv" +require "httparty" + +Dotenv.load + +url = "https://slack.com/api/channels.list" + +query = { token: ENV["SLACK_API_TOKEN"] } + +response = HTTParty.get(url, query: query) + +response["channels"].each do |channel| + puts channel["name"] +end diff --git a/test/cassettes/bad_channels.yml b/test/cassettes/bad_channels.yml new file mode 100644 index 00000000..974215ac --- /dev/null +++ b/test/cassettes/bad_channels.yml @@ -0,0 +1,155 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/channels.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '713' + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 23:48:34 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - b1952085-4443-4282-90d9-8107eac863c4 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-fc14 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 112d82578d402a38d8d02e8b857617e1.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - eGkdASLf9QDsb1sBDEhNuuspzA6l7wEezGY8Ottsni3lxCJyDsWz9g== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUR2JTNX","name":"random","is_channel":true,"created":1568071183,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN5R273J8","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UN5R273J8","last_set":1568071183},"purpose":{"value":"A + place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber + you''d prefer to keep out of more focused work-related channels.","creator":"UN5R273J8","last_set":1568071183},"previous_names":[],"num_members":7},{"id":"CN6A88SJZ","name":"turkey","is_channel":true,"created":1568073346,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMUR43REX","name_normalized":"turkey","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMUR43REX","UN5R273J8","UN69C37BJ"],"topic":{"value":"To + collect images of turkeys and information about turkeys","creator":"UN5R273J8","last_set":1568232705},"purpose":{"value":"to + collect images of turkeys and information about turkeys","creator":"UMUR43REX","last_set":1568073347},"previous_names":[],"num_members":3},{"id":"CN85BSBQF","name":"slack-cli","is_channel":true,"created":1568071183,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN5R273J8","name_normalized":"slack-cli","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Posts + about the Slack CLI project","creator":"UN5R273J8","last_set":1568232665},"purpose":{"value":"Posts + about the Slack CLI project","creator":"UN5R273J8","last_set":1568232660},"previous_names":[],"num_members":7},{"id":"CN8FME7AS","name":"general","is_channel":true,"created":1568071183,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UN5R273J8","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UN5R273J8","last_set":1568071183},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UN5R273J8","last_set":1568071183},"previous_names":[],"num_members":7}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Thu, 12 Sep 2019 23:48:34 GMT +- request: + method: get + uri: https://slack.com/api/conversations.history?channel=CMUR2JTNX&limit=25&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 503 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '781' + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 23:48:34 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 5552f2de-d9b1-4be4-aaca-3c69ca8eda0d + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:history,groups:history,mpim:history,im:history,read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-fdpw + X-Cache: + - Miss from cloudfront + Via: + - 1.1 3cd7af07832481c336aa1c93c9b4a6fe.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - KC6uM5IxAglqqqpk51I4TxIlF6ax8TQSWz_q-MOaYVIjtcUP0EyyAA== + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"service_unavailable"}' + http_version: + recorded_at: Thu, 12 Sep 2019 23:48:34 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/bad_conversations_list.yml b/test/cassettes/bad_conversations_list.yml new file mode 100644 index 00000000..e0ba3350 --- /dev/null +++ b/test/cassettes/bad_conversations_list.yml @@ -0,0 +1,237 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '1610' + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 23:48:34 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - f9cea927-fb40-44bc-9209-80179136079d + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-64vz + X-Cache: + - Miss from cloudfront + Via: + - 1.1 d6a002c70d55f415107618b0750d493d.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - IWbIbqKx6a1Voppa3ftwImSc8RgTaJ1B5mjUhdTKfuU6wecp3fMsbg== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN69AJ2SU","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":null,"tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"UMTG0S5D0","team_id":"TN69AJ2SU","name":"samantha.collares","deleted":false,"color":"674b1b","real_name":"Samantha + Collares","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Samantha + Collares","real_name_normalized":"Samantha Collares","display_name":"Samantha + Collares","display_name_normalized":"Samantha Collares","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"ge444d412eed","image_24":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071698,"has_2fa":false},{"id":"UMUR43REX","team_id":"TN69AJ2SU","name":"sabrina","deleted":false,"color":"e7392d","real_name":"Sabrina + Lowney","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Sabrina + Lowney","real_name_normalized":"Sabrina Lowney","display_name":"Sabrina Lowney","display_name_normalized":"Sabrina + Lowney","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3826fd588f7","image_24":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071592,"has_2fa":false},{"id":"UMZSUVBED","team_id":"TN69AJ2SU","name":"mariya.burrows","deleted":false,"color":"e96699","real_name":"Mariya + Burrows","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Mariya + Burrows","real_name_normalized":"Mariya Burrows","display_name":"Mariya Burrows","display_name_normalized":"Mariya + Burrows","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g742995f6521","image_24":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071452,"has_2fa":false},{"id":"UN5R273J8","team_id":"TN69AJ2SU","name":"dtingg","deleted":false,"color":"9f69e7","real_name":"Dianna + Tingg","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Dianna + Tingg","real_name_normalized":"Dianna Tingg","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g18e16502755","first_name":"Dianna","last_name":"Tingg","image_24":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071477,"has_2fa":false},{"id":"UN5R3N6P6","team_id":"TN69AJ2SU","name":"juliakingreyworks","deleted":false,"color":"3c989f","real_name":"Julia + K","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Julia + K","real_name_normalized":"Julia K","display_name":"Julia K","display_name_normalized":"Julia + K","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g8ae03401380","image_24":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071668,"has_2fa":false},{"id":"UN5R3NYUU","team_id":"TN69AJ2SU","name":"morganlschuler","deleted":false,"color":"e0a729","real_name":"Morgan + Schuler","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Morgan + Schuler","real_name_normalized":"Morgan Schuler","display_name":"Morgan Schuler","display_name_normalized":"Morgan + Schuler","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gc6d02aa49cf","image_24":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071410,"has_2fa":false},{"id":"UN69C37BJ","team_id":"TN69AJ2SU","name":"tiffanycee123","deleted":false,"color":"4bbe2e","real_name":"Tiffany + Chio","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Tiffany + Chio","real_name_normalized":"Tiffany Chio","display_name":"Tiffany Chio","display_name_normalized":"Tiffany + Chio","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"ge49485fcc1e","image_24":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071504,"has_2fa":false}],"cache_ts":1568332114,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Thu, 12 Sep 2019 23:48:34 GMT +- request: + method: get + uri: https://slack.com/api/im.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '310' + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 23:48:35 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 7866861f-770c-4fba-8f1f-c026c591a1d0 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - im:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-5nvv + X-Cache: + - Miss from cloudfront + Via: + - 1.1 4c7c693b007dfce603c83f138e31bccb.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - wvgd7IIEzp8DQgQqAxYKKPCuXpnLlHr7ztz1IUwu0N3fEMeVQg_w7g== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"ims":[{"id":"DN85DC8MD","created":1568071309,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UMZSUVBED","is_user_deleted":false,"priority":0},{"id":"DN85DBRC7","created":1568071307,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UN5R3N6P6","is_user_deleted":false,"priority":0},{"id":"DN69K4V61","created":1568071310,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UN5R3NYUU","is_user_deleted":false,"priority":0},{"id":"DN69C3L3S","created":1568071307,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UMUR43REX","is_user_deleted":false,"priority":0},{"id":"DN69AJ9K2","created":1568071183,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UN5R273J8","is_user_deleted":false,"priority":0},{"id":"DN5R3NKDJ","created":1568071308,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UMTG0S5D0","is_user_deleted":false,"priority":0},{"id":"DMUR2JRB5","created":1568071183,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"USLACKBOT","is_user_deleted":false,"priority":0},{"id":"DMTG0RLMQ","created":1568071306,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UN69C37BJ","is_user_deleted":false,"priority":0}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Thu, 12 Sep 2019 23:48:35 GMT +- request: + method: get + uri: https://slack.com/api/conversations.history?channel=DMUR2JRB5&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 503 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '543' + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 23:48:35 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - e9ff0ac4-3000-4349-ad4c-9d60f4ffb0a6 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:history,groups:history,mpim:history,im:history,read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-f5e7 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 57a21088b36c69a83578b5a5579df58f.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - aj9dNHnRaf9QtZWXNuy7_-EHyyER161rmSPtJqwc-SxQNp1ZvHMbbQ== + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"service_unavailable"}' + http_version: + recorded_at: Thu, 12 Sep 2019 23:48:35 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/bad_ims_list.yml b/test/cassettes/bad_ims_list.yml new file mode 100644 index 00000000..7171fdf1 --- /dev/null +++ b/test/cassettes/bad_ims_list.yml @@ -0,0 +1,251 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '1609' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 18:26:54 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - f938e3ce-af40-4b4c-b83b-4dc039cd94f5 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-gt7p + X-Cache: + - Miss from cloudfront + Via: + - 1.1 bb14b7a4f45e3e0b1ae5065c59f7826f.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - HIO51-C1 + X-Amz-Cf-Id: + - tYdlN8uXjP0humJl88rW-hug3fMSoX7eyDJbAjk_oQ16s-TItO1D7w== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN69AJ2SU","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":null,"tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"UMTG0S5D0","team_id":"TN69AJ2SU","name":"samantha.collares","deleted":false,"color":"674b1b","real_name":"Samantha + Collares","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Samantha + Collares","real_name_normalized":"Samantha Collares","display_name":"Samantha + Collares","display_name_normalized":"Samantha Collares","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"ge444d412eed","image_24":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071698,"has_2fa":false},{"id":"UMUR43REX","team_id":"TN69AJ2SU","name":"sabrina","deleted":false,"color":"e7392d","real_name":"Sabrina + Lowney","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Sabrina + Lowney","real_name_normalized":"Sabrina Lowney","display_name":"Sabrina Lowney","display_name_normalized":"Sabrina + Lowney","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3826fd588f7","image_24":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071592,"has_2fa":false},{"id":"UMZSUVBED","team_id":"TN69AJ2SU","name":"mariya.burrows","deleted":false,"color":"e96699","real_name":"Mariya + Burrows","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Mariya + Burrows","real_name_normalized":"Mariya Burrows","display_name":"Mariya Burrows","display_name_normalized":"Mariya + Burrows","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g742995f6521","image_24":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071452,"has_2fa":false},{"id":"UN5R273J8","team_id":"TN69AJ2SU","name":"dtingg","deleted":false,"color":"9f69e7","real_name":"Dianna + Tingg","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Dianna + Tingg","real_name_normalized":"Dianna Tingg","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g18e16502755","first_name":"Dianna","last_name":"Tingg","image_24":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071477,"has_2fa":false},{"id":"UN5R3N6P6","team_id":"TN69AJ2SU","name":"juliakingreyworks","deleted":false,"color":"3c989f","real_name":"Julia + K","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Julia + K","real_name_normalized":"Julia K","display_name":"Julia K","display_name_normalized":"Julia + K","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g8ae03401380","image_24":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071668,"has_2fa":false},{"id":"UN5R3NYUU","team_id":"TN69AJ2SU","name":"morganlschuler","deleted":false,"color":"e0a729","real_name":"Morgan + Schuler","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Morgan + Schuler","real_name_normalized":"Morgan Schuler","display_name":"Morgan Schuler","display_name_normalized":"Morgan + Schuler","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gc6d02aa49cf","image_24":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071410,"has_2fa":false},{"id":"UN69C37BJ","team_id":"TN69AJ2SU","name":"tiffanycee123","deleted":false,"color":"4bbe2e","real_name":"Tiffany + Chio","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Tiffany + Chio","real_name_normalized":"Tiffany Chio","display_name":"Tiffany Chio","display_name_normalized":"Tiffany + Chio","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"ge49485fcc1e","image_24":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071504,"has_2fa":false}],"cache_ts":1568399214,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 18:26:54 GMT +- request: + method: get + uri: https://slack.com/api/im.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 503 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '310' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 18:26:54 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - dc4ccde6-c20e-4e90-8bab-1ea3c5742a36 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - im:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-d7ix + X-Cache: + - Miss from cloudfront + Via: + - 1.1 4db3f26ee4fd9a14a343fada3315105f.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - HIO51-C1 + X-Amz-Cf-Id: + - Kqvpo3Q8Cu6giTkTbLpbROBxYRTYDEsClHA2Q_kKQ1rt77KKgmk7XA== + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"service_unavailable"}' + http_version: + recorded_at: Fri, 13 Sep 2019 18:26:54 GMT +- request: + method: get + uri: https://slack.com/api/conversations.history?channel=DMUR2JRB5&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '543' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 18:26:54 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 3a8f1baa-3d9b-4fc2-b0aa-4db7477d0ead + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:history,groups:history,mpim:history,im:history,read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-g1op + X-Cache: + - Miss from cloudfront + Via: + - 1.1 e109fb33da247873a89335ea6b680b25.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - HIO51-C1 + X-Amz-Cf-Id: + - 8B_-WVenDq1gRaO4IW4YuAbFZEhlHI0M7xENJqCZAvb0VPCaU6gRQw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"messages":[{"type":"message","subtype":"bot_message","text":"default + settings!","ts":"1568242282.001400","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"who + am I???","ts":"1568242155.001300","username":"pumpkin","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"who + am i?","ts":"1568242101.001200","username":"dino","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"this + better be a jack o lantern","ts":"1568241614.001100","user":"USLACKBOT","username":"slackbot","icons":{"emoji":"::jack_o_lantern::"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"is + this a trex?","ts":"1568240139.001000","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"test + default sender","ts":"1568240116.000900","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"message + to dianna","ts":"1568238074.000800","username":"Leaves - Dianna - API Project","bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233791.000700","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233781.000600","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233754.000500","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233721.000400","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233719.000300","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test","ts":"1568233699.000200","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test","ts":"1568233638.000100","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"}],"has_more":false,"pin_count":0}' + http_version: + recorded_at: Fri, 13 Sep 2019 18:26:54 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/bad_recipient.yml b/test/cassettes/bad_recipient.yml new file mode 100644 index 00000000..bd9abecf --- /dev/null +++ b/test/cassettes/bad_recipient.yml @@ -0,0 +1,64 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/test?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '70' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 16:32:32 GMT + Server: + - Apache + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - bcc5cf7f-7c68-459d-b97b-669396d22acd + X-Xss-Protection: + - '0' + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-ntnv + X-Cache: + - Miss from cloudfront + Via: + - 1.1 3a5c7b53ec8bee631ff6043996ffc1ce.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - HIO51-C1 + X-Amz-Cf-Id: + - 9HEpn18ePdkJ2a89YrJrOSh7fr-imtSlxKaO25gDKBjvBaWYbQAccQ== + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"unknown_method","req_method":"test"}' + http_version: + recorded_at: Fri, 13 Sep 2019 16:32:33 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/bad_send_message.yml b/test/cassettes/bad_send_message.yml new file mode 100644 index 00000000..2a1b116e --- /dev/null +++ b/test/cassettes/bad_send_message.yml @@ -0,0 +1,137 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: token=&text=I%27m%20a%20message%20to%20a%20user&channel=UMUR43REX&as_user=false&username=Slackbot&icon_emoji=%3Ajack_o_lantern%3A + headers: + Content-Type: + - application/x-www-form-urlencoded + response: + status: + code: 503 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 23:48:35 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 52c79a75-1126-4b94-a6ff-d419366bbfd4 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write:bot + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-ntnv + X-Cache: + - Miss from cloudfront + Via: + - 1.1 0732be5515ffeda639cfe5f22fb04df6.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - Q-ATPzeXLtOAXQdFiG3AajOoYqczwZz-PMpxFXm2BrGbhAOFpibpBA== + body: + encoding: UTF-8 + string: '{"ok":false,"error":"service_unavailable"}' + http_version: + recorded_at: Thu, 12 Sep 2019 23:48:35 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: token=&text=I%27m%20a%20message%20to%20a%20channel&channel=CMUR2JTNX&as_user=false&username=Slackbot&icon_emoji=%3Ajack_o_lantern%3A + headers: + Content-Type: + - application/x-www-form-urlencoded + response: + status: + code: 503 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 23:48:35 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - a920e6c2-c482-41d6-bd2a-8b1516207b6e + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write:bot + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-dzl1 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 61bc723adb3b1884ed759711e84e13a9.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - tuGIxxFEq5M7wqi47ahVYbt8R00PnsHbOcVYNYr5ve27YRxC5Vw4SA== + body: + encoding: UTF-8 + string: '{"ok":false,"error":"service_unavailable"}' + http_version: + recorded_at: Thu, 12 Sep 2019 23:48:35 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/channels.yml b/test/cassettes/channels.yml new file mode 100644 index 00000000..6a6724d1 --- /dev/null +++ b/test/cassettes/channels.yml @@ -0,0 +1,181 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/channels.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '713' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:57 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 191cdc08-064f-455d-9593-73b0a6ce1321 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-u916 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 60b744e5b364d04abea9fa6686121242.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - tsrsS9GUCxRenGaN98DGXDFTKppHwwTMHiY4oFTsWoMk5VEEmbdOkg== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUR2JTNX","name":"random","is_channel":true,"created":1568071183,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN5R273J8","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UN5R273J8","last_set":1568071183},"purpose":{"value":"A + place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber + you''d prefer to keep out of more focused work-related channels.","creator":"UN5R273J8","last_set":1568071183},"previous_names":[],"num_members":7},{"id":"CN6A88SJZ","name":"turkey","is_channel":true,"created":1568073346,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMUR43REX","name_normalized":"turkey","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMUR43REX","UN5R273J8","UN69C37BJ"],"topic":{"value":"To + collect images of turkeys and information about turkeys","creator":"UN5R273J8","last_set":1568232705},"purpose":{"value":"to + collect images of turkeys and information about turkeys","creator":"UMUR43REX","last_set":1568073347},"previous_names":[],"num_members":3},{"id":"CN85BSBQF","name":"slack-cli","is_channel":true,"created":1568071183,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN5R273J8","name_normalized":"slack-cli","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Posts + about the Slack CLI project","creator":"UN5R273J8","last_set":1568232665},"purpose":{"value":"Posts + about the Slack CLI project","creator":"UN5R273J8","last_set":1568232660},"previous_names":[],"num_members":7},{"id":"CN8FME7AS","name":"general","is_channel":true,"created":1568071183,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UN5R273J8","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UN5R273J8","last_set":1568071183},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UN5R273J8","last_set":1568071183},"previous_names":[],"num_members":7}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:57 GMT +- request: + method: get + uri: https://slack.com/api/conversations.history?channel=CMUR2JTNX&limit=25&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '828' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:57 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - fa212d47-ba35-48ef-a51c-f57c6535ac42 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:history,groups:history,mpim:history,im:history,read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-idv8 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 3a6260aec53985f2e6eb8a637c47918d.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - VDRHu-j0uHUFUUO-JWPhRpxYS-f3vA8UnNwXr3WDCK3uxz4JgmA08A== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"messages":[{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568413349.000400","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"asdfghjkl","ts":"1568412968.000300","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"hi!","ts":"1568412761.000200","username":"Leaves + - Mariya - API Project","bot_id":"BMW5VR8TV"},{"type":"message","subtype":"bot_message","text":"hi!","ts":"1568412621.000100","username":"Leaves + - Mariya - API Project","bot_id":"BMW5VR8TV"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568331869.000800","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568330837.000700","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568330348.000500","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568321235.000400","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568321083.000200","username":"T-Rex","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568321009.000100","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568242399.002300","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568242326.002200","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568241517.002100","user":"USLACKBOT","username":"slackbot","icons":{"emoji":"::jack_o_lantern::"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568241481.002000","username":"Leaves - Dianna + - API Project","icons":{"emoji":"::"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568241458.001900","username":"dinobot","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"will + this go through?","ts":"1568240526.001800","username":"Sabrina","icons":{"emoji":"nil"},"bot_id":"BN85KS74P"},{"type":"message","subtype":"bot_message","text":"will + this go through?","ts":"1568240515.001700","username":"Sabrina","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BN85KS74P"},{"type":"message","subtype":"bot_message","text":"will + this go through?","ts":"1568240503.001600","username":"Sabrina","icons":{"emoji":":leprechaun:"},"bot_id":"BN85KS74P"},{"type":"message","subtype":"bot_message","text":":poultry_leg: + :t-rex:","ts":"1568240426.001500","username":"Sabrina","icons":{"emoji":":leprechaun:"},"bot_id":"BN85KS74P"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568239748.001400","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568239337.001300","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568239206.001200","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"client_msg_id":"c05f1f48-7e5a-454c-a579-c172e69c0358","type":"message","text":"spacer + test","user":"UMUR43REX","ts":"1568239188.001100","team":"TN69AJ2SU"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568239173.000600","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568239026.000500","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":pumpkin:"},"bot_id":"BMW7Z23K5"}],"has_more":true,"pin_count":0,"response_metadata":{"next_cursor":"bmV4dF90czoxNTY4MjM3ODQ5MDAwNDAw"}}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:57 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/send_message.yml b/test/cassettes/send_message.yml new file mode 100644 index 00000000..36b5069b --- /dev/null +++ b/test/cassettes/send_message.yml @@ -0,0 +1,139 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: token=&text=I%27m%20a%20message%20to%20a%20user&channel=UMUR43REX&as_user=false&username=Slackbot&icon_emoji=%3Ajack_o_lantern%3A + headers: + Content-Type: + - application/x-www-form-urlencoded + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:57 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 8fef71e1-b7c1-40c2-b03f-cf5e5890ba9e + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write:bot + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-qt4f + X-Cache: + - Miss from cloudfront + Via: + - 1.1 82ee5868f58a60e97a683c1fda270de3.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - DOTq4WLZ_CglK-qwzz7eP0tORHSY1ZTT_plvipggoDVOd2620OJspw== + body: + encoding: UTF-8 + string: '{"ok":true,"channel":"DN85DBHQX","ts":"1568413437.000200","message":{"type":"message","subtype":"bot_message","text":"I''m + a message to a user","ts":"1568413437.000200","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"}}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:57 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: token=&text=I%27m%20a%20message%20to%20a%20channel&channel=CMUR2JTNX&as_user=false&username=Slackbot&icon_emoji=%3Ajack_o_lantern%3A + headers: + Content-Type: + - application/x-www-form-urlencoded + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:57 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - a8432275-1a53-497c-9e71-df98de6a7130 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - chat:write:bot + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-4tyc + X-Cache: + - Miss from cloudfront + Via: + - 1.1 ec2a2c75c16156e4d43504606c118b91.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - Saz2Hjw9_GBZj4i6iE1mq-N9lqZrRpKi7OqbN6x_J4QxK7L-_Q8Aaw== + body: + encoding: UTF-8 + string: '{"ok":true,"channel":"CMUR2JTNX","ts":"1568413437.000500","message":{"type":"message","subtype":"bot_message","text":"I''m + a message to a channel","ts":"1568413437.000500","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"}}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:57 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/users.yml b/test/cassettes/users.yml new file mode 100644 index 00000000..38973afe --- /dev/null +++ b/test/cassettes/users.yml @@ -0,0 +1,254 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '1610' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:55 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - f04d4b0e-0c34-40a8-a40d-0fa150454838 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-f8tg + X-Cache: + - Miss from cloudfront + Via: + - 1.1 adc2002956acc4d61bfbf3b973fdf247.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - Ai3vCfuTc0vzJhvhhfkFoPYxVpyxP5o_SW9OXOSINRq2an2RlNa3Ag== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN69AJ2SU","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":null,"tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"UMTG0S5D0","team_id":"TN69AJ2SU","name":"samantha.collares","deleted":false,"color":"674b1b","real_name":"Samantha + Collares","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Samantha + Collares","real_name_normalized":"Samantha Collares","display_name":"Samantha + Collares","display_name_normalized":"Samantha Collares","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"ge444d412eed","image_24":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071698,"has_2fa":false},{"id":"UMUR43REX","team_id":"TN69AJ2SU","name":"sabrina","deleted":false,"color":"e7392d","real_name":"Sabrina + Lowney","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Sabrina + Lowney","real_name_normalized":"Sabrina Lowney","display_name":"Sabrina Lowney","display_name_normalized":"Sabrina + Lowney","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3826fd588f7","image_24":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071592,"has_2fa":false},{"id":"UMZSUVBED","team_id":"TN69AJ2SU","name":"mariya.burrows","deleted":false,"color":"e96699","real_name":"Mariya + Burrows","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Mariya + Burrows","real_name_normalized":"Mariya Burrows","display_name":"Mariya Burrows","display_name_normalized":"Mariya + Burrows","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g742995f6521","image_24":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071452,"has_2fa":false},{"id":"UN5R273J8","team_id":"TN69AJ2SU","name":"dtingg","deleted":false,"color":"9f69e7","real_name":"Dianna + Tingg","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Dianna + Tingg","real_name_normalized":"Dianna Tingg","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g18e16502755","first_name":"Dianna","last_name":"Tingg","image_24":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071477,"has_2fa":false},{"id":"UN5R3N6P6","team_id":"TN69AJ2SU","name":"juliakingreyworks","deleted":false,"color":"3c989f","real_name":"Julia + K","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Julia + K","real_name_normalized":"Julia K","display_name":"Julia K","display_name_normalized":"Julia + K","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g8ae03401380","image_24":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071668,"has_2fa":false},{"id":"UN5R3NYUU","team_id":"TN69AJ2SU","name":"morganlschuler","deleted":false,"color":"e0a729","real_name":"Morgan + Schuler","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Morgan + Schuler","real_name_normalized":"Morgan Schuler","display_name":"Morgan Schuler","display_name_normalized":"Morgan + Schuler","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gc6d02aa49cf","image_24":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071410,"has_2fa":false},{"id":"UN69C37BJ","team_id":"TN69AJ2SU","name":"tiffanycee123","deleted":false,"color":"4bbe2e","real_name":"Tiffany + Chio","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Tiffany + Chio","real_name_normalized":"Tiffany Chio","display_name":"Tiffany Chio","display_name_normalized":"Tiffany + Chio","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"ge49485fcc1e","image_24":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071504,"has_2fa":false}],"cache_ts":1568413435,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:56 GMT +- request: + method: get + uri: https://slack.com/api/im.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '310' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:57 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 839d9617-965a-4488-8778-3242ae57aea8 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - im:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-qija + X-Cache: + - Miss from cloudfront + Via: + - 1.1 34f8ef0e4c880df0650a814412a26ea6.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - 6BaHPOhzdm44fON1lT3U1rvb-2juMc2KrOYC62JeC8k0MSGnPvhzHw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"ims":[{"id":"DN85DC8MD","created":1568071309,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UMZSUVBED","is_user_deleted":false,"priority":0},{"id":"DN85DBRC7","created":1568071307,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UN5R3N6P6","is_user_deleted":false,"priority":0},{"id":"DN69K4V61","created":1568071310,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UN5R3NYUU","is_user_deleted":false,"priority":0},{"id":"DN69C3L3S","created":1568071307,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UMUR43REX","is_user_deleted":false,"priority":0},{"id":"DN69AJ9K2","created":1568071183,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UN5R273J8","is_user_deleted":false,"priority":0},{"id":"DN5R3NKDJ","created":1568071308,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UMTG0S5D0","is_user_deleted":false,"priority":0},{"id":"DMUR2JRB5","created":1568071183,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"USLACKBOT","is_user_deleted":false,"priority":0},{"id":"DMTG0RLMQ","created":1568071306,"is_archived":false,"is_im":true,"is_org_shared":false,"user":"UN69C37BJ","is_user_deleted":false,"priority":0}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:57 GMT +- request: + method: get + uri: https://slack.com/api/conversations.history?channel=DMUR2JRB5&token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '606' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:57 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 30c4e979-4dd2-4f18-8646-4f57fd748dcc + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:history,groups:history,mpim:history,im:history,read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-sk4y + X-Cache: + - Miss from cloudfront + Via: + - 1.1 d042f60a962591f741406f28a8170c5a.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - bTE_lIq9i3ItQXKmBnN-VxEUhxB0yUQ957h7nvo-IqRfxil2OvTJJw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"messages":[{"type":"message","subtype":"bot_message","text":"trex + grrr","ts":"1568409173.000400","username":"trex","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"test + to dianna","ts":"1568409095.000200","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"From + Diannabot to Dianna","ts":"1568408046.000100","username":"Diannabot","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"default + settings!","ts":"1568242282.001400","username":"Slackbot","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"who + am I???","ts":"1568242155.001300","username":"pumpkin","icons":{"emoji":":jack_o_lantern:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f383.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"who + am i?","ts":"1568242101.001200","username":"dino","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"this + better be a jack o lantern","ts":"1568241614.001100","user":"USLACKBOT","username":"slackbot","icons":{"emoji":"::jack_o_lantern::"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"is + this a trex?","ts":"1568240139.001000","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"test + default sender","ts":"1568240116.000900","user":"USLACKBOT","username":"slackbot","icons":{"emoji":":t-rex:","image_64":"https:\/\/a.slack-edge.com\/80588\/img\/emoji_2017_12_06\/apple\/1f996.png"},"bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"message + to dianna","ts":"1568238074.000800","username":"Leaves - Dianna - API Project","bot_id":"BMW7Z23K5"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233791.000700","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233781.000600","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233754.000500","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233721.000400","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test-false","ts":"1568233719.000300","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test","ts":"1568233699.000200","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"},{"type":"message","subtype":"bot_message","text":"Test","ts":"1568233638.000100","username":"Leaves + - Tiffany - API Project","bot_id":"BMURAQX7D"}],"has_more":false,"pin_count":0}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:57 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/workspace.yml b/test/cassettes/workspace.yml new file mode 100644 index 00000000..3c75776e --- /dev/null +++ b/test/cassettes/workspace.yml @@ -0,0 +1,176 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '1610' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:56 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - fc541889-f4f3-4047-8116-81c7d5ba33d3 + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-f2n6 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 deaaf0548506de20925615eb51a7ea7f.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - HnmvdoBV71sp4j892nVutTAh_48A8NXzyXepgN2MI8OEvPK61eHADw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN69AJ2SU","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":null,"tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Slackbot","real_name_normalized":"Slackbot","display_name":"Slackbot","display_name_normalized":"Slackbot","fields":null,"status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"sv41d8cd98f0","always_active":true,"first_name":"slackbot","last_name":"","image_24":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_24.png","image_32":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_32.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_72.png","image_192":"https:\/\/a.slack-edge.com\/80588\/marketing\/img\/avatars\/slackbot\/avatar-slackbot.png","image_512":"https:\/\/a.slack-edge.com\/80588\/img\/slackbot_512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":0},{"id":"UMTG0S5D0","team_id":"TN69AJ2SU","name":"samantha.collares","deleted":false,"color":"674b1b","real_name":"Samantha + Collares","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Samantha + Collares","real_name_normalized":"Samantha Collares","display_name":"Samantha + Collares","display_name_normalized":"Samantha Collares","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"ge444d412eed","image_24":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/e444d412eed1a77c04bbf0fb2c43d8b8.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0008-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071698,"has_2fa":false},{"id":"UMUR43REX","team_id":"TN69AJ2SU","name":"sabrina","deleted":false,"color":"e7392d","real_name":"Sabrina + Lowney","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Sabrina + Lowney","real_name_normalized":"Sabrina Lowney","display_name":"Sabrina Lowney","display_name_normalized":"Sabrina + Lowney","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3826fd588f7","image_24":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3826fd588f7f72df044c1512a719f733.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0013-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071592,"has_2fa":false},{"id":"UMZSUVBED","team_id":"TN69AJ2SU","name":"mariya.burrows","deleted":false,"color":"e96699","real_name":"Mariya + Burrows","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Mariya + Burrows","real_name_normalized":"Mariya Burrows","display_name":"Mariya Burrows","display_name_normalized":"Mariya + Burrows","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g742995f6521","image_24":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/742995f6521248254aa31fc269323b35.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0001-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071452,"has_2fa":false},{"id":"UN5R273J8","team_id":"TN69AJ2SU","name":"dtingg","deleted":false,"color":"9f69e7","real_name":"Dianna + Tingg","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Dianna + Tingg","real_name_normalized":"Dianna Tingg","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g18e16502755","first_name":"Dianna","last_name":"Tingg","image_24":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/18e16502755f0b33603d2f0476f51f79.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0024-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071477,"has_2fa":false},{"id":"UN5R3N6P6","team_id":"TN69AJ2SU","name":"juliakingreyworks","deleted":false,"color":"3c989f","real_name":"Julia + K","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Julia + K","real_name_normalized":"Julia K","display_name":"Julia K","display_name_normalized":"Julia + K","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g8ae03401380","image_24":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/8ae034013803a39e79167e24e08629fc.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071668,"has_2fa":false},{"id":"UN5R3NYUU","team_id":"TN69AJ2SU","name":"morganlschuler","deleted":false,"color":"e0a729","real_name":"Morgan + Schuler","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Morgan + Schuler","real_name_normalized":"Morgan Schuler","display_name":"Morgan Schuler","display_name_normalized":"Morgan + Schuler","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gc6d02aa49cf","image_24":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/c6d02aa49cf9d47142e8cfcb7e897b98.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071410,"has_2fa":false},{"id":"UN69C37BJ","team_id":"TN69AJ2SU","name":"tiffanycee123","deleted":false,"color":"4bbe2e","real_name":"Tiffany + Chio","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Tiffany + Chio","real_name_normalized":"Tiffany Chio","display_name":"Tiffany Chio","display_name_normalized":"Tiffany + Chio","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"ge49485fcc1e","image_24":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/e49485fcc1e6f86f199952b8108015e0.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0015-512.png","status_text_canonical":"","team":"TN69AJ2SU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"is_app_user":false,"updated":1568071504,"has_2fa":false}],"cache_ts":1568413436,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:56 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '713' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 22:23:56 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 7ceb6a14-d571-451a-8ea5-da83778b9d4b + X-Oauth-Scopes: + - identify,channels:history,im:history,channels:read,im:read,search:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-odun + X-Cache: + - Miss from cloudfront + Via: + - 1.1 82ee5868f58a60e97a683c1fda270de3.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - cwAt_HqJwWFQSomJemhkI2eZhO33u_VJLaF8D5arb4BPGgYwpNXySA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUR2JTNX","name":"random","is_channel":true,"created":1568071183,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN5R273J8","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UN5R273J8","last_set":1568071183},"purpose":{"value":"A + place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber + you''d prefer to keep out of more focused work-related channels.","creator":"UN5R273J8","last_set":1568071183},"previous_names":[],"num_members":7},{"id":"CN6A88SJZ","name":"turkey","is_channel":true,"created":1568073346,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMUR43REX","name_normalized":"turkey","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMUR43REX","UN5R273J8","UN69C37BJ"],"topic":{"value":"To + collect images of turkeys and information about turkeys","creator":"UN5R273J8","last_set":1568232705},"purpose":{"value":"to + collect images of turkeys and information about turkeys","creator":"UMUR43REX","last_set":1568073347},"previous_names":[],"num_members":3},{"id":"CN85BSBQF","name":"slack-cli","is_channel":true,"created":1568071183,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN5R273J8","name_normalized":"slack-cli","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Posts + about the Slack CLI project","creator":"UN5R273J8","last_set":1568232665},"purpose":{"value":"Posts + about the Slack CLI project","creator":"UN5R273J8","last_set":1568232660},"previous_names":[],"num_members":7},{"id":"CN8FME7AS","name":"general","is_channel":true,"created":1568071183,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UN5R273J8","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTG0S5D0","UMUR43REX","UMZSUVBED","UN5R273J8","UN5R3N6P6","UN5R3NYUU","UN69C37BJ"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UN5R273J8","last_set":1568071183},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UN5R273J8","last_set":1568071183},"previous_names":[],"num_members":7}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 22:23:56 GMT +recorded_with: VCR 5.0.0 diff --git a/test/channel_test.rb b/test/channel_test.rb new file mode 100644 index 00000000..b93f2ba1 --- /dev/null +++ b/test/channel_test.rb @@ -0,0 +1,50 @@ +require_relative "test_helper" + +describe "Channel class" do + describe "initialize method" do + it "Initializes a new channel" do + channel = SlackCLI::Channel.new(slack_id: 123, name: "test channel", topic: "tests", member_count: 10) + + expect(channel).must_be_instance_of SlackCLI::Channel + expect(channel.slack_id).must_equal 123 + expect(channel.name).must_equal "test channel" + expect(channel.topic).must_equal "tests" + expect(channel.member_count).must_equal 10 + end + end + + describe "get_message_history" do + it "Gets message history for a channel" do + VCR.use_cassette("channels") do + all_channels = SlackCLI::Channel.all + result = all_channels.first.get_message_history + + expect(result.code).must_equal 200 + expect(result["ok"]).must_equal true + end + end + + it "Raises an error if code is not 200 or result is not ok" do + VCR.use_cassette("bad_channels") do + all_channels = SlackCLI::Channel.all + + expect{all_channels.first.get_message_history}.must_raise SlackCLI::SlackAPIError + end + end + end + + describe "Self.all method" do + it "Returns a list of all channels" do + VCR.use_cassette("channels") do + all_channels = SlackCLI::Channel.all + + expect(all_channels).must_be_instance_of Array + expect(all_channels.length).must_equal 4 + + all_channels.each do |channel| + expect(channel).must_be_instance_of SlackCLI::Channel + end + end + end + end +end diff --git a/test/recipient_test.rb b/test/recipient_test.rb new file mode 100644 index 00000000..8ad25a0e --- /dev/null +++ b/test/recipient_test.rb @@ -0,0 +1,27 @@ +require_relative "test_helper" + +describe "Recipient class" do + let(:recipient) { SlackCLI::Recipient.new(123, "test") } + + describe "initialize method" do + it "Creates an instance of recipient" do + expect(recipient).must_be_instance_of SlackCLI::Recipient + expect(recipient.slack_id).must_equal 123 + expect(recipient.name).must_equal "test" + end + end + + describe "self.get method" do + it "Raises an exception if code isn't 200 or ok isn't true" do + VCR.use_cassette("bad_recipient") do + expect{SlackCLI::Recipient.get("test")}.must_raise SlackCLI::SlackAPIError + end + end + end + + describe "self.all method" do + it "Raises an exception for the self.all method" do + expect{SlackCLI::Recipient.all}.must_raise NotImplementedError + end + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 90aeb408..b2edc0ef 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,10 +8,26 @@ require 'minitest/reporters' require 'minitest/skip_dsl' require 'vcr' +require "dotenv" +require "httparty" +require "json" +require_relative "../lib/recipient" +require_relative "../lib/user" +require_relative "../lib/workspace" +require_relative "../lib/channel" +require_relative "../lib/errors" + +Dotenv.load Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new VCR.configure do |config| config.cassette_library_dir = "test/cassettes" config.hook_into :webmock + config.default_cassette_options = { :record => :new_episodes, + :match_requests_on => [:method, :uri, :body] } + + config.filter_sensitive_data("") do + ENV["SLACK_API_TOKEN"] + end end diff --git a/test/user_test.rb b/test/user_test.rb new file mode 100644 index 00000000..ac459089 --- /dev/null +++ b/test/user_test.rb @@ -0,0 +1,57 @@ +require_relative "test_helper" + +describe "User class" do + describe "initialize method" do + it "Initializes a new user" do + user = SlackCLI::User.new(slack_id: 123, name: "test", real_name: "Test Name") + + expect(user).must_be_instance_of SlackCLI::User + expect(user.slack_id).must_equal 123 + expect(user.name).must_equal "test" + expect(user.real_name).must_equal "Test Name" + end + end + + describe "get_message_history" do + it "Gets message history for a user" do + VCR.use_cassette("users") do + all_users = SlackCLI::User.all + result = all_users.first.get_message_history + + expect(result.code).must_equal 200 + expect(result["ok"]).must_equal true + end + end + + it "Raises an error for IM list if code isn't 200 or ok isn't true" do + VCR.use_cassette("bad_ims_list") do + all_users = SlackCLI::User.all + + expect{all_users.first.get_message_history}.must_raise SlackCLI::SlackAPIError + end + end + + it "Raises an error for Converstaions list if code isn't 200 or ok isn't true" do + VCR.use_cassette("bad_conversations_list") do + all_users = SlackCLI::User.all + + expect{all_users.first.get_message_history}.must_raise SlackCLI::SlackAPIError + end + end + end + + describe "Self.all method" do + it "Returns a list of all users" do + VCR.use_cassette("users") do + all_users = SlackCLI::User.all + + expect(all_users).must_be_instance_of Array + expect(all_users.length).must_equal 8 + + all_users.each do |user| + expect(user).must_be_instance_of SlackCLI::User + end + end + end + end +end diff --git a/test/workspace_test.rb b/test/workspace_test.rb new file mode 100644 index 00000000..6638ea9e --- /dev/null +++ b/test/workspace_test.rb @@ -0,0 +1,188 @@ +require_relative "test_helper" + +describe "Workspace class" do + before do + VCR.use_cassette("workspace") do + @workspace = SlackCLI::Workspace.new + end + end + + describe "initialize method" do + it "Creates a new workspace" do + expect(@workspace).must_be_instance_of SlackCLI::Workspace + end + + it "Generates an array of users" do + expect(@workspace.users).must_be_instance_of Array + expect(@workspace.users.first).must_be_instance_of SlackCLI::User + end + + it "Generates an array of channels" do + expect(@workspace.channels).must_be_instance_of Array + expect(@workspace.channels.first).must_be_instance_of SlackCLI::Channel + end + + it "Initializes selected as nil" do + expect(@workspace.selected).must_be_nil + end + + it "Sets the workplace's username" do + expect(@workspace.bot_name).must_equal "Slackbot" + end + + it "Sets the workplace's icon emoji" do + expect(@workspace.bot_avatar).must_equal "jack_o_lantern" + end + end + + describe "get_workplace_stats method" do + it "Returns a summary with the number of users and channels" do + actual_summary = "This workplace has 8 users and 4 channels." + + summary = @workspace.get_workplace_stats + expect(summary).must_equal actual_summary + end + end + + describe "find_user method" do + it "Finds the correct user from username" do + user = @workspace.find_user("slackbot") + + expect(user).must_be_instance_of SlackCLI::User + expect(user.real_name).must_equal "Slackbot" + expect(user.slack_id).must_equal "USLACKBOT" + end + + it "Finds the correct user from slack ID" do + user = @workspace.find_user("USLACKBOT") + + expect(user).must_be_instance_of SlackCLI::User + expect(user.real_name).must_equal "Slackbot" + end + + it "Returns nil if user isn't found" do + user = @workspace.find_user("goblin") + + expect(user).must_be_nil + end + end + + describe "find_channel method" do + it "Finds the correct channel from channel name" do + channel = @workspace.find_channel("random") + + expect(channel).must_be_instance_of SlackCLI::Channel + expect(channel.member_count).must_equal 7 + expect(channel.slack_id).must_equal "CMUR2JTNX" + end + + it "Finds the correct channel from slack ID" do + channel = @workspace.find_channel("CN6A88SJZ") + + expect(channel).must_be_instance_of SlackCLI::Channel + expect(channel.member_count).must_equal 3 + expect(channel.name).must_equal "turkey" + end + + it "Returns nil if channel isn't found" do + channel = @workspace.find_channel("goblin") + + expect(channel).must_be_nil + end + end + + describe "select_user method" do + it "changes the value of selected for the workspace" do + @workspace.select_user("slackbot") + + expect(@workspace.selected.name).must_equal "slackbot" + end + end + + describe "select_channel method" do + it "changes the value of selected for the workspace" do + @workspace.select_channel("random") + + expect(@workspace.selected.name).must_equal "random" + end + end + + describe "send_message method" do + it "sends a message to a user" do + VCR.use_cassette("send_message") do + @workspace.select_user("sabrina") + message_text = "I'm a message to a user" + + response = @workspace.send_message(message_text) + + expect(response["ok"]).must_equal true + expect(response["message"]["text"]).must_equal message_text + end + end + + it "sends a message to a channel" do + VCR.use_cassette("send_message") do + @workspace.select_channel("random") + message_text = "I'm a message to a channel" + + response = @workspace.send_message(message_text) + + expect(response["ok"]).must_equal true + expect(response["message"]["text"]).must_equal message_text + end + end + + it "Raises an error if code is not 200 or ok is false" do + VCR.use_cassette("bad_send_message") do + @workspace.select_channel("random") + message_text = "I'm a message to a channel" + + expect{@workspace.send_message(message_text)}.must_raise SlackCLI::SlackAPIError + end + end + + it "returns nil for a nonexistent user" do + VCR.use_cassette("send_message") do + @workspace.select_user("goblin") + message_text = "I won't get sent to a user" + + response = @workspace.send_message(message_text) + + expect(response).must_be_nil + end + end + + it "returns nil for a nonexistent channel" do + VCR.use_cassette("send_message") do + @workspace.select_user("goblin") + message_text = "I won't get sent to a channel" + + response = @workspace.send_message(message_text) + + expect(response).must_be_nil + end + end + end + + describe "save_settings method" do + it "Saves settings in a json file" do + @workspace.bot_name = "T-Rex" + @workspace.bot_avatar = "t-rex" + expected_output = {"bot_name"=>"T-Rex", "bot_avatar"=>"t-rex"} + + @workspace.save_settings + file = File.read("bot-settings.json") + final_output = JSON.parse(file) + + expect(final_output).must_equal expected_output + + # Change settings back to default + @workspace.bot_name = "Slackbot" + @workspace.bot_avatar = "jack_o_lantern" + @workspace.save_settings + + expect(@workspace.bot_name).must_equal "Slackbot" + expect(@workspace.bot_avatar).must_equal "jack_o_lantern" + end + end +end