From c96e696aaf5432251f808eec38a6e515f641b6de Mon Sep 17 00:00:00 2001 From: ohcloud Date: Tue, 10 Sep 2019 15:38:46 -0700 Subject: [PATCH 01/27] set up environment, added classes for recipient, user, and channel. Also, set up test helper with all require_realtives. --- lib/channel.rb | 24 ++++++++++++++++++++++++ lib/recipient.rb | 33 +++++++++++++++++++++++++++++++++ lib/slack.rb | 14 ++++++++++++-- lib/user.rb | 21 +++++++++++++++++++++ test/channel_test.rb | 1 + test/recipient_test.rb | 1 + test/slack_test.rb | 1 + test/test_helper.rb | 5 +++++ test/user_test.rb | 1 + 9 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 lib/channel.rb create mode 100644 lib/recipient.rb create mode 100644 lib/user.rb create mode 100644 test/channel_test.rb create mode 100644 test/recipient_test.rb create mode 100644 test/slack_test.rb create mode 100644 test/user_test.rb diff --git a/lib/channel.rb b/lib/channel.rb new file mode 100644 index 00000000..346a9ff8 --- /dev/null +++ b/lib/channel.rb @@ -0,0 +1,24 @@ +require 'httparty' +require 'awesome_print' +require 'dotenv' +require 'table_print' + +Dotenv.load + +# require_relative "../lib/recipient.rb" +# require_relative "../lib/user.rb" +# require_relative "../lib/slack.rb" + +module SlackCLI + + class Channel + + + + + + + + + end#end of class +end#end of module \ No newline at end of file diff --git a/lib/recipient.rb b/lib/recipient.rb new file mode 100644 index 00000000..7224e3db --- /dev/null +++ b/lib/recipient.rb @@ -0,0 +1,33 @@ +require 'httparty' +require 'awesome_print' +require 'dotenv' +require 'table_print' +require_relative "../lib/channel.rb" +require_relative "../lib/user.rb" +require_relative "../lib/slack.rb" + +Dotenv.load + +module SlackCLI + class Recipient + attr_reader :slack_id, :name + def initialize(slack_id, name) + @slack_id = slack_id + @name = name + end + end +end + +#CHANNELS_URL = https://slack.com/api/channels.list +#MESSAGE_URL = https://api.slack.com/methods/chat.postMessage +URL = 'https://slack.com/api/users.list' +TOKEN = ENV['SLACK_TOKEN'] + + +def self.get + rec_response = HTTParty.get(URL, query: { token: TOKEN }) + ap rec_response["members"] +end + +ap self.get + diff --git a/lib/slack.rb b/lib/slack.rb index 960cf2f7..8912bc88 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,10 +1,20 @@ #!/usr/bin/env ruby +require 'httparty' +require 'awesome_print' +require 'dotenv' +require 'table_print' +Dotenv.load + +# require_relative "../lib/recipient.rb" +# require_relative "../lib/user.rb" +# require_relative "../lib/channel.rb" + def main puts "Welcome to the Ada Slack CLI!" - + # TODO project - + puts "Thank you for using the Ada Slack CLI" end diff --git a/lib/user.rb b/lib/user.rb new file mode 100644 index 00000000..54a16fd6 --- /dev/null +++ b/lib/user.rb @@ -0,0 +1,21 @@ +require 'httparty' +require 'awesome_print' +require 'dotenv' +require 'table_print' +Dotenv.load + +# require_relative "../lib/recipient.rb" +# require_relative "../lib/channel.rb" +# require_relative "../lib/slack.rb" + + +module SlackCLI + + class User + + + + + + end#end of class +end#end of module \ No newline at end of file diff --git a/test/channel_test.rb b/test/channel_test.rb new file mode 100644 index 00000000..65776d84 --- /dev/null +++ b/test/channel_test.rb @@ -0,0 +1 @@ +require_relative 'test_helper.rb' \ No newline at end of file diff --git a/test/recipient_test.rb b/test/recipient_test.rb new file mode 100644 index 00000000..65776d84 --- /dev/null +++ b/test/recipient_test.rb @@ -0,0 +1 @@ +require_relative 'test_helper.rb' \ No newline at end of file diff --git a/test/slack_test.rb b/test/slack_test.rb new file mode 100644 index 00000000..65776d84 --- /dev/null +++ b/test/slack_test.rb @@ -0,0 +1 @@ +require_relative 'test_helper.rb' \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index 90aeb408..eace3b42 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -15,3 +15,8 @@ config.cassette_library_dir = "test/cassettes" config.hook_into :webmock end + +require_relative "../lib/recipient.rb" +require_relative "../lib/user.rb" +require_relative "../lib/channel.rb" +require_relative "../lib/slack.rb" \ No newline at end of file diff --git a/test/user_test.rb b/test/user_test.rb new file mode 100644 index 00000000..65776d84 --- /dev/null +++ b/test/user_test.rb @@ -0,0 +1 @@ +require_relative 'test_helper.rb' \ No newline at end of file From d6b04bd34fe9254af8a2f934e1fa9ae0af1fd53e Mon Sep 17 00:00:00 2001 From: ohcloud Date: Tue, 10 Sep 2019 16:51:23 -0700 Subject: [PATCH 02/27] ran into weird errors, pushing so dani can pull. --- lib/recipient.rb | 19 +++---------------- lib/slack.rb | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/lib/recipient.rb b/lib/recipient.rb index 7224e3db..14f01e4d 100644 --- a/lib/recipient.rb +++ b/lib/recipient.rb @@ -2,8 +2,8 @@ require 'awesome_print' require 'dotenv' require 'table_print' -require_relative "../lib/channel.rb" -require_relative "../lib/user.rb" +# require_relative "../lib/channel.rb" +# require_relative "../lib/user.rb" require_relative "../lib/slack.rb" Dotenv.load @@ -11,23 +11,10 @@ module SlackCLI class Recipient attr_reader :slack_id, :name + def initialize(slack_id, name) @slack_id = slack_id @name = name end end end - -#CHANNELS_URL = https://slack.com/api/channels.list -#MESSAGE_URL = https://api.slack.com/methods/chat.postMessage -URL = 'https://slack.com/api/users.list' -TOKEN = ENV['SLACK_TOKEN'] - - -def self.get - rec_response = HTTParty.get(URL, query: { token: TOKEN }) - ap rec_response["members"] -end - -ap self.get - diff --git a/lib/slack.rb b/lib/slack.rb index 8912bc88..a2afc314 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -5,17 +5,43 @@ require 'table_print' Dotenv.load -# require_relative "../lib/recipient.rb" +require_relative "../lib/recipient.rb" # require_relative "../lib/user.rb" # require_relative "../lib/channel.rb" +module SlackCLI + + class Slack + @@URL = 'https://slack.com/api/users.list' + @@TOKEN = ENV['SLACK_TOKEN'] + + attr_reader :users, :channels, :selected + + def initialize(users, channels, selected) + @users = users + @channels = channels + @selected = selected + end + + + def users_list(url, token) + users_response = HTTParty.get(@@URL, query: { token: @@TOKEN }) + ap users_response["members"] + end + + + end # of class + +end # of module def main + ap users_list(@@URL, @@TOKEN) puts "Welcome to the Ada Slack CLI!" - - # TODO project - - puts "Thank you for using the Ada Slack CLI" + puts "Thank you For using the Ada Slack CLI" end +# main if __FILE__ == $PROGRAM_channel +SlackCLI::Slack.main + -main if __FILE__ == $PROGRAM_NAME \ No newline at end of file +# CHANNELS_URL = https://slack.com/api/channels.list +# MESSAGE_URL = https://api.slack.com/methods/chat.postMessage From 0300de9acbfbdc99189dbe15c20ea6c0a5a2baf9 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Wed, 11 Sep 2019 16:49:53 -0700 Subject: [PATCH 03/27] Finished list of users and channels --- .gitignore | 2 +- api_driver.rb | 5 +++++ lib/channel.rb | 33 +++++++++++++++++++++++++++++++++ lib/recipient.rb | 11 +++++++++++ lib/slack.rb | 12 +++++++++--- lib/slack_api_wrapper.rb | 27 +++++++++++++++++++++++++++ lib/user.rb | 32 ++++++++++++++++++++++++++++++++ lib/workspace.rb | 26 ++++++++++++++++++++++++++ test/workspace_test.rb | 21 +++++++++++++++++++++ 9 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 api_driver.rb create mode 100644 lib/channel.rb create mode 100644 lib/recipient.rb create mode 100644 lib/slack_api_wrapper.rb create mode 100644 lib/user.rb create mode 100644 lib/workspace.rb create mode 100644 test/workspace_test.rb diff --git a/.gitignore b/.gitignore index 8d6a243f..b78e0506 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ /tmp/ # Used by dotenv library to load environment variables. -# .env +.env ## Specific to RubyMotion: .dat* diff --git a/api_driver.rb b/api_driver.rb new file mode 100644 index 00000000..1d2bf913 --- /dev/null +++ b/api_driver.rb @@ -0,0 +1,5 @@ +require 'dotenv' +Dotenv.load +require_relative 'lib/slack_api_wrapper' + +SlackApi.send_msg("Hi there!", "sploots") \ No newline at end of file diff --git a/lib/channel.rb b/lib/channel.rb new file mode 100644 index 00000000..0cc3b0c6 --- /dev/null +++ b/lib/channel.rb @@ -0,0 +1,33 @@ +require 'httparty' +require 'awesome_print' +require 'dotenv' +require_relative "recipient" +Dotenv.load + +module Slack + CHANNEL_URI = 'https://slack.com/api' + CHANNEL_KEY = ENV['API_KEY'] + class Channel < Recipient + attr_reader :topic, :member_count + + def initialize(name, id, topic, member_count) + super(name, id) + @topic = topic + @member_count = member_count + end + + def self.channels_list + channels = [] + response = HTTParty.get("#{CHANNEL_URI}/channels.list", query: {token: CHANNEL_KEY}) + response.parsed_response["channels"].each do |channel| + name = channel["name"] + id = channel["id"] + topic = channel["topic"] + member_count = channel["num_members"] + channel = Slack::Channel.new(name, id, topic, member_count) + channels << channel + end + return channels + end + end +end diff --git a/lib/recipient.rb b/lib/recipient.rb new file mode 100644 index 00000000..a4409df3 --- /dev/null +++ b/lib/recipient.rb @@ -0,0 +1,11 @@ +module Slack + class Recipient + attr_reader :name, :id + + def initialize(name, id) + @name = name + @id = id + end + + end +end \ No newline at end of file diff --git a/lib/slack.rb b/lib/slack.rb index 960cf2f7..be866be4 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,11 +1,17 @@ -#!/usr/bin/env ruby +require "httparty" +require "awesome_print" +require_relative "workspace" def main puts "Welcome to the Ada Slack CLI!" - + @workspace = Slack::Workspace.new() + p @workspace.users[4] + p @workspace.channels + # TODO project puts "Thank you for using the Ada Slack CLI" end -main if __FILE__ == $PROGRAM_NAME \ No newline at end of file +main if __FILE__ == $PROGRAM_NAME + diff --git a/lib/slack_api_wrapper.rb b/lib/slack_api_wrapper.rb new file mode 100644 index 00000000..82af715a --- /dev/null +++ b/lib/slack_api_wrapper.rb @@ -0,0 +1,27 @@ +require "HTTParty" + +class SlackApiError < StandardError ; end + +module SlackApi + BASE_URL = 'https://slack.com/api/' + API_KEY = ENV['API_KEY'] + + def self.send_msg(message, channel) + + response = HTTParty.post( + "#{BASE_URL}/chat.postMessage", + body: { + token: API_KEY, + text: message, + channel: channel + }, + headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } + ) + + unless response.code == 200 && response.parsed_response["ok"] + raise SlackApiError, "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" + end + + return true + end +end \ No newline at end of file diff --git a/lib/user.rb b/lib/user.rb new file mode 100644 index 00000000..1861ead0 --- /dev/null +++ b/lib/user.rb @@ -0,0 +1,32 @@ +require 'httparty' +require 'awesome_print' +require 'dotenv' +require_relative "user" +require_relative "recipient" +Dotenv.load + +module Slack + USERS_URI = 'https://slack.com/api' + USERS_KEY = ENV['API_KEY'] + class User < Recipient + attr_reader :real_name + def initialize(name, id, real_name) + super(name, id) + @real_name = real_name + end + + def self.users_list + users = [] + response = HTTParty.get("#{USERS_URI}/users.list", query: {token: USERS_KEY}) + response.parsed_response["members"].each do |member| + name = member["name"] + id = member["id"] + real_name = member["real_name"] + user = Slack::User.new(name, id, real_name) + users << user + end + return users + end + end +end + diff --git a/lib/workspace.rb b/lib/workspace.rb new file mode 100644 index 00000000..39bead6f --- /dev/null +++ b/lib/workspace.rb @@ -0,0 +1,26 @@ +require 'httparty' +require 'awesome_print' +require_relative "user" +require_relative "channel" + +module Slack + class Workspace + attr_reader :users, :channels, :selected + def initialize + @users = User.users_list + @channels = Channel.channels_list + @selected = selected + end + end +end + + + + + + + + + + + \ No newline at end of file diff --git a/test/workspace_test.rb b/test/workspace_test.rb new file mode 100644 index 00000000..6b0bc407 --- /dev/null +++ b/test/workspace_test.rb @@ -0,0 +1,21 @@ +require_relative "test_helper" + +describe "API wrapper" + before do + VCR.use_cassette("location_find") do + + +describe "get_location" do + describe "get location" do + it " " do + location = " " + VCR.use_cassette("name") do + response = " " + end + end + end +end + +# the name is the name if the cassete we want to specify. If we don't have that cassete created, it will be created automatically. +#i'm using location based on the example of the class, but we need to update it. + From 62092a6e8a43cfca1d47f1d8ecf196178321f3d2 Mon Sep 17 00:00:00 2001 From: ohcloud Date: Thu, 12 Sep 2019 14:30:49 -0700 Subject: [PATCH 04/27] created the logic for user. created workspace.rb. --- .gitignore | 2 +- lib/channel.rb | 44 ++++++++++++++++----------- lib/message.rb | 28 +++++++++++++++++ lib/recipient.rb | 26 ++++++---------- lib/slack.rb | 79 +++++++++++++++++++++++------------------------- lib/user.rb | 42 ++++++++++++++++--------- lib/workspace.rb | 55 +++++++++++++++++++++++++++++++++ 7 files changed, 185 insertions(+), 91 deletions(-) create mode 100644 lib/message.rb create mode 100644 lib/workspace.rb diff --git a/.gitignore b/.gitignore index 8d6a243f..b78e0506 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ /tmp/ # Used by dotenv library to load environment variables. -# .env +.env ## Specific to RubyMotion: .dat* diff --git a/lib/channel.rb b/lib/channel.rb index 346a9ff8..37f6a2fd 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -1,24 +1,34 @@ +#lib/channel.rb require 'httparty' require 'awesome_print' require 'dotenv' -require 'table_print' - +require_relative "recipient" Dotenv.load -# require_relative "../lib/recipient.rb" -# require_relative "../lib/user.rb" -# require_relative "../lib/slack.rb" - -module SlackCLI - - class Channel - - - - - - - - +module Slack + CHANNEL_URI = 'https://slack.com/api' + CHANNEL_KEY = ENV['API_KEY'] + class Channel < Recipient + attr_reader :topic, :member_count + + def initialize(name, id, topic, member_count) + super(name, id) + @topic = topic + @member_count = member_count + end + + def self.channels_list + channels = [] + response = HTTParty.get("#{CHANNEL_URI}/channels.list", query: {token: CHANNEL_KEY}) + response.parsed_response["channels"].each do |channel| + name = channel["name"] + id = channel["id"] + topic = channel["topic"] + member_count = channel["num_members"] + channel = Slack::Channel.new(name, id, topic, member_count) + channels << channel + end + return channels + end end#end of class end#end of module \ No newline at end of file diff --git a/lib/message.rb b/lib/message.rb new file mode 100644 index 00000000..b7319edb --- /dev/null +++ b/lib/message.rb @@ -0,0 +1,28 @@ +#lib/message.rb +require "HTTParty" + +class SlackApiError < StandardError ; end + +module SlackApi + BASE_URL = 'https://slack.com/api/' + API_KEY = ENV['API_KEY'] + + def self.send_msg(message, channel) + + response = HTTParty.post( + "#{BASE_URL}/chat.postMessage", + body: { + token: API_KEY, + text: message, + channel: channel + }, + headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } + ) + + unless response.code == 200 && response.parsed_response["ok"] + raise SlackApiError, "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" + end + + return true + end +end \ No newline at end of file diff --git a/lib/recipient.rb b/lib/recipient.rb index 14f01e4d..f53ba7c5 100644 --- a/lib/recipient.rb +++ b/lib/recipient.rb @@ -1,20 +1,12 @@ -require 'httparty' -require 'awesome_print' -require 'dotenv' -require 'table_print' -# require_relative "../lib/channel.rb" -# require_relative "../lib/user.rb" -require_relative "../lib/slack.rb" - -Dotenv.load - -module SlackCLI - class Recipient - attr_reader :slack_id, :name +#lib/recipient.rb +module Slack + class Recipient + attr_reader :name, :id - def initialize(slack_id, name) - @slack_id = slack_id + def initialize(name, id) @name = name + @id = id end - end -end + + end#end of class +end#end of module diff --git a/lib/slack.rb b/lib/slack.rb index a2afc314..394e35a7 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,47 +1,44 @@ -#!/usr/bin/env ruby -require 'httparty' -require 'awesome_print' -require 'dotenv' -require 'table_print' -Dotenv.load +#lib/slack.rb +require "httparty" +require "awesome_print" +require "colorize" +require_relative "workspace" -require_relative "../lib/recipient.rb" -# require_relative "../lib/user.rb" -# require_relative "../lib/channel.rb" - -module SlackCLI +def main + puts "Welcome to the Ada Slack CLI!".colorize(:color => :blue, :mode => :bold) + @workspace = Slack::Workspace.new() - class Slack - @@URL = 'https://slack.com/api/users.list' - @@TOKEN = ENV['SLACK_TOKEN'] - - attr_reader :users, :channels, :selected - - def initialize(users, channels, selected) - @users = users - @channels = channels - @selected = selected - end - - - def users_list(url, token) - users_response = HTTParty.get(@@URL, query: { token: @@TOKEN }) - ap users_response["members"] + puts "\nPlease Choose from the following options: + \n1. List Users + \n2. List Channels + \n3. Select User + \n4. Select Channel + \n5. Details + \n6. Send Message + \n7. Quit".colorize(:color => :blue, :mode => :bold) + + option = gets.chomps.upcase + + until option == "QUIT" + if option == "List Users" + return @workspace.users + elsif option == "List Channels" + return @workspace.channels + elsif option == "Select User" + return @workspace.select_user(option) + elsif option == "Select Channel" + return @workspace.select_channel(option) + elsif option == "Details" + return @workspace.show_details + + main + puts "Good Bye" + break end - end # of class + puts "Thank you for using the Ada Slack CLI" + end -end # of module - -def main - ap users_list(@@URL, @@TOKEN) - puts "Welcome to the Ada Slack CLI!" - puts "Thank you For using the Ada Slack CLI" -end -# main if __FILE__ == $PROGRAM_channel -SlackCLI::Slack.main - - -# CHANNELS_URL = https://slack.com/api/channels.list -# MESSAGE_URL = https://api.slack.com/methods/chat.postMessage + main if __FILE__ == $PROGRAM_NAME + \ No newline at end of file diff --git a/lib/user.rb b/lib/user.rb index 54a16fd6..050dd2af 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -1,21 +1,33 @@ +#lib/user.rb require 'httparty' require 'awesome_print' require 'dotenv' -require 'table_print' +require_relative "user" +require_relative "recipient" Dotenv.load -# require_relative "../lib/recipient.rb" -# require_relative "../lib/channel.rb" -# require_relative "../lib/slack.rb" - - -module SlackCLI - - class User - - - - +module Slack + USERS_URI = 'https://slack.com/api' + USERS_KEY = ENV['API_KEY'] + class User < Recipient + attr_reader :real_name + def initialize(name, id, real_name) + super(name, id) + @real_name = real_name + end + + def self.users_list + users = [] + response = HTTParty.get("#{USERS_URI}/users.list", query: {token: USERS_KEY}) + response.parsed_response["members"].each do |member| + name = member["name"] + id = member["id"] + real_name = member["real_name"] + user = Slack::User.new(name, id, real_name) + users << user + end + return users + end - end#end of class -end#end of module \ No newline at end of file + end +end \ No newline at end of file diff --git a/lib/workspace.rb b/lib/workspace.rb new file mode 100644 index 00000000..19b6c61e --- /dev/null +++ b/lib/workspace.rb @@ -0,0 +1,55 @@ +#lib/workspace.rb +require 'httparty' +require 'awesome_print' +require_relative "user" +require_relative "channel" +module Slack + class Workspace + attr_reader :users, :channels, :selected + def initialize + @users = User.users_list + @channels = Channel.channels_list + @selected = [] + end + def select_user(input) + @users.each do |user| + if user.name == input || user.id == input + recipient = user + @selected << recipient + else + raise ArgumentError.new("The provided name/id doesn't match any user") + end + end + end + def select_channel(input) + @channels.each do |channel| + if channel.name == input || channel.id == input + recipient = channel + @selected << recipient + else + raise ArgumentError.new("The provided name/id doesn't match any channel") + end + end + end + def show_details + if @selected != [] + @selected.each do |recipient| + if recipient.class == Slack::User + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Real name: #{recipient.id}\n\n" + else recipient.class == Slack::Channel + topic = recipient.topic.values + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" + puts "Member count: #{recipient.member_count}\n\n" + end + end + elsif @selected == [] + raise ArgumentError.new("No recipient is currently selected.") + end + end + end +end + From bdaced216a55e3e753bfbd8ea74f2c0a637bbdfc Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Thu, 12 Sep 2019 14:35:53 -0700 Subject: [PATCH 05/27] Pre-Cloudy --- lib/channel.rb | 1 + lib/recipient.rb | 1 + lib/slack.rb | 9 ++++++-- lib/slack_api_wrapper.rb | 27 ----------------------- lib/user.rb | 4 +++- lib/workspace.rb | 47 +++++++++++++++++++++++++++++++++++++++- 6 files changed, 58 insertions(+), 31 deletions(-) delete mode 100644 lib/slack_api_wrapper.rb diff --git a/lib/channel.rb b/lib/channel.rb index 0cc3b0c6..6c222e35 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -1,3 +1,4 @@ +#lib/channel.rb require 'httparty' require 'awesome_print' require 'dotenv' diff --git a/lib/recipient.rb b/lib/recipient.rb index a4409df3..86b7d0b6 100644 --- a/lib/recipient.rb +++ b/lib/recipient.rb @@ -1,3 +1,4 @@ +#lib/recipient.rb module Slack class Recipient attr_reader :name, :id diff --git a/lib/slack.rb b/lib/slack.rb index be866be4..37711ee2 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,3 +1,4 @@ +#lib/slack.rb require "httparty" require "awesome_print" require_relative "workspace" @@ -5,8 +6,12 @@ def main puts "Welcome to the Ada Slack CLI!" @workspace = Slack::Workspace.new() - p @workspace.users[4] - p @workspace.channels + @workspace.users + @workspace.channels + @workspace.select_user("UMTERDBPU") + # @workspace.select_channel("CMUPUL1R9") + p @workspace.show_details + # TODO project diff --git a/lib/slack_api_wrapper.rb b/lib/slack_api_wrapper.rb deleted file mode 100644 index 82af715a..00000000 --- a/lib/slack_api_wrapper.rb +++ /dev/null @@ -1,27 +0,0 @@ -require "HTTParty" - -class SlackApiError < StandardError ; end - -module SlackApi - BASE_URL = 'https://slack.com/api/' - API_KEY = ENV['API_KEY'] - - def self.send_msg(message, channel) - - response = HTTParty.post( - "#{BASE_URL}/chat.postMessage", - body: { - token: API_KEY, - text: message, - channel: channel - }, - headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } - ) - - unless response.code == 200 && response.parsed_response["ok"] - raise SlackApiError, "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" - end - - return true - end -end \ No newline at end of file diff --git a/lib/user.rb b/lib/user.rb index 1861ead0..f0b86d4b 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -1,3 +1,4 @@ +#lib/user.rb require 'httparty' require 'awesome_print' require 'dotenv' @@ -14,7 +15,7 @@ def initialize(name, id, real_name) super(name, id) @real_name = real_name end - + def self.users_list users = [] response = HTTParty.get("#{USERS_URI}/users.list", query: {token: USERS_KEY}) @@ -27,6 +28,7 @@ def self.users_list end return users end + end end diff --git a/lib/workspace.rb b/lib/workspace.rb index 39bead6f..8ef0a7da 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -1,3 +1,4 @@ +#lib/workspace.rb require 'httparty' require 'awesome_print' require_relative "user" @@ -9,8 +10,52 @@ class Workspace def initialize @users = User.users_list @channels = Channel.channels_list - @selected = selected + @selected = [] end + + def select_user(input) + @users.each do |user| + if user.name == input || user.id == input + recipient = user + @selected << recipient + # else + # raise ArgumentError.new("The provided name/id doesn't match any user") + end + end + end + + def select_channel(input) + @channels.each do |channel| + if channel.name == input || channel.id == input + recipient = channel + @selected << recipient + else + raise ArgumentError.new("The provided name/id doesn't match any channel") + end + end + end + + def show_details + if @selected != [] + @selected.each do |recipient| + if recipient.class == Slack::User + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Real name: #{recipient.id}\n\n" + else recipient.class == Slack::Channel + topic = recipient.topic.values + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" + puts "Member count: #{recipient.member_count}\n\n" + end + end + elsif @selected == [] + raise ArgumentError.new("No recipient is currently selected.") + end + end + + end end From 3209db1626bf6d11113f466aa8b917a12b422fc6 Mon Sep 17 00:00:00 2001 From: ohcloud Date: Thu, 12 Sep 2019 14:56:30 -0700 Subject: [PATCH 06/27] working driver code. and command line stuff --- lib/slack.rb | 33 +++++++++++++++++---------------- lib/user.rb | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index 394e35a7..9bf40049 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -2,6 +2,7 @@ require "httparty" require "awesome_print" require "colorize" +require "table_print" require_relative "workspace" def main @@ -17,28 +18,28 @@ def main \n6. Send Message \n7. Quit".colorize(:color => :blue, :mode => :bold) - option = gets.chomps.upcase + option = gets.chomp.downcase - until option == "QUIT" - if option == "List Users" - return @workspace.users - elsif option == "List Channels" + while option != "quit" + if option == "list users" + puts @workspace.users + elsif option == "list channels" return @workspace.channels - elsif option == "Select User" + elsif option == "select user" return @workspace.select_user(option) - elsif option == "Select Channel" + elsif option == "select channel" return @workspace.select_channel(option) - elsif option == "Details" + elsif option == "details" return @workspace.show_details - - main + elsif main + else + option == "quit" puts "Good Bye" - break + exit end - - - puts "Thank you for using the Ada Slack CLI" end - main if __FILE__ == $PROGRAM_NAME - \ No newline at end of file + puts "Thank you for using the Ada Slack CLI" + +end +main if __FILE__ == $PROGRAM_NAME diff --git a/lib/user.rb b/lib/user.rb index 050dd2af..c4362b6b 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -24,7 +24,7 @@ def self.users_list id = member["id"] real_name = member["real_name"] user = Slack::User.new(name, id, real_name) - users << user + users << user end return users end From a6f7fd4ff0c28eb03c3c4d94fab4c98c400b2e3a Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Thu, 12 Sep 2019 15:02:07 -0700 Subject: [PATCH 07/27] Updates to slack.rb and workspace.rb --- lib/slack.rb | 44 ++++++++++++++----- lib/workspace.rb | 112 ++++++++++++++++++++--------------------------- 2 files changed, 80 insertions(+), 76 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index 87c3a146..196bf325 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,21 +1,41 @@ #lib/slack.rb require "httparty" require "awesome_print" +require "colorize" +require "table_print" require_relative "workspace" def main - puts "Welcome to the Ada Slack CLI!" - @workspace = Slack::Workspace.new() - @workspace.users - @workspace.channels - @workspace.select_user("UMTERDBPU") - # @workspace.select_channel("CMUPUL1R9") - # p @workspace.show_details - - - # TODO project - - puts "Thank you for using the Ada Slack CLI" + puts "Welcome to the Ada Slack CLI!".colorize(:color => :blue, :mode => :bold) + @workspace = Slack::Workspace.new() + puts "\nPlease Choose from the following options: + \n1. List Users + \n2. List Channels + \n3. Select User + \n4. Select Channel + \n5. Details + \n6. Send Message + \n7. Quit".colorize(:color => :blue, :mode => :bold) + option = gets.chomp.downcase + while option != "quit" + if option == "list users" + puts @workspace.users + elsif option == "list channels" + return @workspace.channels + elsif option == "select user" + return @workspace.select_user(option) + elsif option == "select channel" + return @workspace.select_channel(option) + elsif option == "details" + return @workspace.show_details + elsif main + else + option == "quit" + puts "Good Bye" + exit + end + end + puts "Thank you for using the Ada Slack CLI" end main if __FILE__ == $PROGRAM_NAME diff --git a/lib/workspace.rb b/lib/workspace.rb index f60edcbd..24523eb9 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -4,67 +4,51 @@ require_relative "user" require_relative "channel" module Slack - class Workspace - attr_reader :users, :channels, :selected - def initialize - @users = User.users_list - @channels = Channel.channels_list - @selected = [] - end - - def select_user(input) - @users.each do |user| - if user.name == input || user.id == input - recipient = user - @selected << recipient - # else - # raise ArgumentError.new("The provided name/id doesn't match any user") - end - end - end - - def select_channel(input) - @channels.each do |channel| - if channel.name == input || channel.id == input - recipient = channel - @selected << recipient - else - raise ArgumentError.new("The provided name/id doesn't match any channel") - end - end - end - - def show_details - if @selected != [] - @selected.each do |recipient| - if recipient.class == Slack::User - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Real name: #{recipient.id}\n\n" - else recipient.class == Slack::Channel - topic = recipient.topic.values - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" - puts "Member count: #{recipient.member_count}\n\n" - end - end - elsif @selected == [] - raise ArgumentError.new("No recipient is currently selected.") - end - end - - - end -end - - - - - - - - - - - + class Workspace + attr_reader :users, :channels, :selected + def initialize + @users = User.users_list + @channels = Channel.channels_list + @selected = [] + end + def select_user(input) + @users.each do |user| + if user.name == input || user.id == input + recipient = user + @selected << recipient + else + raise ArgumentError.new("The provided name/id doesn't match any user") + end + end + end + def select_channel(input) + @channels.each do |channel| + if channel.name == input || channel.id == input + recipient = channel + @selected << recipient + else + raise ArgumentError.new("The provided name/id doesn't match any channel") + end + end + end + def show_details + if @selected != [] + @selected.each do |recipient| + if recipient.class == Slack::User + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Real name: #{recipient.id}\n\n" + else recipient.class == Slack::Channel + topic = recipient.topic.values + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" + puts "Member count: #{recipient.member_count}\n\n" + end + end + elsif @selected == [] + raise ArgumentError.new("No recipient is currently selected.") + end + end + end +end \ No newline at end of file From c3c746f62921946028a547c073a67305383b6631 Mon Sep 17 00:00:00 2001 From: ohcloud Date: Thu, 12 Sep 2019 15:03:04 -0700 Subject: [PATCH 08/27] working on main. --- lib/slack.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index 9bf40049..cf3c684b 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -24,13 +24,13 @@ def main if option == "list users" puts @workspace.users elsif option == "list channels" - return @workspace.channels + puts @workspace.channels elsif option == "select user" - return @workspace.select_user(option) + puts @workspace.select_user(option) elsif option == "select channel" - return @workspace.select_channel(option) + puts @workspace.select_channel(option) elsif option == "details" - return @workspace.show_details + puts@workspace.show_details elsif main else option == "quit" From 214cb9ce1866a9abc75865cce795008c1685dc8e Mon Sep 17 00:00:00 2001 From: ohcloud Date: Thu, 12 Sep 2019 16:55:16 -0700 Subject: [PATCH 09/27] still working on printing all correct properties. almost there. --- lib/channel.rb | 3 +- lib/slack.rb | 69 +++++++++++++++++++--------------- lib/user.rb | 5 +-- lib/workspace.rb | 98 +++++++++++++++++++++++++----------------------- 4 files changed, 93 insertions(+), 82 deletions(-) diff --git a/lib/channel.rb b/lib/channel.rb index 8d364993..8a7439dd 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -16,6 +16,7 @@ def initialize(name, id, topic, member_count) @topic = topic @member_count = member_count end + def self.channels_list channels = [] response = HTTParty.get("#{CHANNEL_URI}/channels.list", query: {token: CHANNEL_KEY}) @@ -30,4 +31,4 @@ def self.channels_list return channels end end -end +end \ No newline at end of file diff --git a/lib/slack.rb b/lib/slack.rb index cf3c684b..524296ee 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,13 +1,14 @@ -#lib/slack.rb -require "httparty" -require "awesome_print" -require "colorize" -require "table_print" -require_relative "workspace" - -def main - puts "Welcome to the Ada Slack CLI!".colorize(:color => :blue, :mode => :bold) - @workspace = Slack::Workspace.new() + #lib/slack.rb + require "httparty" + require "awesome_print" + require "colorize" + require "table_print" + + require_relative "workspace" + + def main + puts "Welcome to the Ada Slack CLI!".colorize(:color => :orange, :mode => :bold) + @workspace = Slack::Workspace.new() puts "\nPlease Choose from the following options: \n1. List Users @@ -16,30 +17,36 @@ def main \n4. Select Channel \n5. Details \n6. Send Message - \n7. Quit".colorize(:color => :blue, :mode => :bold) + \n7. Quit".colorize(:color => :purple, :mode => :bold) option = gets.chomp.downcase - while option != "quit" - if option == "list users" - puts @workspace.users - elsif option == "list channels" - puts @workspace.channels - elsif option == "select user" - puts @workspace.select_user(option) - elsif option == "select channel" - puts @workspace.select_channel(option) - elsif option == "details" - puts@workspace.show_details - elsif main - else - option == "quit" - puts "Good Bye" - exit - end + case option + when "list users" + tp @workspace.users, "name", "id", "real_name" + main + when "list channels" + tp @workspace.channels, "name", "id", "topic", "member_count" + main + when "select user" + puts "Please enter username or Slack ID" + user_selection = gets.chomp.downcase + puts @workspace.select_user(user_selection) + main + when "select channel" + puts "Please enter channel name or Slack ID" + channel_selection = gets.chomp.downcase + puts @workspace.select_channel(channel_selection) + main + when "details" + puts @workspace.show_details + main + when "quit" + exit + else + main end - puts "Thank you for using the Ada Slack CLI" - end -main if __FILE__ == $PROGRAM_NAME + +main if __FILE__ == $PROGRAM_NAME \ No newline at end of file diff --git a/lib/user.rb b/lib/user.rb index 6a14bd77..c4362b6b 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -15,7 +15,7 @@ def initialize(name, id, real_name) super(name, id) @real_name = real_name end - + def self.users_list users = [] response = HTTParty.get("#{USERS_URI}/users.list", query: {token: USERS_KEY}) @@ -30,5 +30,4 @@ def self.users_list end end -end - +end \ No newline at end of file diff --git a/lib/workspace.rb b/lib/workspace.rb index 5d15cde5..be4bcf53 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -5,51 +5,55 @@ require_relative "channel" module Slack - class Workspace - attr_reader :users, :channels, :selected - def initialize - @users = User.users_list - @channels = Channel.channels_list - @selected = [] - end - def select_user(input) - @users.each do |user| - if user.name == input || user.id == input - recipient = user - @selected << recipient - else - raise ArgumentError.new("The provided name/id doesn't match any user") - end - end - end - def select_channel(input) - @channels.each do |channel| - if channel.name == input || channel.id == input - recipient = channel - @selected << recipient - else - raise ArgumentError.new("The provided name/id doesn't match any channel") - end - end - end - def show_details - if @selected != [] - @selected.each do |recipient| - if recipient.class == Slack::User - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Real name: #{recipient.id}\n\n" - else recipient.class == Slack::Channel - topic = recipient.topic.values - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" - puts "Member count: #{recipient.member_count}\n\n" - end - end - elsif @selected == [] - raise ArgumentError.new("No recipient is currently selected.") - end - end - end + class Workspace + attr_reader :users, :channels, :selected + def initialize + @users = User.users_list + @channels = Channel.channels_list + @selected = [] + end + + def select_user(input) + @users.each do |user| + if user.name == input || user.id == input + recipient = user + @selected << recipient + return recipient + # else + # raise ArgumentError,"The provided name/id doesn't match any user" + end + end + end + + def select_channel(input) + @channels.each do |channel| + if channel.name == input || channel.id == input + recipient = channel + @selected << recipient + else + raise ArgumentError.new("The provided name/id doesn't match any channel") + end + end + end + + def show_details + if @selected != [] + @selected.each do |recipient| + if recipient.class == Slack::User + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Real name: #{recipient.id}\n\n" + else recipient.class == Slack::Channel + topic = recipient.topic.values + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" + puts "Member count: #{recipient.member_count}\n\n" + end + end + elsif @selected == [] + raise ArgumentError.new("No recipient is currently selected.") + end + end + end end \ No newline at end of file From 83702a2427cb8610e42d762e390df15429eb27bd Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Thu, 12 Sep 2019 16:59:23 -0700 Subject: [PATCH 10/27] Same as Cloudy --- lib/slack.rb | 79 +++++++++++++++++++---------------- lib/workspace.rb | 104 ++++++++++++++++++++++++++--------------------- 2 files changed, 100 insertions(+), 83 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index cf3c684b..b7567511 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -3,43 +3,50 @@ require "awesome_print" require "colorize" require "table_print" + require_relative "workspace" def main - puts "Welcome to the Ada Slack CLI!".colorize(:color => :blue, :mode => :bold) - @workspace = Slack::Workspace.new() - - puts "\nPlease Choose from the following options: - \n1. List Users - \n2. List Channels - \n3. Select User - \n4. Select Channel - \n5. Details - \n6. Send Message - \n7. Quit".colorize(:color => :blue, :mode => :bold) - - option = gets.chomp.downcase - - while option != "quit" - if option == "list users" - puts @workspace.users - elsif option == "list channels" - puts @workspace.channels - elsif option == "select user" - puts @workspace.select_user(option) - elsif option == "select channel" - puts @workspace.select_channel(option) - elsif option == "details" - puts@workspace.show_details - elsif main - else - option == "quit" - puts "Good Bye" - exit - end - end - - puts "Thank you for using the Ada Slack CLI" - + puts "Welcome to the Ada Slack CLI!".colorize(:color => :orange, :mode => :bold) + @workspace = Slack::Workspace.new() + + puts "\nPlease Choose from the following options: + \n1. List Users + \n2. List Channels + \n3. Select User + \n4. Select Channel + \n5. Details + \n6. Send Message + \n7. Quit".colorize(:color => :purple, :mode => :bold) + + option = gets.chomp.downcase + + case option + when "list users" + tp @workspace.users, "name", "id", "real_name" + main + when "list channels" + tp @workspace.channels, "name", "id", "topic", "member_count" + main + when "select user" + puts "Please enter username or Slack ID" + user_selection = gets.chomp.downcase + puts @workspace.select_user(user_selection) + main + when "select channel" + puts "Please enter channel name or Slack ID" + channel_selection = gets.chomp.downcase + puts @workspace.select_channel(channel_selection) + main + when "details" + puts @workspace.show_details + main + when "quit" + exit + else + main + end + puts "Thank you for using the Ada Slack CLI" end -main if __FILE__ == $PROGRAM_NAME + +main if __FILE__ == $PROGRAM_NAME \ No newline at end of file diff --git a/lib/workspace.rb b/lib/workspace.rb index 5d15cde5..c6530fda 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -4,52 +4,62 @@ require_relative "user" require_relative "channel" +#lib/workspace.rb +require 'httparty' +require 'awesome_print' +require_relative "user" +require_relative "channel" + module Slack - class Workspace - attr_reader :users, :channels, :selected - def initialize - @users = User.users_list - @channels = Channel.channels_list - @selected = [] - end - def select_user(input) - @users.each do |user| - if user.name == input || user.id == input - recipient = user - @selected << recipient - else - raise ArgumentError.new("The provided name/id doesn't match any user") - end - end - end - def select_channel(input) - @channels.each do |channel| - if channel.name == input || channel.id == input - recipient = channel - @selected << recipient - else - raise ArgumentError.new("The provided name/id doesn't match any channel") - end - end - end - def show_details - if @selected != [] - @selected.each do |recipient| - if recipient.class == Slack::User - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Real name: #{recipient.id}\n\n" - else recipient.class == Slack::Channel - topic = recipient.topic.values - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" - puts "Member count: #{recipient.member_count}\n\n" - end - end - elsif @selected == [] - raise ArgumentError.new("No recipient is currently selected.") - end - end - end + class Workspace + attr_reader :users, :channels, :selected + def initialize + @users = User.users_list + @channels = Channel.channels_list + @selected = [] + end + + def select_user(input) + @users.each do |user| + if user.name == input || user.id == input + recipient = user + @selected << recipient + return recipient + # else + # raise ArgumentError,"The provided name/id doesn't match any user" + end + end + end + + def select_channel(input) + @channels.each do |channel| + if channel.name == input || channel.id == input + recipient = channel + @selected << recipient + else + raise ArgumentError.new("The provided name/id doesn't match any channel") + end + end + end + + def show_details + if @selected != [] + @selected.each do |recipient| + if recipient.class == Slack::User + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Real name: #{recipient.id}\n\n" + else recipient.class == Slack::Channel + topic = recipient.topic.values + puts "Name: #{recipient.name}" + puts "Id: #{recipient.id}" + puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" + puts "Member count: #{recipient.member_count}\n\n" + end + end + elsif @selected == [] + raise ArgumentError.new("No recipient is currently selected.") + end + end + end end \ No newline at end of file From a6d48e85b6b4b84a9fd97fbefb69cf8d3919c0b0 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Thu, 12 Sep 2019 19:46:50 -0700 Subject: [PATCH 11/27] Fixed driver code loop. Removed recursive loop --- lib/slack.rb | 73 ++++++++++++++++++++++-------------------------- lib/workspace.rb | 19 ++++++------- 2 files changed, 41 insertions(+), 51 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index b7567511..3899b116 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -3,50 +3,43 @@ require "awesome_print" require "colorize" require "table_print" - require_relative "workspace" def main - puts "Welcome to the Ada Slack CLI!".colorize(:color => :orange, :mode => :bold) - @workspace = Slack::Workspace.new() - - puts "\nPlease Choose from the following options: - \n1. List Users - \n2. List Channels - \n3. Select User - \n4. Select Channel - \n5. Details - \n6. Send Message - \n7. Quit".colorize(:color => :purple, :mode => :bold) - - option = gets.chomp.downcase + @workspace = Slack::Workspace.new() + while true + puts "Welcome to the Ada Slack CLI!".colorize(:color => :orange, :mode => :bold) + puts "\nPlease Choose from the following options: + \n1. List Users + \n2. List Channels + \n3. Select User + \n4. Select Channel + \n5. Details + \n6. Send Message + \n7. Quit".colorize(:color => :purple, :mode => :bold) - case option - when "list users" - tp @workspace.users, "name", "id", "real_name" - main - when "list channels" - tp @workspace.channels, "name", "id", "topic", "member_count" - main - when "select user" - puts "Please enter username or Slack ID" - user_selection = gets.chomp.downcase - puts @workspace.select_user(user_selection) - main - when "select channel" - puts "Please enter channel name or Slack ID" - channel_selection = gets.chomp.downcase - puts @workspace.select_channel(channel_selection) - main - when "details" - puts @workspace.show_details - main - when "quit" - exit - else - main - end - puts "Thank you for using the Ada Slack CLI" + option = gets.chomp.downcase + + case option + when "list users" + tp @workspace.users, "name", "id", "real_name" + when "list channels" + tp @workspace.channels, "name", "id", "topic", "member_count" + when "select user" + puts "Please enter username or Slack ID" + user_selection = gets.chomp.downcase + puts @workspace.select_user(user_selection) + when "select channel" + puts "Please enter channel name or Slack ID" + channel_selection = gets.chomp.downcase + puts @workspace.select_channel(channel_selection) + when "details" + puts @workspace.show_details + when "quit" + exit + end + end + puts "Thank you for using the Ada Slack CLI" end main if __FILE__ == $PROGRAM_NAME \ No newline at end of file diff --git a/lib/workspace.rb b/lib/workspace.rb index c6530fda..9e246617 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -4,12 +4,6 @@ require_relative "user" require_relative "channel" -#lib/workspace.rb -require 'httparty' -require 'awesome_print' -require_relative "user" -require_relative "channel" - module Slack class Workspace attr_reader :users, :channels, :selected @@ -24,11 +18,12 @@ def select_user(input) if user.name == input || user.id == input recipient = user @selected << recipient - return recipient - # else - # raise ArgumentError,"The provided name/id doesn't match any user" + break end end + if @selected == [] + raise ArgumentError.new("The provided name/id doesn't match any user") + end end def select_channel(input) @@ -36,10 +31,12 @@ def select_channel(input) if channel.name == input || channel.id == input recipient = channel @selected << recipient - else - raise ArgumentError.new("The provided name/id doesn't match any channel") + break end end + if @selected == [] + raise ArgumentError.new("The provided name/id doesn't match any user") + end end def show_details From 3e442c7857fd82a788c43651720b0f6b9a3cb768 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Thu, 12 Sep 2019 20:13:48 -0700 Subject: [PATCH 12/27] Added option to enter numbers on the menu, and to slow down what is printed on the screen --- lib/slack.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index 3899b116..b89c639e 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -21,21 +21,26 @@ def main option = gets.chomp.downcase case option - when "list users" + when "list users", "1" tp @workspace.users, "name", "id", "real_name" - when "list channels" + sleep(5) + when "list channels", "2" tp @workspace.channels, "name", "id", "topic", "member_count" - when "select user" + sleep(5) + when "select user", "3" puts "Please enter username or Slack ID" user_selection = gets.chomp.downcase puts @workspace.select_user(user_selection) - when "select channel" + when "select channel", "4" puts "Please enter channel name or Slack ID" channel_selection = gets.chomp.downcase puts @workspace.select_channel(channel_selection) - when "details" + when "details", "5" puts @workspace.show_details - when "quit" + sleep(5) + when "send message", "6" + + when "quit", "7" exit end end From 5400aa6293cc8ce1234d6d1ae7ed55c0af5fca53 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Thu, 12 Sep 2019 21:33:09 -0700 Subject: [PATCH 13/27] Finished driver code wave 2 --- lib/slack.rb | 14 ++++++------ lib/workspace.rb | 55 +++++++++++++++++++++++++----------------------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index b89c639e..abc1f7fc 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -23,21 +23,21 @@ def main case option when "list users", "1" tp @workspace.users, "name", "id", "real_name" - sleep(5) + sleep(3) when "list channels", "2" tp @workspace.channels, "name", "id", "topic", "member_count" - sleep(5) + sleep(3) when "select user", "3" puts "Please enter username or Slack ID" - user_selection = gets.chomp.downcase - puts @workspace.select_user(user_selection) + user_selection = gets.chomp + @workspace.select_user(user_selection) when "select channel", "4" puts "Please enter channel name or Slack ID" - channel_selection = gets.chomp.downcase - puts @workspace.select_channel(channel_selection) + channel_selection = gets.chomp + @workspace.select_channel(channel_selection) when "details", "5" puts @workspace.show_details - sleep(5) + sleep(3) when "send message", "6" when "quit", "7" diff --git a/lib/workspace.rb b/lib/workspace.rb index 9e246617..3db8cbfe 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -6,56 +6,59 @@ module Slack class Workspace - attr_reader :users, :channels, :selected + attr_reader :users, :channels, :recipient def initialize @users = User.users_list @channels = Channel.channels_list - @selected = [] + @recipient= nil end def select_user(input) + found = false @users.each do |user| - if user.name == input || user.id == input - recipient = user - @selected << recipient + if user.name == input.downcase || user.id == input + @recipient = user + found = true break end end - if @selected == [] - raise ArgumentError.new("The provided name/id doesn't match any user") + + if found == false + puts "The provided name/id doesn't match any user" + sleep(0.5) end end def select_channel(input) + found = false @channels.each do |channel| - if channel.name == input || channel.id == input - recipient = channel - @selected << recipient + if channel.name == input.downcase || channel.id == input + @recipient = channel + recipient + found = true break end end - if @selected == [] - raise ArgumentError.new("The provided name/id doesn't match any user") + if found == false + puts "The provided name/id doesn't match any channel" + sleep(0.5) end end def show_details - if @selected != [] - @selected.each do |recipient| - if recipient.class == Slack::User - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Real name: #{recipient.id}\n\n" + if @recipient != nil + if @recipient.class == Slack::User + puts "Name: #{@recipient.name}" + puts "Id: #{@recipient.id}" + puts "Real name: #{@recipient.real_name}\n\n" else recipient.class == Slack::Channel - topic = recipient.topic.values - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" - puts "Member count: #{recipient.member_count}\n\n" + puts "Name: #{@recipient.name}" + puts "Id: #{@recipient.id}" + puts "Topic: #{@recipient.topic.values[0]}" + puts "Member count: #{@recipient.member_count}\n\n" end - end - elsif @selected == [] - raise ArgumentError.new("No recipient is currently selected.") + else recipient == nil + puts "No recipient is currently selected." end end end From bf99630115e1614c26ad6d9f8d6400b39ba1b210 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Thu, 12 Sep 2019 22:16:44 -0700 Subject: [PATCH 14/27] Finished setting up sending a message to the channel --- api_driver.rb | 5 ----- lib/message.rb | 8 ++++---- lib/slack.rb | 25 +++++++++++++++++++++---- 3 files changed, 25 insertions(+), 13 deletions(-) delete mode 100644 api_driver.rb diff --git a/api_driver.rb b/api_driver.rb deleted file mode 100644 index 1d2bf913..00000000 --- a/api_driver.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'dotenv' -Dotenv.load -require_relative 'lib/slack_api_wrapper' - -SlackApi.send_msg("Hi there!", "sploots") \ No newline at end of file diff --git a/lib/message.rb b/lib/message.rb index b7319edb..eb42c69b 100644 --- a/lib/message.rb +++ b/lib/message.rb @@ -1,13 +1,13 @@ #lib/message.rb -require "HTTParty" +require "httparty" class SlackApiError < StandardError ; end -module SlackApi +module Slack BASE_URL = 'https://slack.com/api/' API_KEY = ENV['API_KEY'] - def self.send_msg(message, channel) + def self.send_msg(message, recipient) response = HTTParty.post( "#{BASE_URL}/chat.postMessage", @@ -22,7 +22,7 @@ def self.send_msg(message, channel) unless response.code == 200 && response.parsed_response["ok"] raise SlackApiError, "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" end - + return true end end \ No newline at end of file diff --git a/lib/slack.rb b/lib/slack.rb index abc1f7fc..123081ca 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -3,7 +3,10 @@ require "awesome_print" require "colorize" require "table_print" +require 'dotenv' require_relative "workspace" +require_relative 'message' +Dotenv.load def main @workspace = Slack::Workspace.new() @@ -23,10 +26,10 @@ def main case option when "list users", "1" tp @workspace.users, "name", "id", "real_name" - sleep(3) + sleep(2) when "list channels", "2" tp @workspace.channels, "name", "id", "topic", "member_count" - sleep(3) + sleep(2) when "select user", "3" puts "Please enter username or Slack ID" user_selection = gets.chomp @@ -37,9 +40,23 @@ def main @workspace.select_channel(channel_selection) when "details", "5" puts @workspace.show_details - sleep(3) + sleep(2) when "send message", "6" - + recipient = @workspace.recipient + if recipient.class == Slack::Channel + print "Please enter the message: " + message = gets.chomp + name = recipient.name + Slack.send_msg(message, name) + elsif recipient.class == Slack::User + print "Please enter the message: " + message = gets.chomp + name = recipient.name + Slack.send_msg(message, name) + else recipient == nil + puts "No recipient selected" + sleep(2) + end when "quit", "7" exit end From 66654ed2d66025c84062e7f41a52ffffdbcf8504 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Thu, 12 Sep 2019 23:13:08 -0700 Subject: [PATCH 15/27] created message to user --- lib/message.rb | 6 +++--- lib/slack.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/message.rb b/lib/message.rb index eb42c69b..9a725167 100644 --- a/lib/message.rb +++ b/lib/message.rb @@ -7,20 +7,20 @@ module Slack BASE_URL = 'https://slack.com/api/' API_KEY = ENV['API_KEY'] - def self.send_msg(message, recipient) + def self.send_msg(message, channel) response = HTTParty.post( "#{BASE_URL}/chat.postMessage", body: { token: API_KEY, text: message, - channel: channel + channel: "kjljk" }, headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } ) unless response.code == 200 && response.parsed_response["ok"] - raise SlackApiError, "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" + puts "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" end return true diff --git a/lib/slack.rb b/lib/slack.rb index 123081ca..4e6913d0 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -51,8 +51,8 @@ def main elsif recipient.class == Slack::User print "Please enter the message: " message = gets.chomp - name = recipient.name - Slack.send_msg(message, name) + id = recipient.id + Slack.send_msg(message, id) else recipient == nil puts "No recipient selected" sleep(2) From da83a78e3a95c088aea1e88a6bd4e8bce8963d5f Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Fri, 13 Sep 2019 12:02:33 -0700 Subject: [PATCH 16/27] Message working --- lib/channel.rb | 2 +- lib/message.rb | 4 ++-- lib/recipient.rb | 1 - lib/workspace.rb | 2 +- test/user_test.rb | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/channel.rb b/lib/channel.rb index 8a7439dd..2a97e858 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -23,7 +23,7 @@ def self.channels_list response.parsed_response["channels"].each do |channel| name = channel["name"] id = channel["id"] - topic = channel["topic"] + topic = channel["topic"]["value"] member_count = channel["num_members"] channel = Slack::Channel.new(name, id, topic, member_count) channels << channel diff --git a/lib/message.rb b/lib/message.rb index 9a725167..e1cefed0 100644 --- a/lib/message.rb +++ b/lib/message.rb @@ -1,7 +1,7 @@ #lib/message.rb require "httparty" -class SlackApiError < StandardError ; end +# class SlackApiError < StandardError ; end module Slack BASE_URL = 'https://slack.com/api/' @@ -14,7 +14,7 @@ def self.send_msg(message, channel) body: { token: API_KEY, text: message, - channel: "kjljk" + channel: channel }, headers: { 'Content-Type' => 'application/x-www-form-urlencoded' } ) diff --git a/lib/recipient.rb b/lib/recipient.rb index f1e694d7..c839d826 100644 --- a/lib/recipient.rb +++ b/lib/recipient.rb @@ -6,6 +6,5 @@ def initialize(name, id) @name = name @id = id end - end end diff --git a/lib/workspace.rb b/lib/workspace.rb index 3db8cbfe..fe831a89 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -54,7 +54,7 @@ def show_details else recipient.class == Slack::Channel puts "Name: #{@recipient.name}" puts "Id: #{@recipient.id}" - puts "Topic: #{@recipient.topic.values[0]}" + puts "Topic: #{@recipient.topic}" puts "Member count: #{@recipient.member_count}\n\n" end else recipient == nil diff --git a/test/user_test.rb b/test/user_test.rb index 65776d84..890204dc 100644 --- a/test/user_test.rb +++ b/test/user_test.rb @@ -1 +1 @@ -require_relative 'test_helper.rb' \ No newline at end of file +require_relative 'test_helper.rb' From 099722c0912ea94ed8dc6ebb376d820c809798f8 Mon Sep 17 00:00:00 2001 From: ohcloud Date: Fri, 13 Sep 2019 13:26:48 -0700 Subject: [PATCH 17/27] accepting all changes --- lib/channel.rb | 2 +- lib/message.rb | 10 ++-- lib/recipient.rb | 3 +- lib/slack.rb | 107 +++++++++++++++++++++++------------------ lib/workspace.rb | 62 +++++++++++++----------- test/channel_test.rb | 3 +- test/recipient_test.rb | 3 +- 7 files changed, 106 insertions(+), 84 deletions(-) diff --git a/lib/channel.rb b/lib/channel.rb index 8a7439dd..2a97e858 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -23,7 +23,7 @@ def self.channels_list response.parsed_response["channels"].each do |channel| name = channel["name"] id = channel["id"] - topic = channel["topic"] + topic = channel["topic"]["value"] member_count = channel["num_members"] channel = Slack::Channel.new(name, id, topic, member_count) channels << channel diff --git a/lib/message.rb b/lib/message.rb index b7319edb..63b38712 100644 --- a/lib/message.rb +++ b/lib/message.rb @@ -1,9 +1,9 @@ #lib/message.rb -require "HTTParty" +require "httparty" -class SlackApiError < StandardError ; end +# class SlackApiError < StandardError ; end -module SlackApi +module Slack BASE_URL = 'https://slack.com/api/' API_KEY = ENV['API_KEY'] @@ -20,9 +20,9 @@ def self.send_msg(message, channel) ) unless response.code == 200 && response.parsed_response["ok"] - raise SlackApiError, "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" + puts "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" end return true end -end \ No newline at end of file +end diff --git a/lib/recipient.rb b/lib/recipient.rb index f1e694d7..ffc0d213 100644 --- a/lib/recipient.rb +++ b/lib/recipient.rb @@ -6,6 +6,5 @@ def initialize(name, id) @name = name @id = id end - end -end +end \ No newline at end of file diff --git a/lib/slack.rb b/lib/slack.rb index 524296ee..6d66bd79 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,50 +1,65 @@ - #lib/slack.rb - require "httparty" - require "awesome_print" - require "colorize" - require "table_print" - - require_relative "workspace" - - def main - puts "Welcome to the Ada Slack CLI!".colorize(:color => :orange, :mode => :bold) +#lib/slack.rb +require "httparty" +require "awesome_print" +require "colorize" +require "table_print" +require 'dotenv' +require_relative "workspace" +require_relative 'message' +Dotenv.load + +def main @workspace = Slack::Workspace.new() - - puts "\nPlease Choose from the following options: - \n1. List Users - \n2. List Channels - \n3. Select User - \n4. Select Channel - \n5. Details - \n6. Send Message - \n7. Quit".colorize(:color => :purple, :mode => :bold) - - option = gets.chomp.downcase - - case option - when "list users" - tp @workspace.users, "name", "id", "real_name" - main - when "list channels" - tp @workspace.channels, "name", "id", "topic", "member_count" - main - when "select user" - puts "Please enter username or Slack ID" - user_selection = gets.chomp.downcase - puts @workspace.select_user(user_selection) - main - when "select channel" - puts "Please enter channel name or Slack ID" - channel_selection = gets.chomp.downcase - puts @workspace.select_channel(channel_selection) - main - when "details" - puts @workspace.show_details - main - when "quit" - exit - else - main + while true + puts "Welcome to the Ada Slack CLI!".colorize(:color => :orange, :mode => :bold) + puts "\nPlease Choose from the following options: + \n1. List Users + \n2. List Channels + \n3. Select User + \n4. Select Channel + \n5. Details + \n6. Send Message + \n7. Quit".colorize(:color => :purple, :mode => :bold) + + option = gets.chomp.downcase + + case option + when "list users", "1" + tp @workspace.users, "name", "id", "real_name" + sleep(2) + when "list channels", "2" + tp @workspace.channels, "name", "id", "topic", "member_count" + sleep(2) + when "select user", "3" + puts "Please enter username or Slack ID" + user_selection = gets.chomp + @workspace.select_user(user_selection) + when "select channel", "4" + puts "Please enter channel name or Slack ID" + channel_selection = gets.chomp + @workspace.select_channel(channel_selection) + when "details", "5" + puts @workspace.show_details + sleep(2) + when "send message", "6" + recipient = @workspace.recipient + if recipient.class == Slack::Channel + print "Please enter the message: " + message = gets.chomp + name = recipient.name + Slack.send_msg(message, name) + elsif recipient.class == Slack::User + print "Please enter the message: " + message = gets.chomp + id = recipient.id + Slack.send_msg(message, id) + else recipient == nil + puts "No recipient selected" + sleep(2) + end + when "quit", "7" + exit + end end puts "Thank you for using the Ada Slack CLI" end diff --git a/lib/workspace.rb b/lib/workspace.rb index be4bcf53..cee4bb3f 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -6,53 +6,59 @@ module Slack class Workspace - attr_reader :users, :channels, :selected + attr_reader :users, :channels, :recipient def initialize @users = User.users_list @channels = Channel.channels_list - @selected = [] + @recipient= nil end def select_user(input) + found = false @users.each do |user| - if user.name == input || user.id == input - recipient = user - @selected << recipient - return recipient - # else - # raise ArgumentError,"The provided name/id doesn't match any user" + if user.name == input.downcase || user.id == input + @recipient = user + found = true end end + + if found == false + puts "The provided name/id doesn't match any user" + sleep(0.5) + main + end end def select_channel(input) + found = false @channels.each do |channel| - if channel.name == input || channel.id == input - recipient = channel - @selected << recipient - else - raise ArgumentError.new("The provided name/id doesn't match any channel") + if channel.name == input.downcase || channel.id == input + @recipient = channel + recipient + found = true + break end end + if found == false + puts "The provided name/id doesn't match any channel" + sleep(0.5) + end end def show_details - if @selected != [] - @selected.each do |recipient| - if recipient.class == Slack::User - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Real name: #{recipient.id}\n\n" - else recipient.class == Slack::Channel - topic = recipient.topic.values - puts "Name: #{recipient.name}" - puts "Id: #{recipient.id}" - puts "Topic: #{recipient.topic.values[0]}, #{recipient.topic.values[1]}, #{recipient.topic.values[2]}" - puts "Member count: #{recipient.member_count}\n\n" - end + if @recipient != nil + if @recipient.class == Slack::User + puts "Name: #{@recipient.name}" + puts "Id: #{@recipient.id}" + puts "Real name: #{@recipient.real_name}\n\n" + else recipient.class == Slack::Channel + puts "Name: #{@recipient.name}" + puts "Id: #{@recipient.id}" + puts "Topic: #{@recipient.topic}" + puts "Member count: #{@recipient.member_count}\n\n" end - elsif @selected == [] - raise ArgumentError.new("No recipient is currently selected.") + else recipient == nil + puts "No recipient is currently selected." end end end diff --git a/test/channel_test.rb b/test/channel_test.rb index 65776d84..5497dc4b 100644 --- a/test/channel_test.rb +++ b/test/channel_test.rb @@ -1 +1,2 @@ -require_relative 'test_helper.rb' \ No newline at end of file +require_relative 'test_helper.rb' + diff --git a/test/recipient_test.rb b/test/recipient_test.rb index 65776d84..5497dc4b 100644 --- a/test/recipient_test.rb +++ b/test/recipient_test.rb @@ -1 +1,2 @@ -require_relative 'test_helper.rb' \ No newline at end of file +require_relative 'test_helper.rb' + From bb9ccde4f677300663fefdf5db035c7536a1c70c Mon Sep 17 00:00:00 2001 From: ohcloud Date: Fri, 13 Sep 2019 15:06:29 -0700 Subject: [PATCH 18/27] started testing for users and channels. all tests pass --- lib/slack.rb | 2 +- lib/user.rb | 1 - lib/workspace.rb | 4 +-- test/channel_test.rb | 29 +++++++++++++++++++++ test/test_helper.rb | 14 ++++++---- test/user_test.rb | 29 +++++++++++++++++++++ test/workspace_test.rb | 58 +++++++++++++++++++++++++++++++----------- 7 files changed, 113 insertions(+), 24 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index 6d66bd79..41f4fdf3 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -53,7 +53,7 @@ def main message = gets.chomp id = recipient.id Slack.send_msg(message, id) - else recipient == nil + else puts "No recipient selected" sleep(2) end diff --git a/lib/user.rb b/lib/user.rb index c4362b6b..6cc2748b 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -2,7 +2,6 @@ require 'httparty' require 'awesome_print' require 'dotenv' -require_relative "user" require_relative "recipient" Dotenv.load diff --git a/lib/workspace.rb b/lib/workspace.rb index cee4bb3f..3d95cf4d 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -51,13 +51,13 @@ def show_details puts "Name: #{@recipient.name}" puts "Id: #{@recipient.id}" puts "Real name: #{@recipient.real_name}\n\n" - else recipient.class == Slack::Channel + else puts "Name: #{@recipient.name}" puts "Id: #{@recipient.id}" puts "Topic: #{@recipient.topic}" puts "Member count: #{@recipient.member_count}\n\n" end - else recipient == nil + else puts "No recipient is currently selected." end end diff --git a/test/channel_test.rb b/test/channel_test.rb index 5497dc4b..ab79ac8b 100644 --- a/test/channel_test.rb +++ b/test/channel_test.rb @@ -1,2 +1,31 @@ require_relative 'test_helper.rb' + +describe "Channel class" do + + describe "Channel instantiation" do + before do + @channels = Slack::Channel.channels_list + end + + it "is an instance of Channel" do + expect(@channels.first).must_be_kind_of Slack::Channel + end + + it "returns an array of channels" do + expect(@channels).must_be_instance_of Array + end + + it "will return the first channel" do + expect(@channels.first.name).must_equal "pupper-pics" + expect(@channels.first.id).must_equal "CMUPUL1R9" + expect(@channels.first.topic).must_equal "doggy photoshoot" + expect(@channels.first.member_count).must_equal 6 + end + + + end #end of describe channel instantiation +end #end of class + + + diff --git a/test/test_helper.rb b/test/test_helper.rb index eace3b42..5fa921b3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,6 +3,7 @@ add_filter 'test/' end +require 'httparty' require 'minitest' require 'minitest/autorun' require 'minitest/reporters' @@ -11,12 +12,15 @@ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new -VCR.configure do |config| - config.cassette_library_dir = "test/cassettes" - config.hook_into :webmock -end +# VCR.configure do |config| +# config.cassette_library_dir = "test/cassettes" +# config.hook_into :webmock +# end require_relative "../lib/recipient.rb" require_relative "../lib/user.rb" require_relative "../lib/channel.rb" -require_relative "../lib/slack.rb" \ No newline at end of file +require_relative "../lib/slack.rb" +require_relative "../lib/workspace.rb" +require 'dotenv' +Dotenv.load \ No newline at end of file diff --git a/test/user_test.rb b/test/user_test.rb index 890204dc..04a10b39 100644 --- a/test/user_test.rb +++ b/test/user_test.rb @@ -1 +1,30 @@ require_relative 'test_helper.rb' + + +describe "User class" do + + describe "User instantiation" do + before do + @users = Slack::User.users_list + end + + it "is an instance of User" do + expect(@users.first).must_be_kind_of Slack::User + end + + it "returns an array of users" do + expect(@users).must_be_instance_of Array + end + + it "will return the first user" do + expect(@users.first.name).must_equal "slackbot" + expect(@users.first.id).must_equal "USLACKBOT" + expect(@users.first.real_name).must_equal "Slackbot" + end + + + end #end of describe user instantiation +end #end of class + + + diff --git a/test/workspace_test.rb b/test/workspace_test.rb index 6b0bc407..15505649 100644 --- a/test/workspace_test.rb +++ b/test/workspace_test.rb @@ -1,21 +1,49 @@ require_relative "test_helper" +# VCR.use_cassette("location_find") do -describe "API wrapper" - before do - VCR.use_cassette("location_find") do - - -describe "get_location" do - describe "get location" do - it " " do - location = " " - VCR.use_cassette("name") do - response = " " - end +describe "Workspace Class" do + + describe "Workspace Instantiation" do + before do + @workspace = Slack::Workspace.new + end + + it "will haver 7 users" do + expect(@workspace.users.count).must_equal 7 + end + + it "knows that each user is an instance of user" do + expect(@workspace.users.first).must_be_instance_of Slack::User + end + + it "will be an instance of channel" do + expect(@workspace.channels.count).must_equal 4 + end + + it "each channel will be an instance of channel" do + expect(@workspace.channels.first).must_be_instance_of Slack::Channel + end + end #end of describe workspace instantiation + + describe "Workspace's Select User" do + before do + @workspace = Slack::Workspace.new end - end -end + + # it "will find the user" do + # expect(@workspace.select_user("dnsanche")).must_ + # end + + + + end #end of workspace select user block + + + + + +end #end of workspace class # the name is the name if the cassete we want to specify. If we don't have that cassete created, it will be created automatically. -#i'm using location based on the example of the class, but we need to update it. +# i'm using location based on the example of the class, but we need to update it. From a51f1f5c0e9167189e8f405d11868edc8a824110 Mon Sep 17 00:00:00 2001 From: ohcloud Date: Fri, 13 Sep 2019 15:31:46 -0700 Subject: [PATCH 19/27] added more tests. whoohooo, --- lib/workspace.rb | 1 + test/slack_test.rb | 3 ++- test/workspace_test.rb | 13 ++++--------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/workspace.rb b/lib/workspace.rb index 3d95cf4d..56435eae 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -27,6 +27,7 @@ def select_user(input) sleep(0.5) main end + return found end def select_channel(input) diff --git a/test/slack_test.rb b/test/slack_test.rb index 65776d84..5497dc4b 100644 --- a/test/slack_test.rb +++ b/test/slack_test.rb @@ -1 +1,2 @@ -require_relative 'test_helper.rb' \ No newline at end of file +require_relative 'test_helper.rb' + diff --git a/test/workspace_test.rb b/test/workspace_test.rb index 15505649..f7f77f33 100644 --- a/test/workspace_test.rb +++ b/test/workspace_test.rb @@ -30,18 +30,13 @@ @workspace = Slack::Workspace.new end - # it "will find the user" do - # expect(@workspace.select_user("dnsanche")).must_ - # end - - - + it "will find the selected user in the list" do + this_user = @workspace.select_user("dnsanche") + expect(this_user).must_equal true + end end #end of workspace select user block - - - end #end of workspace class # the name is the name if the cassete we want to specify. If we don't have that cassete created, it will be created automatically. From b0ffc4cc608aad65cec78fcec1373ba808002f74 Mon Sep 17 00:00:00 2001 From: ohcloud Date: Fri, 13 Sep 2019 16:12:00 -0700 Subject: [PATCH 20/27] completing testing, incoming weird errors, were trying to work out the kinks --- lib/workspace.rb | 2 +- test/workspace_test.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/workspace.rb b/lib/workspace.rb index 56435eae..76bbeced 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -25,7 +25,6 @@ def select_user(input) if found == false puts "The provided name/id doesn't match any user" sleep(0.5) - main end return found end @@ -44,6 +43,7 @@ def select_channel(input) puts "The provided name/id doesn't match any channel" sleep(0.5) end + return found end def show_details diff --git a/test/workspace_test.rb b/test/workspace_test.rb index f7f77f33..e814b22f 100644 --- a/test/workspace_test.rb +++ b/test/workspace_test.rb @@ -33,9 +33,33 @@ it "will find the selected user in the list" do this_user = @workspace.select_user("dnsanche") expect(this_user).must_equal true + this_user = @workspace.select_user("USLACKBOT").must_equal true + end + + it "will return false if username entered is invalid" do + this_user = @workspace.select_user("GDFG") + expect(this_user).must_equal false end end #end of workspace select user block + describe "Workspace's Select Channel" do + before do + @workspace = Slack::Workspace.new + end + + it "will find the selected channel in the list" do + this_channel = @workspace.select_channel("random") + expect(this_channel).must_equal true + this_channel = @workspace.select_channel("CMUPUL1R9").must_equal true + end + + it "will return false if username entered is invalid" do + this_channel = @workspace.select_channel("GDFG") + expect(this_channel).must_equal false + end + + end #end for workspace select channel + end #end of workspace class From 30148ba19882139d3fc001f217f70f455e078c75 Mon Sep 17 00:00:00 2001 From: ohcloud Date: Fri, 13 Sep 2019 16:50:52 -0700 Subject: [PATCH 21/27] Added VCR and finshed some tests in workspace --- test/cassettes/Channel_instantiation.yml | 84 ++++++++++++ test/cassettes/User_instantiation.yml | 86 ++++++++++++ test/cassettes/channels_list.yml | 167 +++++++++++++++++++++++ test/cassettes/select_users.yml | 167 +++++++++++++++++++++++ test/cassettes/users_list.yml | 167 +++++++++++++++++++++++ test/channel_test.rb | 2 + test/test_helper.rb | 8 +- test/user_test.rb | 9 +- test/workspace_test.rb | 16 ++- 9 files changed, 697 insertions(+), 9 deletions(-) create mode 100644 test/cassettes/Channel_instantiation.yml create mode 100644 test/cassettes/User_instantiation.yml create mode 100644 test/cassettes/channels_list.yml create mode 100644 test/cassettes/select_users.yml create mode 100644 test/cassettes/users_list.yml diff --git a/test/cassettes/Channel_instantiation.yml b/test/cassettes/Channel_instantiation.yml new file mode 100644 index 00000000..de819cfe --- /dev/null +++ b/test/cassettes/Channel_instantiation.yml @@ -0,0 +1,84 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/channels.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d + 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: + - '696' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 23:49:20 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 52bb1148-c6e0-4ca6-89a1-bba73e0aa56d + X-Oauth-Scopes: + - identify,channels: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-icfx + X-Cache: + - Miss from cloudfront + Via: + - 1.1 6b03f32d70ff9f666371f69d2672d273.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - DSBXVb8BdXUUSRD1m2HfNJUOlCcZG5GsN-NQbU6GoftYt6MIBn2wgg== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 23:49:18 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/User_instantiation.yml b/test/cassettes/User_instantiation.yml new file mode 100644 index 00000000..23769c2a --- /dev/null +++ b/test/cassettes/User_instantiation.yml @@ -0,0 +1,86 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d + 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: + - '1506' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 23:45:00 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 1796b98c-308d-455b-9d47-80d14fd7e784 + X-Oauth-Scopes: + - identify,channels: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-abpg + X-Cache: + - Miss from cloudfront + Via: + - 1.1 5565a51537c689d1d16f6b4d41f40082.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - rnqSfYvpRIBDVsj_Aq6g8zai3W7bftYcXMYgi82VXa4xxr9amnbcAw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045,"has_2fa":false},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568418300,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 23:44:58 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/channels_list.yml b/test/cassettes/channels_list.yml new file mode 100644 index 00000000..763ea2da --- /dev/null +++ b/test/cassettes/channels_list.yml @@ -0,0 +1,167 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d + 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: + - '1506' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 23:39:10 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - cb92bdaa-1a8c-4729-973f-71488b17563d + X-Oauth-Scopes: + - identify,channels: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-4mq5 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 0a2ce08fa1ec3c33302a7547d3305978.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - u9LJTeslkSz8U5NTK_YimuBUS8QcJq2He7tfi6jTs8whMdvNaxyy8A== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045,"has_2fa":false},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568417950,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 23:39:09 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d + 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: + - '696' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 23:39:10 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 24942efb-6f14-47b0-bab4-b5c68b79afbb + X-Oauth-Scopes: + - identify,channels: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-2gtq + X-Cache: + - Miss from cloudfront + Via: + - 1.1 4d8620b80ebe37d366388e117039aa8e.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - ZPlRtSJkuiUfsITaZbh5l4BA9jmq6H8mloT87yLYd6-1-UZFBrhEDA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 23:39:09 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/select_users.yml b/test/cassettes/select_users.yml new file mode 100644 index 00000000..cbc3e896 --- /dev/null +++ b/test/cassettes/select_users.yml @@ -0,0 +1,167 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d + 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: + - '1506' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 23:39:09 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 4e1b71f1-31f9-4ef7-8515-42620279669a + X-Oauth-Scopes: + - identify,channels: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-admz + X-Cache: + - Miss from cloudfront + Via: + - 1.1 ef6538ee7be7b17c84d06edb0f4c0a1a.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - IzAKMVq14uvFYflvKQzM_LrePBRui889q5y65HeMHNfMwAkXakrb3Q== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045,"has_2fa":false},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568417949,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 23:39:08 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d + 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: + - '696' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 23:39:10 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - a94c458e-6d37-47c4-95e5-39fe4695ccbf + X-Oauth-Scopes: + - identify,channels: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-admz + X-Cache: + - Miss from cloudfront + Via: + - 1.1 b838ef1ff22a4a994af82d5178c30e1d.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - CXFax6bl1-8IeC-wkgfEIQkfvvl3nvh1EEsMxdCwGCRi1Xqx8IjqDQ== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 23:39:08 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/users_list.yml b/test/cassettes/users_list.yml new file mode 100644 index 00000000..448f880f --- /dev/null +++ b/test/cassettes/users_list.yml @@ -0,0 +1,167 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d + 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: + - '1506' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 23:39:09 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 97a84579-96f8-4f29-b3df-dbf188456771 + X-Oauth-Scopes: + - identify,channels: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-lwyj + X-Cache: + - Miss from cloudfront + Via: + - 1.1 82ee5868f58a60e97a683c1fda270de3.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - i0zP1z6YIMvyNZQAEHEoJkHBhlFvVhMrVbQm_PlVs_3cO1vOxbi1qA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045,"has_2fa":false},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568417949,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 23:39:08 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d + 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: + - '696' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 23:39:09 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 2e1f97ce-b6bb-4963-a304-e81235f32871 + X-Oauth-Scopes: + - identify,channels: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-fdpw + X-Cache: + - Miss from cloudfront + Via: + - 1.1 49cdeca097624936e070b73619df7da9.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - ShmzTZ1eKSgLXdTHFIV7rNPmVP0sL0UB1PAqDBx0plGkV9Gmg-JZmA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 23:39:08 GMT +recorded_with: VCR 5.0.0 diff --git a/test/channel_test.rb b/test/channel_test.rb index ab79ac8b..810acf2d 100644 --- a/test/channel_test.rb +++ b/test/channel_test.rb @@ -5,8 +5,10 @@ describe "Channel instantiation" do before do + VCR.use_cassette("Channel_instantiation") do @channels = Slack::Channel.channels_list end + end it "is an instance of Channel" do expect(@channels.first).must_be_kind_of Slack::Channel diff --git a/test/test_helper.rb b/test/test_helper.rb index 5fa921b3..4a0900f7 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -12,10 +12,10 @@ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new -# VCR.configure do |config| -# config.cassette_library_dir = "test/cassettes" -# config.hook_into :webmock -# end +VCR.configure do |config| + config.cassette_library_dir = "test/cassettes" + config.hook_into :webmock +end require_relative "../lib/recipient.rb" require_relative "../lib/user.rb" diff --git a/test/user_test.rb b/test/user_test.rb index 04a10b39..bbe3d705 100644 --- a/test/user_test.rb +++ b/test/user_test.rb @@ -5,7 +5,14 @@ describe "User instantiation" do before do - @users = Slack::User.users_list + # In our tests, to use VCR, we do the following: + # 1. Find every line in the tests that will make a request + # (In this case, it's Slack::User.users_list) + + # 2. We wrap those lines in this syntax + VCR.use_cassette("User_instantiation") do + @users = Slack::User.users_list + end end it "is an instance of User" do diff --git a/test/workspace_test.rb b/test/workspace_test.rb index e814b22f..367f37b9 100644 --- a/test/workspace_test.rb +++ b/test/workspace_test.rb @@ -1,11 +1,13 @@ require_relative "test_helper" -# VCR.use_cassette("location_find") do +# VCR.use_cassette("location_find") do describe "Workspace Class" do describe "Workspace Instantiation" do before do - @workspace = Slack::Workspace.new + VCR.use_cassette("users_list") do + @workspace = Slack::Workspace.new + end end it "will haver 7 users" do @@ -27,7 +29,9 @@ describe "Workspace's Select User" do before do - @workspace = Slack::Workspace.new + VCR.use_cassette("select_users") do + @workspace = Slack::Workspace.new + end end it "will find the selected user in the list" do @@ -44,7 +48,9 @@ describe "Workspace's Select Channel" do before do - @workspace = Slack::Workspace.new + VCR.use_cassette("channels_list") do + @workspace = Slack::Workspace.new + end end it "will find the selected channel in the list" do @@ -58,6 +64,8 @@ expect(this_channel).must_equal false end + + end #end for workspace select channel From 5f33fb15601ce60e27f5c9555698415abde24b8c Mon Sep 17 00:00:00 2001 From: ohcloud Date: Fri, 13 Sep 2019 17:05:41 -0700 Subject: [PATCH 22/27] going to update token. have deleted it as its now disabled --- lib/workspace.rb | 66 --------- test/cassettes/Channel_instantiation.yml | 84 ------------ test/cassettes/User_instantiation.yml | 86 ------------ test/cassettes/channels_list.yml | 167 ----------------------- test/cassettes/select_users.yml | 167 ----------------------- test/cassettes/users_list.yml | 167 ----------------------- test/test_helper.rb | 12 +- 7 files changed, 10 insertions(+), 739 deletions(-) delete mode 100644 lib/workspace.rb delete mode 100644 test/cassettes/Channel_instantiation.yml delete mode 100644 test/cassettes/User_instantiation.yml delete mode 100644 test/cassettes/channels_list.yml delete mode 100644 test/cassettes/select_users.yml delete mode 100644 test/cassettes/users_list.yml diff --git a/lib/workspace.rb b/lib/workspace.rb deleted file mode 100644 index 76bbeced..00000000 --- a/lib/workspace.rb +++ /dev/null @@ -1,66 +0,0 @@ -#lib/workspace.rb -require 'httparty' -require 'awesome_print' -require_relative "user" -require_relative "channel" - -module Slack - class Workspace - attr_reader :users, :channels, :recipient - def initialize - @users = User.users_list - @channels = Channel.channels_list - @recipient= nil - end - - def select_user(input) - found = false - @users.each do |user| - if user.name == input.downcase || user.id == input - @recipient = user - found = true - end - end - - if found == false - puts "The provided name/id doesn't match any user" - sleep(0.5) - end - return found - end - - def select_channel(input) - found = false - @channels.each do |channel| - if channel.name == input.downcase || channel.id == input - @recipient = channel - recipient - found = true - break - end - end - if found == false - puts "The provided name/id doesn't match any channel" - sleep(0.5) - end - return found - end - - def show_details - if @recipient != nil - if @recipient.class == Slack::User - puts "Name: #{@recipient.name}" - puts "Id: #{@recipient.id}" - puts "Real name: #{@recipient.real_name}\n\n" - else - puts "Name: #{@recipient.name}" - puts "Id: #{@recipient.id}" - puts "Topic: #{@recipient.topic}" - puts "Member count: #{@recipient.member_count}\n\n" - end - else - puts "No recipient is currently selected." - end - end - end -end \ No newline at end of file diff --git a/test/cassettes/Channel_instantiation.yml b/test/cassettes/Channel_instantiation.yml deleted file mode 100644 index de819cfe..00000000 --- a/test/cassettes/Channel_instantiation.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://slack.com/api/channels.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d - 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: - - '696' - Connection: - - keep-alive - Date: - - Fri, 13 Sep 2019 23:49:20 GMT - Server: - - Apache - X-Content-Type-Options: - - nosniff - X-Slack-Req-Id: - - 52bb1148-c6e0-4ca6-89a1-bba73e0aa56d - X-Oauth-Scopes: - - identify,channels: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-icfx - X-Cache: - - Miss from cloudfront - Via: - - 1.1 6b03f32d70ff9f666371f69d2672d273.cloudfront.net (CloudFront) - X-Amz-Cf-Pop: - - SEA19-C1 - X-Amz-Cf-Id: - - DSBXVb8BdXUUSRD1m2HfNJUOlCcZG5GsN-NQbU6GoftYt6MIBn2wgg== - body: - encoding: ASCII-8BIT - string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy - photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To - share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy - butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look - at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide - announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This - channel is for workspace-wide communication and announcements. All members - are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work - banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' - http_version: - recorded_at: Fri, 13 Sep 2019 23:49:18 GMT -recorded_with: VCR 5.0.0 diff --git a/test/cassettes/User_instantiation.yml b/test/cassettes/User_instantiation.yml deleted file mode 100644 index 23769c2a..00000000 --- a/test/cassettes/User_instantiation.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://slack.com/api/users.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d - 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: - - '1506' - Connection: - - keep-alive - Date: - - Fri, 13 Sep 2019 23:45:00 GMT - Server: - - Apache - X-Content-Type-Options: - - nosniff - X-Slack-Req-Id: - - 1796b98c-308d-455b-9d47-80d14fd7e784 - X-Oauth-Scopes: - - identify,channels: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-abpg - X-Cache: - - Miss from cloudfront - Via: - - 1.1 5565a51537c689d1d16f6b4d41f40082.cloudfront.net (CloudFront) - X-Amz-Cf-Pop: - - SEA19-C2 - X-Amz-Cf-Id: - - rnqSfYvpRIBDVsj_Aq6g8zai3W7bftYcXMYgi82VXa4xxr9amnbcAw== - body: - encoding: ASCII-8BIT - string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina - M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina - M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela - Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela - Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela - Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy - Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy - Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy - Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045,"has_2fa":false},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568418300,"response_metadata":{"next_cursor":""}}' - http_version: - recorded_at: Fri, 13 Sep 2019 23:44:58 GMT -recorded_with: VCR 5.0.0 diff --git a/test/cassettes/channels_list.yml b/test/cassettes/channels_list.yml deleted file mode 100644 index 763ea2da..00000000 --- a/test/cassettes/channels_list.yml +++ /dev/null @@ -1,167 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://slack.com/api/users.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d - 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: - - '1506' - Connection: - - keep-alive - Date: - - Fri, 13 Sep 2019 23:39:10 GMT - Server: - - Apache - X-Content-Type-Options: - - nosniff - X-Slack-Req-Id: - - cb92bdaa-1a8c-4729-973f-71488b17563d - X-Oauth-Scopes: - - identify,channels: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-4mq5 - X-Cache: - - Miss from cloudfront - Via: - - 1.1 0a2ce08fa1ec3c33302a7547d3305978.cloudfront.net (CloudFront) - X-Amz-Cf-Pop: - - SEA19-C1 - X-Amz-Cf-Id: - - u9LJTeslkSz8U5NTK_YimuBUS8QcJq2He7tfi6jTs8whMdvNaxyy8A== - body: - encoding: ASCII-8BIT - string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina - M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina - M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela - Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela - Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela - Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy - Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy - Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy - Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045,"has_2fa":false},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568417950,"response_metadata":{"next_cursor":""}}' - http_version: - recorded_at: Fri, 13 Sep 2019 23:39:09 GMT -- request: - method: get - uri: https://slack.com/api/channels.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d - 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: - - '696' - Connection: - - keep-alive - Date: - - Fri, 13 Sep 2019 23:39:10 GMT - Server: - - Apache - X-Content-Type-Options: - - nosniff - X-Slack-Req-Id: - - 24942efb-6f14-47b0-bab4-b5c68b79afbb - X-Oauth-Scopes: - - identify,channels: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-2gtq - X-Cache: - - Miss from cloudfront - Via: - - 1.1 4d8620b80ebe37d366388e117039aa8e.cloudfront.net (CloudFront) - X-Amz-Cf-Pop: - - SEA19-C1 - X-Amz-Cf-Id: - - ZPlRtSJkuiUfsITaZbh5l4BA9jmq6H8mloT87yLYd6-1-UZFBrhEDA== - body: - encoding: ASCII-8BIT - string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy - photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To - share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy - butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look - at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide - announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This - channel is for workspace-wide communication and announcements. All members - are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work - banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' - http_version: - recorded_at: Fri, 13 Sep 2019 23:39:09 GMT -recorded_with: VCR 5.0.0 diff --git a/test/cassettes/select_users.yml b/test/cassettes/select_users.yml deleted file mode 100644 index cbc3e896..00000000 --- a/test/cassettes/select_users.yml +++ /dev/null @@ -1,167 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://slack.com/api/users.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d - 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: - - '1506' - Connection: - - keep-alive - Date: - - Fri, 13 Sep 2019 23:39:09 GMT - Server: - - Apache - X-Content-Type-Options: - - nosniff - X-Slack-Req-Id: - - 4e1b71f1-31f9-4ef7-8515-42620279669a - X-Oauth-Scopes: - - identify,channels: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-admz - X-Cache: - - Miss from cloudfront - Via: - - 1.1 ef6538ee7be7b17c84d06edb0f4c0a1a.cloudfront.net (CloudFront) - X-Amz-Cf-Pop: - - SEA19-C1 - X-Amz-Cf-Id: - - IzAKMVq14uvFYflvKQzM_LrePBRui889q5y65HeMHNfMwAkXakrb3Q== - body: - encoding: ASCII-8BIT - string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina - M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina - M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela - Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela - Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela - Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy - Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy - Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy - Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045,"has_2fa":false},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568417949,"response_metadata":{"next_cursor":""}}' - http_version: - recorded_at: Fri, 13 Sep 2019 23:39:08 GMT -- request: - method: get - uri: https://slack.com/api/channels.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d - 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: - - '696' - Connection: - - keep-alive - Date: - - Fri, 13 Sep 2019 23:39:10 GMT - Server: - - Apache - X-Content-Type-Options: - - nosniff - X-Slack-Req-Id: - - a94c458e-6d37-47c4-95e5-39fe4695ccbf - X-Oauth-Scopes: - - identify,channels: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-admz - X-Cache: - - Miss from cloudfront - Via: - - 1.1 b838ef1ff22a4a994af82d5178c30e1d.cloudfront.net (CloudFront) - X-Amz-Cf-Pop: - - SEA19-C1 - X-Amz-Cf-Id: - - CXFax6bl1-8IeC-wkgfEIQkfvvl3nvh1EEsMxdCwGCRi1Xqx8IjqDQ== - body: - encoding: ASCII-8BIT - string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy - photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To - share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy - butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look - at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide - announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This - channel is for workspace-wide communication and announcements. All members - are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work - banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' - http_version: - recorded_at: Fri, 13 Sep 2019 23:39:08 GMT -recorded_with: VCR 5.0.0 diff --git a/test/cassettes/users_list.yml b/test/cassettes/users_list.yml deleted file mode 100644 index 448f880f..00000000 --- a/test/cassettes/users_list.yml +++ /dev/null @@ -1,167 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://slack.com/api/users.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d - 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: - - '1506' - Connection: - - keep-alive - Date: - - Fri, 13 Sep 2019 23:39:09 GMT - Server: - - Apache - X-Content-Type-Options: - - nosniff - X-Slack-Req-Id: - - 97a84579-96f8-4f29-b3df-dbf188456771 - X-Oauth-Scopes: - - identify,channels: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-lwyj - X-Cache: - - Miss from cloudfront - Via: - - 1.1 82ee5868f58a60e97a683c1fda270de3.cloudfront.net (CloudFront) - X-Amz-Cf-Pop: - - SEA19-C1 - X-Amz-Cf-Id: - - i0zP1z6YIMvyNZQAEHEoJkHBhlFvVhMrVbQm_PlVs_3cO1vOxbi1qA== - body: - encoding: ASCII-8BIT - string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina - M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina - M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela - Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela - Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela - Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy - Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy - Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy - Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045,"has_2fa":false},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568417949,"response_metadata":{"next_cursor":""}}' - http_version: - recorded_at: Fri, 13 Sep 2019 23:39:08 GMT -- request: - method: get - uri: https://slack.com/api/channels.list?token=xoxp-756139939207-754324678816-756443124580-b643c8aae168abc8d04b89376a7ec93d - 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: - - '696' - Connection: - - keep-alive - Date: - - Fri, 13 Sep 2019 23:39:09 GMT - Server: - - Apache - X-Content-Type-Options: - - nosniff - X-Slack-Req-Id: - - 2e1f97ce-b6bb-4963-a304-e81235f32871 - X-Oauth-Scopes: - - identify,channels: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-fdpw - X-Cache: - - Miss from cloudfront - Via: - - 1.1 49cdeca097624936e070b73619df7da9.cloudfront.net (CloudFront) - X-Amz-Cf-Pop: - - SEA19-C1 - X-Amz-Cf-Id: - - ShmzTZ1eKSgLXdTHFIV7rNPmVP0sL0UB1PAqDBx0plGkV9Gmg-JZmA== - body: - encoding: ASCII-8BIT - string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy - photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To - share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy - butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look - at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide - announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This - channel is for workspace-wide communication and announcements. All members - are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work - banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' - http_version: - recorded_at: Fri, 13 Sep 2019 23:39:08 GMT -recorded_with: VCR 5.0.0 diff --git a/test/test_helper.rb b/test/test_helper.rb index 4a0900f7..93ff4c41 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -13,8 +13,16 @@ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new VCR.configure do |config| - config.cassette_library_dir = "test/cassettes" - config.hook_into :webmock + config.cassette_library_dir = "test/cassettes" # folder where casettes will be located + config.hook_into :webmock # tie into this other tool called webmock + config.default_cassette_options = { + :record => :new_episodes, # record new data when we don't have it yet + :match_requests_on => [:method, :uri, :body], # The http method, URI and body of a request all need to match + } + # Don't leave our token lying around in a cassette file. + config.filter_sensitive_data("") do + ENV["API_TOKEN"] + end end require_relative "../lib/recipient.rb" From 30d5654acf24475122eaf2e97ecbca6838117844 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Fri, 13 Sep 2019 17:14:54 -0700 Subject: [PATCH 23/27] Added workspace again --- lib/workspace.rb | 66 +++++++++++++++++++++++++++++++++++++++++++++ test/test_helper.rb | 4 +-- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 lib/workspace.rb diff --git a/lib/workspace.rb b/lib/workspace.rb new file mode 100644 index 00000000..878fae90 --- /dev/null +++ b/lib/workspace.rb @@ -0,0 +1,66 @@ +#lib/workspace.rb +require 'httparty' +require 'awesome_print' +require_relative "user" +require_relative "channel" + +module Slack + class Workspace + attr_reader :users, :channels, :recipient + def initialize + @users = User.users_list + @channels = Channel.channels_list + @recipient= nil + end + + def select_user(input) + found = false + @users.each do |user| + if user.name == input.downcase || user.id == input + @recipient = user + found = true + end + end + + if found == false + puts "The provided name/id doesn't match any user" + sleep(0.5) + end + return found + end + + def select_channel(input) + found = false + @channels.each do |channel| + if channel.name == input.downcase || channel.id == input + @recipient = channel + recipient + found = true + break + end + end + if found == false + puts "The provided name/id doesn't match any channel" + sleep(0.5) + end + return found + end + + def show_details + if @recipient != nil + if @recipient.class == Slack::User + puts "Name: #{@recipient.name}" + puts "Id: #{@recipient.id}" + puts "Real name: #{@recipient.real_name}\n\n" + else + puts "Name: #{@recipient.name}" + puts "Id: #{@recipient.id}" + puts "Topic: #{@recipient.topic}" + puts "Member count: #{@recipient.member_count}\n\n" + end + else + puts "No recipient is currently selected." + end + end + end +end \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index 93ff4c41..82b05d9e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -20,8 +20,8 @@ :match_requests_on => [:method, :uri, :body], # The http method, URI and body of a request all need to match } # Don't leave our token lying around in a cassette file. - config.filter_sensitive_data("") do - ENV["API_TOKEN"] + config.filter_sensitive_data("API_KEY") do + ENV["API_KEY"] end end From 7876ed7e7d344406c3e36d8c219dcca52d535ab8 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Fri, 13 Sep 2019 17:16:11 -0700 Subject: [PATCH 24/27] Added the cassetes we lost due token publishing --- test/cassettes/Channel_instantiation.yml | 84 ++++++++++++ test/cassettes/User_instantiation.yml | 86 ++++++++++++ test/cassettes/channels_list.yml | 167 +++++++++++++++++++++++ test/cassettes/select_users.yml | 167 +++++++++++++++++++++++ test/cassettes/users_list.yml | 167 +++++++++++++++++++++++ 5 files changed, 671 insertions(+) create mode 100644 test/cassettes/Channel_instantiation.yml create mode 100644 test/cassettes/User_instantiation.yml create mode 100644 test/cassettes/channels_list.yml create mode 100644 test/cassettes/select_users.yml create mode 100644 test/cassettes/users_list.yml diff --git a/test/cassettes/Channel_instantiation.yml b/test/cassettes/Channel_instantiation.yml new file mode 100644 index 00000000..e68a1c97 --- /dev/null +++ b/test/cassettes/Channel_instantiation.yml @@ -0,0 +1,84 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/channels.list?token=API_KEY + 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: + - '696' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 00:15:09 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 9697ad1f-6941-471a-989d-52cd8aaf4210 + X-Oauth-Scopes: + - identify,channels: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-oawk + X-Cache: + - Miss from cloudfront + Via: + - 1.1 c9b161639a9353c2354b895548ea9fca.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - KikW_A8H0T4vHQs3ncrSNAob1OOqIpQWfVJ81SiO6MicTxVAxOu6Uw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 00:15:09 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/User_instantiation.yml b/test/cassettes/User_instantiation.yml new file mode 100644 index 00000000..ec0f8536 --- /dev/null +++ b/test/cassettes/User_instantiation.yml @@ -0,0 +1,86 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=API_KEY + 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: + - '1507' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 00:15:10 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 3f2033b2-6144-42b6-aa2b-ac876ae72afb + X-Oauth-Scopes: + - identify,channels: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-tucf + X-Cache: + - Miss from cloudfront + Via: + - 1.1 44cd593d82a2d200a94217033c614c6a.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - XsFxTYPMc3uvFSs1LvhKJ-buFpeRu_wELJBILa8E5OOzjzaQgpKNOg== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127,"has_2fa":false},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568420110,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 00:15:10 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/channels_list.yml b/test/cassettes/channels_list.yml new file mode 100644 index 00000000..d2307352 --- /dev/null +++ b/test/cassettes/channels_list.yml @@ -0,0 +1,167 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=API_KEY + 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: + - '1507' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 00:15:10 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 3f71624a-beba-4582-a42e-930c23af0a1a + X-Oauth-Scopes: + - identify,channels: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-n83k + X-Cache: + - Miss from cloudfront + Via: + - 1.1 d042f60a962591f741406f28a8170c5a.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - MbVCKUFdGdoWgxHAZdMSa0NgBcRS3qkDmESP00DM2XXvoYaIQHp_5g== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127,"has_2fa":false},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568420110,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 00:15:10 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token=API_KEY + 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: + - '696' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 00:15:10 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 13429a49-abd3-43dd-86b0-69cd573ca307 + X-Oauth-Scopes: + - identify,channels: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-nvih + X-Cache: + - Miss from cloudfront + Via: + - 1.1 aabd01c4a20dae837d162bd972422efc.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - LHs8I5ZPuAN2mp3ATxxrGO5MGGaPmJ8FjY4gxykyYRKdhgmT3O8EvA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 00:15:10 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/select_users.yml b/test/cassettes/select_users.yml new file mode 100644 index 00000000..79edcbc9 --- /dev/null +++ b/test/cassettes/select_users.yml @@ -0,0 +1,167 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=API_KEY + 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: + - '1507' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 00:15:11 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - d56bf23f-3c13-4b37-9717-972906c80d3a + X-Oauth-Scopes: + - identify,channels: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-kwrx + X-Cache: + - Miss from cloudfront + Via: + - 1.1 8ae6af4d17aae7471e5fe2792eb6abcd.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - a-nsYSc-MH8aRlMhW0FY8hbu6IvSCYQ2iEZB-xTqnmZBRQBodLhH_g== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127,"has_2fa":false},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568420111,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 00:15:11 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token=API_KEY + 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: + - '696' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 00:15:11 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - a8b53d41-f4fa-4989-9c53-89de5ad0392b + X-Oauth-Scopes: + - identify,channels: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-jtdn + X-Cache: + - Miss from cloudfront + Via: + - 1.1 1ec2938341958d70d56193d709c89def.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - OJv-w375zvkAR59B0--1NdalNjdBidzpEHLcUtNBuh_jT_wH0tAZSw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 00:15:11 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/users_list.yml b/test/cassettes/users_list.yml new file mode 100644 index 00000000..7c728651 --- /dev/null +++ b/test/cassettes/users_list.yml @@ -0,0 +1,167 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=API_KEY + 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: + - '1507' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 00:15:09 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - b06ec101-37f6-41e0-8c48-fd157edfc212 + X-Oauth-Scopes: + - identify,channels: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-xtep + X-Cache: + - Miss from cloudfront + Via: + - 1.1 1002c05e647d0804e83147cdd205d14a.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - r1jsWfrKWkdz9xktes46GVygCp7SHmquvjb20xqrH1B2Vbub2DN5hQ== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127,"has_2fa":false},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568420109,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 00:15:09 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token=API_KEY + 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: + - '696' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 00:15:10 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 1fc224f9-f316-4827-88ef-8b7fb1903202 + X-Oauth-Scopes: + - identify,channels: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-w4yr + X-Cache: + - Miss from cloudfront + Via: + - 1.1 ef6538ee7be7b17c84d06edb0f4c0a1a.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - WAccUX33Ggb4b3bTIc_GPiI5t8sJD0mDGyZ2ncm0oPVxMbZnYG6Xqw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 00:15:09 GMT +recorded_with: VCR 5.0.0 From 99c9d3b60dae5525b94c1c7a55ce3c19907cb984 Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Fri, 13 Sep 2019 19:09:20 -0700 Subject: [PATCH 25/27] Finished tests for details --- lib/workspace.rb | 13 +-- test/cassettes/channels_list.yml | 32 +++--- test/cassettes/select_users.yml | 32 +++--- test/cassettes/show_details.yml | 167 +++++++++++++++++++++++++++++++ test/workspace_test.rb | 65 ++++++++++-- 5 files changed, 261 insertions(+), 48 deletions(-) create mode 100644 test/cassettes/show_details.yml diff --git a/lib/workspace.rb b/lib/workspace.rb index 878fae90..5f3c759f 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -47,20 +47,17 @@ def select_channel(input) end def show_details + details = "" if @recipient != nil if @recipient.class == Slack::User - puts "Name: #{@recipient.name}" - puts "Id: #{@recipient.id}" - puts "Real name: #{@recipient.real_name}\n\n" + details = "Name: #{@recipient.name}, Id: #{@recipient.id}, Real name: #{@recipient.real_name}\n\n" else - puts "Name: #{@recipient.name}" - puts "Id: #{@recipient.id}" - puts "Topic: #{@recipient.topic}" - puts "Member count: #{@recipient.member_count}\n\n" + details = "Name: #{@recipient.name}, Id: #{@recipient.id}, Topic: #{@recipient.topic}, Member count: #{@recipient.member_count}\n\n" end else - puts "No recipient is currently selected." + details = "No recipient is currently selected." end + return details end end end \ No newline at end of file diff --git a/test/cassettes/channels_list.yml b/test/cassettes/channels_list.yml index d2307352..65628a59 100644 --- a/test/cassettes/channels_list.yml +++ b/test/cassettes/channels_list.yml @@ -21,17 +21,17 @@ http_interactions: Content-Type: - application/json; charset=utf-8 Content-Length: - - '1507' + - '1508' Connection: - keep-alive Date: - - Sat, 14 Sep 2019 00:15:10 GMT + - Sat, 14 Sep 2019 02:03:40 GMT Server: - Apache X-Content-Type-Options: - nosniff X-Slack-Req-Id: - - 3f71624a-beba-4582-a42e-930c23af0a1a + - 2941ff17-0ebd-433c-a835-cb064315a9ef X-Oauth-Scopes: - identify,channels:read,users:read,chat:write:bot Expires: @@ -57,15 +57,15 @@ http_interactions: Access-Control-Allow-Origin: - "*" X-Via: - - haproxy-www-n83k + - haproxy-www-gha7 X-Cache: - Miss from cloudfront Via: - - 1.1 d042f60a962591f741406f28a8170c5a.cloudfront.net (CloudFront) + - 1.1 61bc723adb3b1884ed759711e84e13a9.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - - SEA19-C1 + - SEA19-C2 X-Amz-Cf-Id: - - MbVCKUFdGdoWgxHAZdMSa0NgBcRS3qkDmESP00DM2XXvoYaIQHp_5g== + - hhNwtLFzovOvJ7-7A6U3cqNQWRg8qH10NWtvhubnzfojQMy-qBErIA== body: encoding: ASCII-8BIT string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":null,"tz_label":"Pacific @@ -80,9 +80,9 @@ http_interactions: Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568420110,"response_metadata":{"next_cursor":""}}' + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568426620,"response_metadata":{"next_cursor":""}}' http_version: - recorded_at: Sat, 14 Sep 2019 00:15:10 GMT + recorded_at: Sat, 14 Sep 2019 02:03:39 GMT - request: method: get uri: https://slack.com/api/channels.list?token=API_KEY @@ -108,13 +108,13 @@ http_interactions: Connection: - keep-alive Date: - - Sat, 14 Sep 2019 00:15:10 GMT + - Sat, 14 Sep 2019 02:03:40 GMT Server: - Apache X-Content-Type-Options: - nosniff X-Slack-Req-Id: - - 13429a49-abd3-43dd-86b0-69cd573ca307 + - 4923c828-84f0-41c9-b79f-fe927246796b X-Oauth-Scopes: - identify,channels:read,users:read,chat:write:bot Expires: @@ -140,15 +140,15 @@ http_interactions: Access-Control-Allow-Origin: - "*" X-Via: - - haproxy-www-nvih + - haproxy-www-tucf X-Cache: - Miss from cloudfront Via: - - 1.1 aabd01c4a20dae837d162bd972422efc.cloudfront.net (CloudFront) + - 1.1 61bc723adb3b1884ed759711e84e13a9.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - - SEA19-C1 + - SEA19-C2 X-Amz-Cf-Id: - - LHs8I5ZPuAN2mp3ATxxrGO5MGGaPmJ8FjY4gxykyYRKdhgmT3O8EvA== + - NZNrQG1CFV47NJ3FrKcw7S6Hos6N-vjUjM6lU1YtaYH2aJpe3IBHXA== body: encoding: ASCII-8BIT string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy @@ -163,5 +163,5 @@ http_interactions: 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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' http_version: - recorded_at: Sat, 14 Sep 2019 00:15:10 GMT + recorded_at: Sat, 14 Sep 2019 02:03:39 GMT recorded_with: VCR 5.0.0 diff --git a/test/cassettes/select_users.yml b/test/cassettes/select_users.yml index 79edcbc9..b4f04c24 100644 --- a/test/cassettes/select_users.yml +++ b/test/cassettes/select_users.yml @@ -21,17 +21,17 @@ http_interactions: Content-Type: - application/json; charset=utf-8 Content-Length: - - '1507' + - '1508' Connection: - keep-alive Date: - - Sat, 14 Sep 2019 00:15:11 GMT + - Sat, 14 Sep 2019 02:03:41 GMT Server: - Apache X-Content-Type-Options: - nosniff X-Slack-Req-Id: - - d56bf23f-3c13-4b37-9717-972906c80d3a + - d201dca4-6bca-4455-86a6-75945cd71577 X-Oauth-Scopes: - identify,channels:read,users:read,chat:write:bot Expires: @@ -57,15 +57,15 @@ http_interactions: Access-Control-Allow-Origin: - "*" X-Via: - - haproxy-www-kwrx + - haproxy-www-m9ma X-Cache: - Miss from cloudfront Via: - - 1.1 8ae6af4d17aae7471e5fe2792eb6abcd.cloudfront.net (CloudFront) + - 1.1 e36ab1b8726f47aa5adc8e19e66d1bbe.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - - SEA19-C1 + - SEA19-C2 X-Amz-Cf-Id: - - a-nsYSc-MH8aRlMhW0FY8hbu6IvSCYQ2iEZB-xTqnmZBRQBodLhH_g== + - B-5fCoMzaKriYx8EjXTpJHlSBImJ2nd7on92ezM0WZFySW7x2O-TgQ== body: encoding: ASCII-8BIT string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","name":"slackbot","deleted":false,"color":"757575","real_name":"Slackbot","tz":null,"tz_label":"Pacific @@ -80,9 +80,9 @@ http_interactions: Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific - Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568420111,"response_metadata":{"next_cursor":""}}' + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568426621,"response_metadata":{"next_cursor":""}}' http_version: - recorded_at: Sat, 14 Sep 2019 00:15:11 GMT + recorded_at: Sat, 14 Sep 2019 02:03:41 GMT - request: method: get uri: https://slack.com/api/channels.list?token=API_KEY @@ -108,13 +108,13 @@ http_interactions: Connection: - keep-alive Date: - - Sat, 14 Sep 2019 00:15:11 GMT + - Sat, 14 Sep 2019 02:03:41 GMT Server: - Apache X-Content-Type-Options: - nosniff X-Slack-Req-Id: - - a8b53d41-f4fa-4989-9c53-89de5ad0392b + - 8301b4f9-a352-486a-a358-d705953698c8 X-Oauth-Scopes: - identify,channels:read,users:read,chat:write:bot Expires: @@ -140,15 +140,15 @@ http_interactions: Access-Control-Allow-Origin: - "*" X-Via: - - haproxy-www-jtdn + - haproxy-www-9agp X-Cache: - Miss from cloudfront Via: - - 1.1 1ec2938341958d70d56193d709c89def.cloudfront.net (CloudFront) + - 1.1 d6b180eb367f7de26d67a9f3901b96a6.cloudfront.net (CloudFront) X-Amz-Cf-Pop: - - SEA19-C1 + - SEA19-C2 X-Amz-Cf-Id: - - OJv-w375zvkAR59B0--1NdalNjdBidzpEHLcUtNBuh_jT_wH0tAZSw== + - 0i0GmgX__NG9hdt1OOShdvI9CxzD021FHpBZG-hWxDiWPf9ZFskdhQ== body: encoding: ASCII-8BIT string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy @@ -163,5 +163,5 @@ http_interactions: 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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' http_version: - recorded_at: Sat, 14 Sep 2019 00:15:11 GMT + recorded_at: Sat, 14 Sep 2019 02:03:41 GMT recorded_with: VCR 5.0.0 diff --git a/test/cassettes/show_details.yml b/test/cassettes/show_details.yml new file mode 100644 index 00000000..a712bf95 --- /dev/null +++ b/test/cassettes/show_details.yml @@ -0,0 +1,167 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token=API_KEY + 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: + - '1507' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 02:08:01 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 11be461c-7766-4265-8a8b-471b7cc493d5 + X-Oauth-Scopes: + - identify,channels: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-hdxt + X-Cache: + - Miss from cloudfront + Via: + - 1.1 aef00f14752da9aa504d392fd46eff94.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - glOfyX6ECLZFjOfiKxvox0ABWZ_1rpQ-wY6bKlI2JD_CM9xc9wkXWw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN843TM63","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":"TN843TM63"},"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":"UMTERDBPU","team_id":"TN843TM63","name":"kristina.tanya","deleted":false,"color":"9f69e7","real_name":"Kristina + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kristina + M","real_name_normalized":"Kristina M","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3e9b0330d1c","first_name":"Kristina","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3e9b0330d1c2e104f1d9dbe0c6d81104.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0021-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568159573},{"id":"UMURAK10T","team_id":"TN843TM63","name":"rvesteinsdottir","deleted":false,"color":"3c989f","real_name":"random_name","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"random_name","real_name_normalized":"random_name","display_name":"Raisah","display_name_normalized":"Raisah","status_text":"","status_emoji":":rainbow:","status_expiration":0,"avatar_hash":"g1166bfab69b","first_name":"random_name","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/1166bfab69bc4d1c79dcb245ee03288a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0026-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568411462},{"id":"UMURAL35H","team_id":"TN843TM63","name":"dnsanche","deleted":false,"color":"e96699","real_name":"Daniela + Sanchez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Daniela + Sanchez","real_name_normalized":"Daniela Sanchez","display_name":"Daniela + Sanchez","display_name_normalized":"Daniela Sanchez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gb0d197e7328","image_24":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b0d197e73289b9054faa0517726ff139.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0006-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568072127,"has_2fa":false},{"id":"UN69JKYQ0","team_id":"TN843TM63","name":"cloudylopez","deleted":false,"color":"674b1b","real_name":"Cloudy + Lopez","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Cloudy + Lopez","real_name_normalized":"Cloudy Lopez","display_name":"Cloudy Lopez","display_name_normalized":"Cloudy + Lopez","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g877656756b0","image_24":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/877656756b0aed370014507bf3552664.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0009-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568272045},{"id":"UN69RK75K","team_id":"TN843TM63","name":"gyjinn","deleted":false,"color":"4bbe2e","real_name":"Ga-Young","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Ga-Young","real_name_normalized":"Ga-Young","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g816359af264","image_24":"https:\/\/secure.gravatar.com\/avatar\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.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\/816359af2646dc0038a37f6704efd389.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568130004},{"id":"UN85KTCHM","team_id":"TN843TM63","name":"alicesunhi","deleted":false,"color":"e7392d","real_name":"jack","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"jack","real_name_normalized":"jack","display_name":"taro","display_name_normalized":"taro","status_text":"","status_emoji":":dog:","status_expiration":0,"avatar_hash":"gb68b3fce35e","first_name":"jack","image_24":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/b68b3fce35eedec31832996b6e7a6bd3.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0017-512.png","status_text_canonical":"","team":"TN843TM63"},"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":1568242931}],"cache_ts":1568426881,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 02:08:01 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token=API_KEY + 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: + - '696' + Connection: + - keep-alive + Date: + - Sat, 14 Sep 2019 02:08:01 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - a7a11ac3-61e2-44e9-b899-3d49a43c14cc + X-Oauth-Scopes: + - identify,channels: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-ay2f + X-Cache: + - Miss from cloudfront + Via: + - 1.1 1a53057db389e96b4ef1bfbc925dde1c.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - L_AVnl8PVzkmF_zuZ7WG-8u-WLSOYI_9MQ97P3sMmESArhzxqQ86RA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CMUPUL1R9","name":"pupper-pics","is_channel":true,"created":1568067981,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"pupper-pics","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + photoshoot","creator":"UN69RK75K","last_set":1568239058},"purpose":{"value":"To + share darn cute pupper pics!","creator":"UMTERDBPU","last_set":1568081755},"previous_names":[],"num_members":6},{"id":"CMWARHPNF","name":"sploots","is_channel":true,"created":1568159409,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN69RK75K","name_normalized":"sploots","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"doggy + butts and toes","creator":"UN69RK75K","last_set":1568239045},"purpose":{"value":"look + at cute doggy butts and toes","creator":"UN69RK75K","last_set":1568159410},"previous_names":[],"num_members":6},{"id":"CN5PU7BBN","name":"general","is_channel":true,"created":1568067980,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UMTERDBPU","last_set":1568067980},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6},{"id":"CN689KKBP","name":"random","is_channel":true,"created":1568067980,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UMTERDBPU","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UMTERDBPU","UMURAK10T","UMURAL35H","UN69JKYQ0","UN69RK75K","UN85KTCHM"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UMTERDBPU","last_set":1568067980},"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":"UMTERDBPU","last_set":1568067980},"previous_names":[],"num_members":6}],"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Sat, 14 Sep 2019 02:08:01 GMT +recorded_with: VCR 5.0.0 diff --git a/test/workspace_test.rb b/test/workspace_test.rb index 367f37b9..0d015de2 100644 --- a/test/workspace_test.rb +++ b/test/workspace_test.rb @@ -37,10 +37,11 @@ it "will find the selected user in the list" do this_user = @workspace.select_user("dnsanche") expect(this_user).must_equal true - this_user = @workspace.select_user("USLACKBOT").must_equal true + this_user = @workspace.select_user("USLACKBOT") + expect(this_user).must_equal true end - it "will return false if username entered is invalid" do + it "will return false if invalid username/id are entered" do this_user = @workspace.select_user("GDFG") expect(this_user).must_equal false end @@ -53,23 +54,71 @@ end end - it "will find the selected channel in the list" do + it "will find the selected channel in the list if valid channel name/id are entered" do this_channel = @workspace.select_channel("random") expect(this_channel).must_equal true - this_channel = @workspace.select_channel("CMUPUL1R9").must_equal true + this_channel = @workspace.select_channel("CMUPUL1R9") + expect(this_channel).must_equal true end - it "will return false if username entered is invalid" do + it "will return false if username/id are invalid" do this_channel = @workspace.select_channel("GDFG") expect(this_channel).must_equal false + end + end #end for workspace select channel + + describe "Show details" do + before do + VCR.use_cassette("show_details") do + @workspace = Slack::Workspace.new + end end + it "shows details for selected user" do + @workspace.select_user("dnsanche") + details = "Name: dnsanche, Id: UMURAL35H, Real name: Daniela Sanchez\n\n" + expect(@workspace.show_details).must_equal details + end - - end #end for workspace select channel + it "shows details for selected channel" do + @workspace.select_channel("sploots") + details = "Name: sploots, Id: CMWARHPNF, Topic: doggy butts and toes, Member count: 6\n\n" + expect(@workspace.show_details).must_equal details + end + + it "shows invalid if there is no selected recipient" do + details = "No recipient is currently selected." + expect(@workspace.show_details).must_equal details + end + + # describe "Show details" do + # before do + # # VCR.use_cassette("show_details") do + # @workspace = Slack::Workspace.new + # end + # # end + + # it "shows details for selected user" do + # @workspace.select_user("dnsanche") + # details = "Name: dnsanche, Id: UMURAL35H, Real name: Daniela Sanchez\n\n" + # expect(@workspace.show_details).must_equal details + # end + + # it "shows details for selected channel" do + # @workspace.select_channel("sploots") + # details = "Name: dnsanche, Id: UMURAL35H, Real name: Daniela Sanchez\n\n" + # expect(@workspace.show_details).must_equal details + # end + + # it "shows invalid if there is no selected recipient" do + # details = "No recipient is currently selected." + # expect(@workspace.show_details).must_equal details + # end + # end -end #end of workspace class + end +end # the name is the name if the cassete we want to specify. If we don't have that cassete created, it will be created automatically. # i'm using location based on the example of the class, but we need to update it. From 26ea13326d4714e0b07644ec6e2118b84f13111d Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Fri, 13 Sep 2019 22:01:22 -0700 Subject: [PATCH 26/27] Finished all tests --- lib/message.rb | 13 +++--- lib/user.rb | 4 +- test/cassettes/message_channel.yml | 71 ++++++++++++++++++++++++++++++ test/cassettes/message_user.yml | 71 ++++++++++++++++++++++++++++++ test/message_test.rb | 17 +++++++ test/recipient_test.rb | 2 - test/slack_test.rb | 2 - test/test_helper.rb | 1 + test/workspace_test.rb | 32 +------------- 9 files changed, 167 insertions(+), 46 deletions(-) create mode 100644 test/cassettes/message_channel.yml create mode 100644 test/cassettes/message_user.yml create mode 100644 test/message_test.rb delete mode 100644 test/recipient_test.rb delete mode 100644 test/slack_test.rb diff --git a/lib/message.rb b/lib/message.rb index 79601103..bea0c59f 100644 --- a/lib/message.rb +++ b/lib/message.rb @@ -1,18 +1,15 @@ #lib/message.rb require "httparty" -# class SlackApiError < StandardError ; end +class SlackApiError < StandardError ; end -module Slack - BASE_URL = 'https://slack.com/api/' - API_KEY = ENV['API_KEY'] - +module Slack def self.send_msg(message, channel) response = HTTParty.post( - "#{BASE_URL}/chat.postMessage", + "https://slack.com/api/chat.postMessage", body: { - token: API_KEY, + token: ENV['API_KEY'], text: message, channel: channel }, @@ -20,7 +17,7 @@ def self.send_msg(message, channel) ) unless response.code == 200 && response.parsed_response["ok"] - puts "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" + raise SlackApiError, "Error when posting #{message} to #{channel}, error: #{response.parsed_response["error"]}" end return true diff --git a/lib/user.rb b/lib/user.rb index 6cc2748b..4a6b8139 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -6,8 +6,6 @@ Dotenv.load module Slack - USERS_URI = 'https://slack.com/api' - USERS_KEY = ENV['API_KEY'] class User < Recipient attr_reader :real_name def initialize(name, id, real_name) @@ -17,7 +15,7 @@ def initialize(name, id, real_name) def self.users_list users = [] - response = HTTParty.get("#{USERS_URI}/users.list", query: {token: USERS_KEY}) + response = HTTParty.get("https://slack.com/api/users.list", query: {token: ENV['API_KEY']}) response.parsed_response["members"].each do |member| name = member["name"] id = member["id"] diff --git a/test/cassettes/message_channel.yml b/test/cassettes/message_channel.yml new file mode 100644 index 00000000..f027a270 --- /dev/null +++ b/test/cassettes/message_channel.yml @@ -0,0 +1,71 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: token=API_KEY&text=Goodbye%21&channel=sploots + 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: + - Sat, 14 Sep 2019 05:00:45 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 98bcbd07-42da-49b0-823d-290fd7c9679c + X-Oauth-Scopes: + - identify,channels: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-7zhp + X-Cache: + - Miss from cloudfront + Via: + - 1.1 4c4ed81695980f3c6829b9fd229bd0f8.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19 + X-Amz-Cf-Id: + - c7zq5H0yTz5G4mSQRW1f5QU3eX_vx7Ii3bRKf2T_996oY_p9cJgJLw== + body: + encoding: UTF-8 + string: '{"ok":true,"channel":"CMWARHPNF","ts":"1568437245.000100","message":{"type":"message","subtype":"bot_message","text":"Goodbye!","ts":"1568437245.000100","username":"Leaves + - DaniSanchez - API Project","bot_id":"BMURJKEH1"}}' + http_version: + recorded_at: Sat, 14 Sep 2019 05:00:44 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/message_user.yml b/test/cassettes/message_user.yml new file mode 100644 index 00000000..e277a4e2 --- /dev/null +++ b/test/cassettes/message_user.yml @@ -0,0 +1,71 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: token=API_KEY&text=Hello%21%21&channel=UMURAL35H + 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: + - Sat, 14 Sep 2019 04:54:19 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - e71efaa3-5a8b-4972-947d-0dde498d6e26 + X-Oauth-Scopes: + - identify,channels: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-x62j + X-Cache: + - Miss from cloudfront + Via: + - 1.1 2e20768704c71ff3ce2e677251d27f3c.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - pJA_vgS-1zlF66ZsSq0MyfEis3ixFTQIijT0Z8Za52THooe5R5NOlw== + body: + encoding: UTF-8 + string: '{"ok":true,"channel":"DN69JLE2C","ts":"1568436859.000400","message":{"type":"message","subtype":"bot_message","text":"Hello!!","ts":"1568436859.000400","username":"Leaves + - DaniSanchez - API Project","bot_id":"BMURJKEH1"}}' + http_version: + recorded_at: Sat, 14 Sep 2019 04:54:18 GMT +recorded_with: VCR 5.0.0 diff --git a/test/message_test.rb b/test/message_test.rb new file mode 100644 index 00000000..aa066962 --- /dev/null +++ b/test/message_test.rb @@ -0,0 +1,17 @@ +require_relative "test_helper" + +describe Slack do + it "sends message to the user" do + VCR.use_cassette("message_user") do + response = Slack.send_msg("Hello!!", "UMURAL35H") + expect(response).must_equal true + end + end + + it "sends message to the channel" do + VCR.use_cassette("message_channel") do + response = Slack.send_msg("Goodbye!", "sploots") + expect(response).must_equal true + end + end #end send message +end \ No newline at end of file diff --git a/test/recipient_test.rb b/test/recipient_test.rb deleted file mode 100644 index 5497dc4b..00000000 --- a/test/recipient_test.rb +++ /dev/null @@ -1,2 +0,0 @@ -require_relative 'test_helper.rb' - diff --git a/test/slack_test.rb b/test/slack_test.rb deleted file mode 100644 index 5497dc4b..00000000 --- a/test/slack_test.rb +++ /dev/null @@ -1,2 +0,0 @@ -require_relative 'test_helper.rb' - diff --git a/test/test_helper.rb b/test/test_helper.rb index 82b05d9e..694d54a0 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -25,6 +25,7 @@ end end +require_relative "../lib/message.rb" require_relative "../lib/recipient.rb" require_relative "../lib/user.rb" require_relative "../lib/channel.rb" diff --git a/test/workspace_test.rb b/test/workspace_test.rb index 0d015de2..52232bc9 100644 --- a/test/workspace_test.rb +++ b/test/workspace_test.rb @@ -90,36 +90,6 @@ details = "No recipient is currently selected." expect(@workspace.show_details).must_equal details end - - - # describe "Show details" do - # before do - # # VCR.use_cassette("show_details") do - # @workspace = Slack::Workspace.new - # end - # # end - - # it "shows details for selected user" do - # @workspace.select_user("dnsanche") - # details = "Name: dnsanche, Id: UMURAL35H, Real name: Daniela Sanchez\n\n" - # expect(@workspace.show_details).must_equal details - # end - - # it "shows details for selected channel" do - # @workspace.select_channel("sploots") - # details = "Name: dnsanche, Id: UMURAL35H, Real name: Daniela Sanchez\n\n" - # expect(@workspace.show_details).must_equal details - # end + end #end show details - # it "shows invalid if there is no selected recipient" do - # details = "No recipient is currently selected." - # expect(@workspace.show_details).must_equal details - # end - # end - - end end - -# the name is the name if the cassete we want to specify. If we don't have that cassete created, it will be created automatically. -# i'm using location based on the example of the class, but we need to update it. - From f4097e6fc8079c4e0483ce5385fb5529572b367d Mon Sep 17 00:00:00 2001 From: daniela sanchez Date: Fri, 13 Sep 2019 22:54:39 -0700 Subject: [PATCH 27/27] Added additional test to improve coverage --- .DS_Store | Bin 0 -> 6148 bytes test/cassettes/message.yml | 70 +++++++++++++++++++++++++++++++++++++ test/message_test.rb | 6 ++++ 3 files changed, 76 insertions(+) create mode 100644 .DS_Store create mode 100644 test/cassettes/message.yml diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1ad899dbcdc748036dd701eacb0ec11e243703d4 GIT binary patch literal 6148 zcmeHKyJ`bL3>+mc4$`I(2Sbbi#2M3J zT*oXyY@Q(Y!ZDE|1kgGlC+ZoQs7@HV6)|Fx!@~RZ=JlH_u58Z)4k@C?#6Xc7@{2$qaAbO f?f5y0vab1>=e=-D3_9~cC+cUwb&*MdzgFN1-fR_w literal 0 HcmV?d00001 diff --git a/test/cassettes/message.yml b/test/cassettes/message.yml new file mode 100644 index 00000000..fc6d3aae --- /dev/null +++ b/test/cassettes/message.yml @@ -0,0 +1,70 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: token=API_KEY&text=Hello%21%21&channel=%40 + 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: + - Sat, 14 Sep 2019 05:52:59 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - '02868867-f9c8-4b4c-b519-a48c5bc1f883' + X-Oauth-Scopes: + - identify,channels: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-neww + X-Cache: + - Miss from cloudfront + Via: + - 1.1 44cd593d82a2d200a94217033c614c6a.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - GDKcrPsoPWs95fE4xyaCz1qkE68WQSGOAS7vGOQqQbG6KjPH9gq78A== + body: + encoding: UTF-8 + string: '{"ok":false,"error":"channel_not_found"}' + http_version: + recorded_at: Sat, 14 Sep 2019 05:52:58 GMT +recorded_with: VCR 5.0.0 diff --git a/test/message_test.rb b/test/message_test.rb index aa066962..8d53eaf1 100644 --- a/test/message_test.rb +++ b/test/message_test.rb @@ -13,5 +13,11 @@ response = Slack.send_msg("Goodbye!", "sploots") expect(response).must_equal true end + end + + it "shows error if response code isn't 200 and ok" do + VCR.use_cassette("message") do + expect {response = Slack.send_msg("Hello!!", "@") }.must_raise SlackApiError + end end #end send message end \ No newline at end of file