From afcafe0d0902c72fac21d9131675388c6ae6835e Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Wed, 11 Mar 2020 23:13:14 -0700 Subject: [PATCH 01/35] created class Channel --- lib/channel.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/channel.rb diff --git a/lib/channel.rb b/lib/channel.rb new file mode 100644 index 00000000..f8db9ee7 --- /dev/null +++ b/lib/channel.rb @@ -0,0 +1,16 @@ +require_relative 'recipient' + +module SlackCli + class Channel < Recipient + attr_accessor :topic, :member_count + + def initialize(id, handle, topic, member_count) + super(id, handle) + @topic = topic + @member_count = member_count + end #initialize + end #class +end #module + +testchannel = SlackCli::Channel.new(1, "kate", "coffee", 2) +puts testchannel.topic \ No newline at end of file From 6b25b8e7976a32862bf232f6c3fca4012d8bd76d Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Wed, 11 Mar 2020 23:13:31 -0700 Subject: [PATCH 02/35] created Recipient class --- lib/recipient.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/recipient.rb diff --git a/lib/recipient.rb b/lib/recipient.rb new file mode 100644 index 00000000..2b0cab40 --- /dev/null +++ b/lib/recipient.rb @@ -0,0 +1,12 @@ +#00 ride share csvrecord +module SlackCli + class Recipient + attr_reader :id + attr_accessor :name + + def initialize(id, name) + @id = id + @name = name + end #initialize + end #class +end #module \ No newline at end of file From e300c71f35304ad6b46be45ba280add06566cf4a Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Wed, 11 Mar 2020 23:14:10 -0700 Subject: [PATCH 03/35] added require_relative 'workspace' to slack.rb --- lib/slack.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/slack.rb b/lib/slack.rb index 8a0b659b..b636bcb0 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,8 +1,13 @@ #!/usr/bin/env ruby +require 'httparty' +require 'dotenv' +require 'table_print' +require_relative 'workspace' + def main puts "Welcome to the Ada Slack CLI!" - workspace = Workspace.new + workspace = SlackCli::Workspace.new # TODO project From 0c5f83bc00482e9846f1fa237a6138d2f8204bd6 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Wed, 11 Mar 2020 23:14:32 -0700 Subject: [PATCH 04/35] added filter sensitive data w/ slack token --- test/test_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 1fcf2bab..749097b1 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -25,5 +25,7 @@ } # Don't leave our token lying around in a cassette file. - + config.filter_sensitive_data("") do + ENV["SLACK_TOKEN"] + end end From b2ca9b8ca19345454bc838071288bac1c9ed3ae9 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Wed, 11 Mar 2020 23:14:54 -0700 Subject: [PATCH 05/35] added Workspace class --- lib/workspace.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/workspace.rb diff --git a/lib/workspace.rb b/lib/workspace.rb new file mode 100644 index 00000000..19a1be8a --- /dev/null +++ b/lib/workspace.rb @@ -0,0 +1,17 @@ +require_relative 'user' +require_relative 'channel' + +module SlackCli + class Workspace + attr_reader :users, :channels + def initialize() + @users = SlackCli::User.load_all + @channels = [] + end #initialize + end #class +end #module + +test_workspace = SlackCli::Workspace.new +test_workspace.users.each do |user| + puts user.real_name +end \ No newline at end of file From 21164d106f66b0386548264ba558c766d636822a Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Wed, 11 Mar 2020 23:15:15 -0700 Subject: [PATCH 06/35] added User class and load_all method --- lib/user.rb | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 lib/user.rb diff --git a/lib/user.rb b/lib/user.rb new file mode 100644 index 00000000..cd63d1bb --- /dev/null +++ b/lib/user.rb @@ -0,0 +1,64 @@ +require 'httparty' +require 'dotenv' +Dotenv.load(__dir__ + "/" + "../.env") #https://github.com/bkeepers/dotenv +require_relative 'recipient' + + +module SlackCli + class User < Recipient + attr_accessor :real_name, :status_text, :status_text, :status_emoji + + def initialize(id, name, real_name, status_text = nil, status_emoji = nil) + super(id, name) + @real_name = real_name + @status_text = status_text + @status_emoji = status_emoji + end #initialize + + #retrieves list of users from Slack + #input + #returns list of users [User] + def self.load_all() + users = [] + #send request to Slack API using users.list endpoint + # after? param = value + url = "https://slack.com/api/users.list?token=#{ENV['SLACK_TOKEN']}" #https://github.com/bkeepers/dotenv + response = HTTParty.get(url) #request that will return the response + #parse response and get users + response['members'].each do |member| + # "id": "UUUKJ03NX", + # "team_id": "TV63QKAAU", + # "name": "kate.d.mangubat", + # "deleted": false, + # "color": "4bbe2e", + # "real_name": "Kate Mangubat" + + #create a user + id = member["id"] + name = member["name"] + real_name = member["real_name"] + status_text = member["profile"]["status_text"] + status_emoji = member["profile"]["status_emoji"] + #handle + #real name + slack_user = SlackCli::User.new(id, name, real_name, status_text, status_emoji) + #save to users + users.push(slack_user) + end + return users + end #load_all method + + end #class +end #module + +# testuser = SlackCli::User.new(1, "kate", "katem") +# puts testuser.handle +all_users = SlackCli::User.load_all + +all_users.each do |user| + puts user.name + puts user.real_name + puts user.status_text + puts user.status_emoji +end + From 418394b9764b6178ddc3ff6cb73d1e661b289dd0 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Wed, 11 Mar 2020 23:44:46 -0700 Subject: [PATCH 07/35] added CLI for list users --- lib/slack.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index b636bcb0..edf232d6 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -4,14 +4,28 @@ require 'table_print' require_relative 'workspace' - def main - puts "Welcome to the Ada Slack CLI!" workspace = SlackCli::Workspace.new - + puts "Welcome to the Ada Slack CLI!" + puts "Here are the options:" + options = ["list users", "list channels", "quit"] + options.each do |option| + puts option + end + + user_input = gets.chomp.downcase + while user_input != options[-1] + if user_input == options[0] + #list users with username, real name, and Slack ID. + tp workspace.users, :id, :name, :real_name #https://github.com/arches/table_print usage + end + user_input = gets.chomp + end + + # TODO project puts "Thank you for using the Ada Slack CLI" -end +end #main main if __FILE__ == $PROGRAM_NAME \ No newline at end of file From 8801092941fca038819ab0a07605f15d789f908a Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Thu, 12 Mar 2020 00:06:53 -0700 Subject: [PATCH 08/35] added load all method to Channel --- lib/channel.rb | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/lib/channel.rb b/lib/channel.rb index f8db9ee7..6ec85bdf 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -1,16 +1,50 @@ +require 'httparty' +require 'dotenv' +Dotenv.load(__dir__ + "/" + "../.env") #https://github.com/bkeepers/dotenv require_relative 'recipient' module SlackCli class Channel < Recipient attr_accessor :topic, :member_count - def initialize(id, handle, topic, member_count) - super(id, handle) + def initialize(id, name, topic, member_count) + super(id, name) @topic = topic @member_count = member_count end #initialize + + #retrieves list of channels from Slack + #input + #returns list of channels [Channel] + def self.load_all() + channels = [] + #send request to Slack API using users.list endpoint + # after? param = value + url = "https://slack.com/api/channels.list?token=#{ENV['SLACK_TOKEN']}" #https://github.com/bkeepers/dotenv + response = HTTParty.get(url) #request that will return the response + #parse response and get users + response['channels'].each do |channel| + id = channel["id"] + name = channel["name"] + topic = channel["topic"]["value"] + member_count = channel["num_members"] + # member_count = channel["members"].length + #create a channel + slack_channel = SlackCli::Channel.new(id, name, topic, member_count) + #save to channels + channels.push(slack_channel) + end + return channels + end #load_all method + + end #class end #module -testchannel = SlackCli::Channel.new(1, "kate", "coffee", 2) -puts testchannel.topic \ No newline at end of file +testchannels = SlackCli::Channel.load_all +testchannels.each do |channel| + puts channel.id + puts channel.name + puts channel.topic + puts channel.member_count +end \ No newline at end of file From 8fffeb9cce8a2687b6c6b038388cf4ec43b95168 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Thu, 12 Mar 2020 00:07:22 -0700 Subject: [PATCH 09/35] completed check to list channels --- lib/slack.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index edf232d6..c3409d36 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -15,14 +15,16 @@ def main user_input = gets.chomp.downcase while user_input != options[-1] - if user_input == options[0] + if user_input == options[0] #list users with username, real name, and Slack ID. tp workspace.users, :id, :name, :real_name #https://github.com/arches/table_print usage + else user_input == options[1] + #list channel with name, topic, member count, and Slack ID + tp workspace.channels, :id, :name, :topic, :member_count end user_input = gets.chomp end - # TODO project puts "Thank you for using the Ada Slack CLI" From 937d701214784fd00aebef04776e31d4c8a8b4bf Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Thu, 12 Mar 2020 00:08:08 -0700 Subject: [PATCH 10/35] loaded Channels --- lib/workspace.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/workspace.rb b/lib/workspace.rb index 19a1be8a..7d3c825b 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -6,12 +6,12 @@ class Workspace attr_reader :users, :channels def initialize() @users = SlackCli::User.load_all - @channels = [] + @channels = SlackCli::Channel.load_all end #initialize end #class end #module -test_workspace = SlackCli::Workspace.new -test_workspace.users.each do |user| - puts user.real_name -end \ No newline at end of file +# test_workspace = SlackCli::Workspace.new +# test_workspace.users.each do |user| +# puts user.real_name +# end \ No newline at end of file From 7fb66aab3ed0384e731952e8e4c7e61dc36c5177 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Thu, 12 Mar 2020 00:09:22 -0700 Subject: [PATCH 11/35] commented test code --- lib/user.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/user.rb b/lib/user.rb index cd63d1bb..1c8bfe19 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -53,12 +53,12 @@ def self.load_all() # testuser = SlackCli::User.new(1, "kate", "katem") # puts testuser.handle -all_users = SlackCli::User.load_all +# all_users = SlackCli::User.load_all -all_users.each do |user| - puts user.name - puts user.real_name - puts user.status_text - puts user.status_emoji -end +# all_users.each do |user| +# puts user.name +# puts user.real_name +# puts user.status_text +# puts user.status_emoji +# end From f28355b6c25eace20f7f08746f0ce3ec791ffe6d Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Thu, 12 Mar 2020 00:24:42 -0700 Subject: [PATCH 12/35] added private load all method in recipient class --- lib/channel.rb | 14 +++++++------- lib/recipient.rb | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/channel.rb b/lib/channel.rb index 6ec85bdf..736f13d9 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -41,10 +41,10 @@ def self.load_all() end #class end #module -testchannels = SlackCli::Channel.load_all -testchannels.each do |channel| - puts channel.id - puts channel.name - puts channel.topic - puts channel.member_count -end \ No newline at end of file +# testchannels = SlackCli::Channel.load_all +# testchannels.each do |channel| +# puts channel.id +# puts channel.name +# puts channel.topic +# puts channel.member_count +# end \ No newline at end of file diff --git a/lib/recipient.rb b/lib/recipient.rb index 2b0cab40..6c224531 100644 --- a/lib/recipient.rb +++ b/lib/recipient.rb @@ -8,5 +8,10 @@ def initialize(id, name) @id = id @name = name end #initialize + + private + def self.load_all() #abstract method/template + raise NotImplementedError, 'Implement me in a child class!' + end end #class -end #module \ No newline at end of file +end #module From 91cd7c210496ee1e403d3670198a9103e6853e53 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Fri, 13 Mar 2020 11:07:30 -0700 Subject: [PATCH 13/35] added tests to channels --- test/channel_test.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/channel_test.rb diff --git a/test/channel_test.rb b/test/channel_test.rb new file mode 100644 index 00000000..5cece517 --- /dev/null +++ b/test/channel_test.rb @@ -0,0 +1,31 @@ +require_relative 'test_helper' +require_relative '../lib/channel' + +describe "Channel" do + describe "self.get" do + it "gets a list of channels and returns them as an HTTParty Response" do + result = {} + VCR.use_cassette("channel-list-endpoint") do + result = Channel.get("https://slack.com/api/channels.list") + end + expect(result).must_be_kind_of HTTParty::Response + expect(result["ok"]).must_equal true + end + + it "raises an error when a call fails" do + VCR.use_cassette("channel-list-endpoint") do + expect {Channel.get("https://slack.com/api/bogus.endpoint")}.must_raise SlackAPIError + end + end + end #initialize + + #FROM DEVIN + describe "self.load_all" do + it "return a valid list of channels" do + result = [] + VCR.use_cassette("channel-list-endpoint") do + result = Channel.load_all + end + end + end +end #class From 1355f475d5549535b1a16d505bb130b850a0ab53 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Fri, 13 Mar 2020 11:07:41 -0700 Subject: [PATCH 14/35] added tests to users --- test/user_test.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/user_test.rb diff --git a/test/user_test.rb b/test/user_test.rb new file mode 100644 index 00000000..5f7f60a1 --- /dev/null +++ b/test/user_test.rb @@ -0,0 +1,31 @@ +require_relative 'test_helper' +require_relative '../lib/user' + +describe "User" do + describe "self.get" do + it "gets a list of users and returns them as an HTTParty Response" do + result = {} + VCR.use_cassette("user-list-endpoint") do + result = Channel.get("https://slack.com/api/users.list") + end + expect(result).must_be_kind_of HTTParty::Response + expect(result["ok"]).must_equal true + end + + it "raises an error when a call fails" do + VCR.use_cassette("user-list-endpoint") do + expect {User.get("https://slack.com/api/bogus.endpoint")}.must_raise SlackAPIError + end + end + end #initialize + + #FROM DEVIN + describe "self.load_all" do + it "return a valid list of users" do + result = [] + VCR.use_cassette("user-list-endpoint") do + result = User.load_all + end + end + end +end #class \ No newline at end of file From ad3defdfec071a732d010cb061e39aa872350d31 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Fri, 13 Mar 2020 11:08:52 -0700 Subject: [PATCH 15/35] added SlackAPIError < Exception class per Devin --- lib/recipient.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/recipient.rb b/lib/recipient.rb index 6c224531..ac2b7618 100644 --- a/lib/recipient.rb +++ b/lib/recipient.rb @@ -15,3 +15,8 @@ def self.load_all() #abstract method/template end end #class end #module + +#Common to tell other files in the program +#Per Devin, include here so it's accessible to other classes +class SlackAPIError < Exception +end From 1c310b62aa7060af66d6ad44f5f0e995ef897988 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Fri, 13 Mar 2020 11:09:29 -0700 Subject: [PATCH 16/35] added shell for needed methods per Devin --- lib/workspace.rb | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/workspace.rb b/lib/workspace.rb index 7d3c825b..72f203ab 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -1,17 +1,37 @@ require_relative 'user' require_relative 'channel' +require 'dotenv' module SlackCli class Workspace - attr_reader :users, :channels + attr_reader :users, :channels, :selected + def initialize() - @users = SlackCli::User.load_all - @channels = SlackCli::Channel.load_all + Dotenv.load(__dir__ + "/" + "../.env") #https://github.com/bkeepers/dotenv + @users = SlackCli::User.load_all("#{ENV['BASE_URL'] + ENV['SUB_USER_URL'] + "token=#{ENV['SLACK_TOKEN']}"}") + @channels = SlackCli::Channel.load_all("#{ENV['BASE_URL'] + ENV['SUB_CHANNEL_URL'] + "token=#{ENV['SLACK_TOKEN']}"}") + @selected = nil end #initialize + + + def select_channel + end + + def select_user + end + + def show_details + end + + def send_message + end + + + end #class end #module # test_workspace = SlackCli::Workspace.new # test_workspace.users.each do |user| # puts user.real_name -# end \ No newline at end of file +# end From 594ab259494a3a948839f6857cf61af6eaf77eac Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Fri, 13 Mar 2020 11:09:58 -0700 Subject: [PATCH 17/35] added require 'dotenv' --- test/test_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_helper.rb b/test/test_helper.rb index 749097b1..c7909f90 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,6 +8,7 @@ require 'minitest/reporters' require 'minitest/skip_dsl' require 'vcr' +require 'dotenv' Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new From 93c9800e48ea6ea4342cf13796bbbeb52ea909aa Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sat, 14 Mar 2020 17:52:19 -0700 Subject: [PATCH 18/35] added select user prompt functions --- lib/slack.rb | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index c3409d36..013d1c48 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -8,19 +8,44 @@ def main workspace = SlackCli::Workspace.new puts "Welcome to the Ada Slack CLI!" puts "Here are the options:" - options = ["list users", "list channels", "quit"] + options = ["list users", "list channels", "select user", "quit"] options.each do |option| puts option end user_input = gets.chomp.downcase - while user_input != options[-1] - if user_input == options[0] - #list users with username, real name, and Slack ID. + while user_input != options[-1] #quit + if user_input == options[0] #list users + #GET user details- username, real name, and Slack ID. tp workspace.users, :id, :name, :real_name #https://github.com/arches/table_print usage - else user_input == options[1] - #list channel with name, topic, member count, and Slack ID + elsif user_input == options[1] #list channels + #GET channel details- name, topic, member count, and Slack ID tp workspace.channels, :id, :name, :topic, :member_count + #userinput equals option--select user + elsif user_input == options[2] #select user + #prompt: "which user do you want to select" + puts "Which user do you want to select?" + #present list of users + tp workspace.users, :id, :name, :real_name + #user input...gets chomp + user_input = gets.chomp + + valid_inputs = workspace.valid_inputs_id_names + + #check is user's input includes anything in this valid_inputs[] + while !valid_inputs.include?(user_input) + #if not, ask to reenter + puts "Invalid. Enter selection again. Try copy and pasting SlackID or username." + user_input = gets.chomp + end + + #find user + found_user = workspace.find_user(user_input) + #assign the user found to selected + workspace.selected = found_user + + #prompt"enter "details" if you want more info" + end user_input = gets.chomp end From f295d307638a5f6efad177b3aff2eb070bfc6402 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sat, 14 Mar 2020 17:53:02 -0700 Subject: [PATCH 19/35] added format to make it clearer for class methods --- lib/user.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/user.rb b/lib/user.rb index 1c8bfe19..80b9c60c 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -1,6 +1,4 @@ require 'httparty' -require 'dotenv' -Dotenv.load(__dir__ + "/" + "../.env") #https://github.com/bkeepers/dotenv require_relative 'recipient' @@ -15,14 +13,13 @@ def initialize(id, name, real_name, status_text = nil, status_emoji = nil) @status_emoji = status_emoji end #initialize + #--------User Class Methods---------------------------- #retrieves list of users from Slack #input #returns list of users [User] - def self.load_all() + def self.load_all(url) users = [] #send request to Slack API using users.list endpoint - # after? param = value - url = "https://slack.com/api/users.list?token=#{ENV['SLACK_TOKEN']}" #https://github.com/bkeepers/dotenv response = HTTParty.get(url) #request that will return the response #parse response and get users response['members'].each do |member| @@ -61,4 +58,3 @@ def self.load_all() # puts user.status_text # puts user.status_emoji # end - From 99ef2e1d637d490f352fa1416dfebce125e4207a Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sat, 14 Mar 2020 17:53:24 -0700 Subject: [PATCH 20/35] added format to make class methods clearer --- lib/channel.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/channel.rb b/lib/channel.rb index 736f13d9..3c6c9ac1 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -1,6 +1,4 @@ require 'httparty' -require 'dotenv' -Dotenv.load(__dir__ + "/" + "../.env") #https://github.com/bkeepers/dotenv require_relative 'recipient' module SlackCli @@ -13,14 +11,14 @@ def initialize(id, name, topic, member_count) @member_count = member_count end #initialize + #--------Channel Class Methods---------------------------- + #retrieves list of channels from Slack #input #returns list of channels [Channel] - def self.load_all() + def self.load_all(url) channels = [] #send request to Slack API using users.list endpoint - # after? param = value - url = "https://slack.com/api/channels.list?token=#{ENV['SLACK_TOKEN']}" #https://github.com/bkeepers/dotenv response = HTTParty.get(url) #request that will return the response #parse response and get users response['channels'].each do |channel| From 112a96ad6fc578ca51296955f2e030396b311663 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sat, 14 Mar 2020 17:53:55 -0700 Subject: [PATCH 21/35] added selected, methods to workspace --- lib/workspace.rb | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/lib/workspace.rb b/lib/workspace.rb index 72f203ab..48eee753 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -4,7 +4,8 @@ module SlackCli class Workspace - attr_reader :users, :channels, :selected + attr_reader :users, :channels + attr_accessor :selected def initialize() Dotenv.load(__dir__ + "/" + "../.env") #https://github.com/bkeepers/dotenv @@ -13,25 +14,43 @@ def initialize() @selected = nil end #initialize - - def select_channel - end - - def select_user - end - - def show_details + #--------------------------Class Methods ------------------------ + + #Returns all valid user id and name + # inputs: slack id's (:id), need list of name (:name) + def valid_inputs_id_names() + valid_inputs = [] + self.users.each do |user| + valid_inputs << user.id + valid_inputs << user.name + end + return valid_inputs end - def send_message + #---------------------------------------------------------------- + + #finds a user + #input: aUser_input + #Returns a found user + def find_user(aUser_input) + found_user = nil + self.users.each do |user| + if (aUser_input == user.id) || (aUser_input == user.name) + return user + end + end + return found_user end - - + #---------------------------------------------------------------- end #class end #module -# test_workspace = SlackCli::Workspace.new +test_workspace = SlackCli::Workspace.new # test_workspace.users.each do |user| # puts user.real_name # end + +name = test_workspace.find_user("cheese") +puts name + From bbe533d707e6741aa8e130ac9c2cb5d9acfc7a6b Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sat, 14 Mar 2020 19:56:52 -0700 Subject: [PATCH 22/35] added methods for valid inputs, find user, find chnnl --- lib/workspace.rb | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/lib/workspace.rb b/lib/workspace.rb index 48eee753..c66fd697 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -17,14 +17,21 @@ def initialize() #--------------------------Class Methods ------------------------ #Returns all valid user id and name - # inputs: slack id's (:id), need list of name (:name) - def valid_inputs_id_names() - valid_inputs = [] - self.users.each do |user| - valid_inputs << user.id - valid_inputs << user.name + # inputs: aMode that's either "user" or "channel" + def valid_inputs_id_names(aMode) + valid_inputs = [] + if aMode == "user" + self.users.each do |user| + valid_inputs << user.id + valid_inputs << user.name + end + elsif aMode == "channel" + self.channels.each do |channel| + valid_inputs << channel.id + valid_inputs << channel.name + end end - return valid_inputs + return valid_inputs end #---------------------------------------------------------------- @@ -43,6 +50,20 @@ def find_user(aUser_input) end #---------------------------------------------------------------- + + #finds a channel + #input: aUser_input + #Returns a found channel + def find_channel(aUser_input) + found_channel = nil + self.channels.each do |channel| + if (aUser_input == channel.id) || (aUser_input == channel.name) + return channel + end + end + return found_channel + end + #---------------------------------------------------------------- end #class end #module From 952bc8181119f97acc04c5dd27ac0d5b2739b30c Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sat, 14 Mar 2020 20:09:26 -0700 Subject: [PATCH 23/35] methods for select chnnl, details, send msg --- lib/slack.rb | 74 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index 013d1c48..407f0853 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -8,7 +8,7 @@ def main workspace = SlackCli::Workspace.new puts "Welcome to the Ada Slack CLI!" puts "Here are the options:" - options = ["list users", "list channels", "select user", "quit"] + options = ["list users", "list channels", "select user", "select channel", "details", "send message", "quit"] options.each do |option| puts option end @@ -21,6 +21,9 @@ def main elsif user_input == options[1] #list channels #GET channel details- name, topic, member count, and Slack ID tp workspace.channels, :id, :name, :topic, :member_count + + + #----------------SELECT USER------------------------------- #userinput equals option--select user elsif user_input == options[2] #select user #prompt: "which user do you want to select" @@ -30,24 +33,81 @@ def main #user input...gets chomp user_input = gets.chomp - valid_inputs = workspace.valid_inputs_id_names - + valid_inputs = workspace.valid_inputs_id_names("user") #check is user's input includes anything in this valid_inputs[] while !valid_inputs.include?(user_input) #if not, ask to reenter puts "Invalid. Enter selection again. Try copy and pasting SlackID or username." user_input = gets.chomp end - #find user found_user = workspace.find_user(user_input) #assign the user found to selected workspace.selected = found_user - - #prompt"enter "details" if you want more info" + #-------SELECT CHANNEL ------------------------------------- + elsif user_input == options[3] + #prompt: "which channel do you want to select" + puts "Which channel do you want to select?" + #present list of channels + tp workspace.channels, :id, :name, :topic, :member_count + #user input...gets chomp + user_input = gets.chomp + + valid_inputs = workspace.valid_inputs_id_names("channel") + #check is user's input includes anything in this valid_inputs[] + while !valid_inputs.include?(user_input) + #if not, ask to reenter + puts "Invalid. Enter selection again. Try copy and pasting SlackID or username." + user_input = gets.chomp + end + #find user + found_channel = workspace.find_channel(user_input) + #assign the user found to selected + workspace.selected = found_channel + + #------------- DETAILS USER + CHANNEL-------------------------------- + elsif user_input == options[4] #select details + #print the details of what the user selected + #check if selected is User Object + if workspace.selected.is_a? SlackCli::User + #if true, print user details : id, name, @real_name, @status_text, @status_emoji + tp workspace.selected, :id, :name, :real_name, :status_text, :status_emoji + #check if selected is Channel Object + elsif workspace.selected.is_a? SlackCli::Channel + #if true, print channel details: id, name, @topic, @member_count + tp workspace.selected, :id, :name, :topic, :member_count + elsif workspace.selected == nil + puts "No selection was made. Select user or select channel for details." + end + + #------------- SEND MESSAGE-------------------------------- + elsif user_input == options[5] #send message + #check if a selected is not !=nil + if workspace.selected != nil + #if true, prompt user: "what's your message" + puts "What is your message?" + #get message + user_message = gets.chomp + #then send message to selected + payload = { + :channel => workspace.selected.id, + :text => user_message, + :token => ENV['SLACK_TOKEN'] + } + payload_options = { + :body => payload + } + url = ENV['BASE_URL'] + ENV['SUB_MESSAGE_URL'] + HTTParty.post(url, payload_options) + #if it is nil, + else + #prompt user select before a message can be sent + puts "Select a user or channel before a message can be sent." + end end - user_input = gets.chomp + puts "What is your next selection?" + user_input = gets.chomp #main prompt end # TODO project From ba8426e03366a80bc1992e8d7ef31417b6d617ee Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sat, 14 Mar 2020 20:09:37 -0700 Subject: [PATCH 24/35] formatting --- lib/workspace.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/workspace.rb b/lib/workspace.rb index c66fd697..8e1b14e8 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -9,8 +9,10 @@ class Workspace def initialize() Dotenv.load(__dir__ + "/" + "../.env") #https://github.com/bkeepers/dotenv - @users = SlackCli::User.load_all("#{ENV['BASE_URL'] + ENV['SUB_USER_URL'] + "token=#{ENV['SLACK_TOKEN']}"}") - @channels = SlackCli::Channel.load_all("#{ENV['BASE_URL'] + ENV['SUB_CHANNEL_URL'] + "token=#{ENV['SLACK_TOKEN']}"}") + url = ENV['BASE_URL'] + ENV['SUB_USER_URL'] + "token=" + ENV['SLACK_TOKEN'] + @users = SlackCli::User.load_all(url) + url = ENV['BASE_URL'] + ENV['SUB_CHANNEL_URL'] + "token=" + ENV['SLACK_TOKEN'] + @channels = SlackCli::Channel.load_all(url) @selected = nil end #initialize From 6c6a0ff6905e093356abde2f346dd53f954d11be Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sun, 15 Mar 2020 20:40:36 -0700 Subject: [PATCH 25/35] added test to channel and user --- lib/recipient.rb | 8 +++++- lib/slack.rb | 26 ++++--------------- lib/workspace.rb | 35 +++++++++++++++++++++++--- test/channel_test.rb | 57 ++++++++++++++++++++++++------------------ test/recipient_test.rb | 21 ++++++++++++++++ test/test_helper.rb | 4 +++ test/user_test.rb | 57 ++++++++++++++++++++++++------------------ test/workspace_test.rb | 26 +++++++++++++++++++ 8 files changed, 159 insertions(+), 75 deletions(-) create mode 100644 test/recipient_test.rb create mode 100644 test/workspace_test.rb diff --git a/lib/recipient.rb b/lib/recipient.rb index ac2b7618..2c36f337 100644 --- a/lib/recipient.rb +++ b/lib/recipient.rb @@ -6,9 +6,15 @@ class Recipient def initialize(id, name) @id = id + + if !name.is_a? String + raise ArgumentError.new("Invalid name, must be String") + end @name = name - end #initialize + end #initialize + + #--------------CLASS METHODS----------------------------------- private def self.load_all() #abstract method/template raise NotImplementedError, 'Implement me in a child class!' diff --git a/lib/slack.rb b/lib/slack.rb index 407f0853..9cfebc01 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -84,27 +84,11 @@ def main #------------- SEND MESSAGE-------------------------------- elsif user_input == options[5] #send message #check if a selected is not !=nil - if workspace.selected != nil - #if true, prompt user: "what's your message" - puts "What is your message?" - #get message - user_message = gets.chomp - #then send message to selected - payload = { - :channel => workspace.selected.id, - :text => user_message, - :token => ENV['SLACK_TOKEN'] - } - payload_options = { - :body => payload - } - url = ENV['BASE_URL'] + ENV['SUB_MESSAGE_URL'] - HTTParty.post(url, payload_options) - #if it is nil, - else - #prompt user select before a message can be sent - puts "Select a user or channel before a message can be sent." - end + puts "What is your message?" + #get message + user_message = gets.chomp + + workspace.send_message(user_message) end puts "What is your next selection?" user_input = gets.chomp #main prompt diff --git a/lib/workspace.rb b/lib/workspace.rb index 8e1b14e8..84583579 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -66,14 +66,43 @@ def find_channel(aUser_input) return found_channel end #---------------------------------------------------------------- + + #sends message + #input: aUser_message + #return:response code (int) + + def send_message(aUser_message) + response_code = nil + if self.selected != nil + #if true, prompt user: "what's your message" + + #then send message to selected + payload = { + :channel => self.selected.id, + :text => aUser_message, + :token => ENV['SLACK_TOKEN'] + } + payload_options = { + :body => payload + } + url = ENV['BASE_URL'] + ENV['SUB_MESSAGE_URL'] + response = HTTParty.post(url, payload_options) + return response.code + #if it is nil, + else + #prompt user to select before a message can be sent + puts "Select a user or channel before a message can be sent." + end + return response_code + end end #class end #module -test_workspace = SlackCli::Workspace.new +#test_workspace = SlackCli::Workspace.new # test_workspace.users.each do |user| # puts user.real_name # end -name = test_workspace.find_user("cheese") -puts name +#name = test_workspace.find_user("cheese") +#puts name diff --git a/test/channel_test.rb b/test/channel_test.rb index 5cece517..2efa528e 100644 --- a/test/channel_test.rb +++ b/test/channel_test.rb @@ -1,31 +1,38 @@ require_relative 'test_helper' require_relative '../lib/channel' -describe "Channel" do - describe "self.get" do - it "gets a list of channels and returns them as an HTTParty Response" do - result = {} - VCR.use_cassette("channel-list-endpoint") do - result = Channel.get("https://slack.com/api/channels.list") - end - expect(result).must_be_kind_of HTTParty::Response - expect(result["ok"]).must_equal true - end +describe SlackCli::Channel do + describe "Channel" do + describe "Channel Instantiation" do + it "creates an instance of a Channel" do + #create a known Channel + test_Channel = SlackCli::Channel.new(1, "testname", "testtopic", "testmember_count") + #expect a Channel + expect(test_Channel).must_be_kind_of SlackCli::Channel + expect(test_Channel.name).must_equal "testname" + end - it "raises an error when a call fails" do - VCR.use_cassette("channel-list-endpoint") do - expect {Channel.get("https://slack.com/api/bogus.endpoint")}.must_raise SlackAPIError - end - end - end #initialize + it "validates Channel paramters" do + expect{SlackCli::Channel.new(1, 12, "testtopic", "testmember_count")}.must_raise ArgumentError + end + + end #instance of Channel + + describe "self.load_all Channels method" do + it "returns a list all Channels" do + url = ENV['BASE_URL'] + ENV['SUB_CHANNEL_URL'] + "token=" + ENV['SLACK_TOKEN'] + VCR.use_cassette("channel-details") do + response = SlackCli::Channel.load_all(url) + response.each do |channel| + expect(channel).must_be_kind_of SlackCli::Channel + expect(channel).must_respond_to :id + end - #FROM DEVIN - describe "self.load_all" do - it "return a valid list of channels" do - result = [] - VCR.use_cassette("channel-list-endpoint") do - result = Channel.load_all - end + # make sure kate is in the Channels array + channel_app = response.find_all { |channel| channel.id == "CV649DWUV" } + expect(channel_app[0].name).must_equal "slack-api" + end + end end - end -end #class + end #class +end #modeul \ No newline at end of file diff --git a/test/recipient_test.rb b/test/recipient_test.rb new file mode 100644 index 00000000..25446a1c --- /dev/null +++ b/test/recipient_test.rb @@ -0,0 +1,21 @@ +require_relative 'test_helper' + +# url = ENV['BASE_URL'] + ENV['SUB_USER_URL'] + "token=" + ENV['SLACK_TOKEN'] +# url = ENV['BASE_URL'] + ENV['SUB_CHANNEL_URL'] + "token=" + ENV['SLACK_TOKEN'] + +describe SlackCli::Recipient do + describe "Recipient" do + describe 'Recipient Instantiation' do + it 'creates an instance of a recipient' do + test_recipient = SlackCli::Recipient.new("1", "testname") + #expects a recipient to be a recipiene object + expect(test_recipient).must_be_kind_of SlackCli::Recipient + expect(test_recipient.name).must_equal "testname" + end + + it "validates Recipient paramters" do + expect{SlackCli::Recipient.new("1", 2)}.must_raise ArgumentError + end + end #initialize + end #class +end #module \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index c7909f90..d0e363a2 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -10,6 +10,8 @@ require 'vcr' require 'dotenv' +Dotenv.load(__dir__ + "/" + "../.env") #https://github.com/bkeepers/dotenv + Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new VCR.configure do |config| @@ -20,9 +22,11 @@ VCR.configure do |config| config.cassette_library_dir = "test/cassettes" # folder where casettes will be located config.hook_into :webmock # tie into this other tool called webmock + #config.debug_logger = File.open(ARGV.first, 'w') 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 + # :allow_http_connections_when_no_cassette => true, } # Don't leave our token lying around in a cassette file. diff --git a/test/user_test.rb b/test/user_test.rb index 5f7f60a1..720c7c4b 100644 --- a/test/user_test.rb +++ b/test/user_test.rb @@ -1,31 +1,38 @@ require_relative 'test_helper' require_relative '../lib/user' -describe "User" do - describe "self.get" do - it "gets a list of users and returns them as an HTTParty Response" do - result = {} - VCR.use_cassette("user-list-endpoint") do - result = Channel.get("https://slack.com/api/users.list") - end - expect(result).must_be_kind_of HTTParty::Response - expect(result["ok"]).must_equal true - end +describe SlackCli::User do + describe "User" do + describe "User Instantiation" do + it "creates an instance of a user" do + #create a known user + test_user = SlackCli::User.new("1", "testname", "testrealname", "testtext", "testemoji") + #expect a user + expect(test_user).must_be_kind_of SlackCli::User + expect(test_user.name).must_equal "testname" + end - it "raises an error when a call fails" do - VCR.use_cassette("user-list-endpoint") do - expect {User.get("https://slack.com/api/bogus.endpoint")}.must_raise SlackAPIError - end - end - end #initialize + it "validates User paramters" do + expect{SlackCli::User.new("1", 12, "testrealname", "testtext", "testemoji")}.must_raise ArgumentError + end + + end #instance of user + + describe "self.load_all users method" do + it "returns a list all users" do + url = ENV['BASE_URL'] + ENV['SUB_USER_URL'] + "token=" + ENV['SLACK_TOKEN'] + VCR.use_cassette("user-details") do + response = SlackCli::User.load_all(url) + response.each do |user| + expect(user).must_be_kind_of SlackCli::User + expect(user).must_respond_to :id + end - #FROM DEVIN - describe "self.load_all" do - it "return a valid list of users" do - result = [] - VCR.use_cassette("user-list-endpoint") do - result = User.load_all - end + # make sure kate is in the users array + user_app = response.find_all { |user| user.id == "UV3CAV859" } + expect(user_app[0].name).must_equal "space_kate_m_api_proj" + end + end end - end -end #class \ No newline at end of file + end #class +end #modeul \ No newline at end of file diff --git a/test/workspace_test.rb b/test/workspace_test.rb new file mode 100644 index 00000000..ae8b90eb --- /dev/null +++ b/test/workspace_test.rb @@ -0,0 +1,26 @@ +require_relative 'test_helper' +#require_relative '../lib/user' +#require_relative '../lib/channel' +require_relative '../lib/workspace' + +describe SlackCli::Workspace do + describe "Workspace" do + describe "Workspace Instantiation" do + it "creates an instance of a workspace" do + puts "here" + # #create a known workspace + #VCR.use_cassette("workspace-details", :record => :new_episodes) do + #test_workspace = SlackCli::Workspace.new() + + #expect a workspace to be workspace object + #expect(test_workspace).must_be_kind_of SlackCli::Workspace + # # expect(test_workspace.name).must_equal "channelname" + #end + end + + # it "validates Channel paramters" do + # expect{SlackCli::Channel.new("1", 1, "channeltopic", "channelmembercount")}.must_raise ArgumentError + # end + end #instance of workspace + end #class +end #module \ No newline at end of file From 28875c9c81273af9218299f3bf6eb7b6df479f42 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sun, 15 Mar 2020 23:05:43 -0700 Subject: [PATCH 26/35] cassettes for all classes --- test/cassettes/channel-details.yml | 159 ++++++++++++++++ test/cassettes/sendmessage-details.yml | 79 ++++++++ test/cassettes/sendmessagechannel-details.yml | 79 ++++++++ test/cassettes/user-details.yml | 92 ++++++++++ test/cassettes/workspace-details.yml | 172 ++++++++++++++++++ 5 files changed, 581 insertions(+) create mode 100644 test/cassettes/channel-details.yml create mode 100644 test/cassettes/sendmessage-details.yml create mode 100644 test/cassettes/sendmessagechannel-details.yml create mode 100644 test/cassettes/user-details.yml create mode 100644 test/cassettes/workspace-details.yml diff --git a/test/cassettes/channel-details.yml b/test/cassettes/channel-details.yml new file mode 100644 index 00000000..db26ce3b --- /dev/null +++ b/test/cassettes/channel-details.yml @@ -0,0 +1,159 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/channels.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '685' + Connection: + - keep-alive + Date: + - Mon, 16 Mar 2020 03:42:46 GMT + Server: + - Apache + X-Slack-Req-Id: + - 716654cd549ef8b4ea0dcf524387250f + X-Oauth-Scopes: + - channels:read,users:read,chat:write + X-Accepted-Oauth-Scopes: + - channels:read + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Slack-Backend: + - h + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-qort + X-Cache: + - Miss from cloudfront + Via: + - 1.1 27a84054de24e45f952ea4056a821764.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - N1408KVuj7_kgqqMzxOAaPJvGc620BZxaK47BWGCgW5xN1gh5yJXxA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CV5KRSHJQ","name":"general","is_channel":true,"created":1583868608,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UUT9Z80AE","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"members":["UUTA3S16E","UV63Y1672","UUUKJ03NX","UUW1CJZ41","UUT9Z80AE"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UUT9Z80AE","last_set":1583868608},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UUT9Z80AE","last_set":1583868608},"previous_names":[],"num_members":5},{"id":"CV649DWUV","name":"slack-api","is_channel":true,"created":1583868609,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UUT9Z80AE","name_normalized":"slack-api","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UUTA3S16E","UV63Y1672","UV3CAV859","UUUKJ03NX","UUTJAGAEN","UUW1CJZ41","UUT9Z80AE"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0},"previous_names":[],"num_members":7},{"id":"CV7V4KYLF","name":"random","is_channel":true,"created":1583868609,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UUT9Z80AE","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"members":["UUTA3S16E","UV63Y1672","UUUKJ03NX","UUW1CJZ41","UUT9Z80AE"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UUT9Z80AE","last_set":1583868609},"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":"UUT9Z80AE","last_set":1583868609},"previous_names":[],"num_members":5},{"id":"CVASS4US0","name":"test","is_channel":true,"created":1584050770,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UUT9Z80AE","name_normalized":"test","is_shared":false,"is_org_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"members":["UUT9Z80AE"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0},"previous_names":[],"num_members":1},{"id":"CVBS8GW8M","name":"dianas_test_channel","is_channel":true,"created":1584078400,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UUTA3S16E","name_normalized":"dianas_test_channel","is_shared":false,"is_org_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"members":["UUTA3S16E"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0},"previous_names":[],"num_members":1}],"response_metadata":{"next_cursor":""}}' + http_version: null + recorded_at: Mon, 16 Mar 2020 03:42:46 GMT +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: channel=UUUKJ03NX&text=so%20many%20testssss&token= + 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: + - '335' + Connection: + - keep-alive + Date: + - Mon, 16 Mar 2020 05:47:58 GMT + Server: + - Apache + X-Slack-Req-Id: + - 96c4e7ec1acefdb251af9e3254db6925 + X-Oauth-Scopes: + - channels:read,users:read,chat:write + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Slack-Backend: + - h + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-s6gv + X-Cache: + - Miss from cloudfront + Via: + - 1.1 ddaf46a95abcfc80e8eae76235e2127c.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - ukt5c3YHpnteIfTMz7b2wmvfzDHxgnqbB2UwrnPwJhd23ewG-VLGaQ== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"DV22X6K6E","ts":"1584337679.000200","message":{"bot_id":"BV3CAV7UK","type":"message","text":"so + many testssss","user":"UV3CAV859","ts":"1584337679.000200","team":"TV63QKAAU","bot_profile":{"id":"BV3CAV7UK","deleted":false,"name":"Space- + Kate M - API Project","updated":1584239628,"app_id":"AV22W21DG","icons":{"image_36":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_36.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/service_72.png"},"team_id":"TV63QKAAU"}}}' + http_version: null + recorded_at: Mon, 16 Mar 2020 05:47:59 GMT +recorded_with: VCR 5.1.0 diff --git a/test/cassettes/sendmessage-details.yml b/test/cassettes/sendmessage-details.yml new file mode 100644 index 00000000..0dff0bc9 --- /dev/null +++ b/test/cassettes/sendmessage-details.yml @@ -0,0 +1,79 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: channel=UUUKJ03NX&text=so%20many%20testssss&token= + 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: + - '335' + Connection: + - keep-alive + Date: + - Mon, 16 Mar 2020 05:48:33 GMT + Server: + - Apache + X-Slack-Req-Id: + - f4102348d47241a1416e2ee786cead37 + X-Oauth-Scopes: + - channels:read,users:read,chat:write + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Slack-Backend: + - h + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-fmpy + X-Cache: + - Miss from cloudfront + Via: + - 1.1 0cf6c59c77f0fff670ae085179adc459.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - QZ-OEYLD22psusN_i-KNG71Wag1G4B_FYCpVt8M1KdRyjtH4-_6VpA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"DV22X6K6E","ts":"1584337713.000400","message":{"bot_id":"BV3CAV7UK","type":"message","text":"so + many testssss","user":"UV3CAV859","ts":"1584337713.000400","team":"TV63QKAAU","bot_profile":{"id":"BV3CAV7UK","deleted":false,"name":"Space- + Kate M - API Project","updated":1584239628,"app_id":"AV22W21DG","icons":{"image_36":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_36.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/service_72.png"},"team_id":"TV63QKAAU"}}}' + http_version: null + recorded_at: Mon, 16 Mar 2020 05:48:34 GMT +recorded_with: VCR 5.1.0 diff --git a/test/cassettes/sendmessagechannel-details.yml b/test/cassettes/sendmessagechannel-details.yml new file mode 100644 index 00000000..388acb86 --- /dev/null +++ b/test/cassettes/sendmessagechannel-details.yml @@ -0,0 +1,79 @@ +--- +http_interactions: +- request: + method: post + uri: https://slack.com/api/chat.postMessage + body: + encoding: UTF-8 + string: channel=CV649DWUV&text=so%20many%20testssss&token= + 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: + - '334' + Connection: + - keep-alive + Date: + - Mon, 16 Mar 2020 05:53:59 GMT + Server: + - Apache + X-Slack-Req-Id: + - eca49e5b9a7fe0a62c5c0098794c5771 + X-Oauth-Scopes: + - channels:read,users:read,chat:write + X-Accepted-Oauth-Scopes: + - chat:write + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Slack-Backend: + - h + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-gnio + X-Cache: + - Miss from cloudfront + Via: + - 1.1 7514e5e25722778fd4b1744d4ecc67e1.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - t4VAhnTFfpv6qmw-6G6-tk28LDO1eCW3rLgzdHGRcr9JYWx-JG4_4g== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channel":"CV649DWUV","ts":"1584338039.001200","message":{"bot_id":"BV3CAV7UK","type":"message","text":"so + many testssss","user":"UV3CAV859","ts":"1584338039.001200","team":"TV63QKAAU","bot_profile":{"id":"BV3CAV7UK","deleted":false,"name":"Space- + Kate M - API Project","updated":1584239628,"app_id":"AV22W21DG","icons":{"image_36":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_36.png","image_48":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/bot_48.png","image_72":"https:\/\/a.slack-edge.com\/80588\/img\/plugins\/app\/service_72.png"},"team_id":"TV63QKAAU"}}}' + http_version: null + recorded_at: Mon, 16 Mar 2020 05:54:00 GMT +recorded_with: VCR 5.1.0 diff --git a/test/cassettes/user-details.yml b/test/cassettes/user-details.yml new file mode 100644 index 00000000..5cdd48eb --- /dev/null +++ b/test/cassettes/user-details.yml @@ -0,0 +1,92 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '2290' + Connection: + - keep-alive + Date: + - Mon, 16 Mar 2020 03:34:54 GMT + Server: + - Apache + X-Slack-Req-Id: + - 4412241d1f5aac098d68517170d50b50 + X-Oauth-Scopes: + - channels:read,users:read,chat:write + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Slack-Backend: + - h + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-83yj + X-Cache: + - Miss from cloudfront + Via: + - 1.1 1949caaabae48a894fcd770a3e1384f7.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - "-vve0Ej6-ulrrFP9ETdC8R_hiXXPSbYx5J9gIR_5t5_Z0bBV2DaRyA==" + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TV63QKAAU","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":"TV63QKAAU"},"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":"UUT9Z80AE","team_id":"TV63QKAAU","name":"thenora","deleted":false,"color":"9f69e7","real_name":"Nora","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Nora","real_name_normalized":"Nora","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gecfa8e6728a","first_name":"Nora","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1583868865},{"id":"UUTA3S16E","team_id":"TV63QKAAU","name":"nguyen_diana","deleted":false,"color":"3c989f","real_name":"Diana + Nguyen","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Diana + Nguyen","real_name_normalized":"Diana Nguyen","display_name":"Diana Nguyen","display_name_normalized":"Diana + Nguyen","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g53546304cba","image_24":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1583876186},{"id":"UUTJAGAEN","team_id":"TV63QKAAU","name":"time_yolotzin_api_pro","deleted":false,"color":"e96699","real_name":"time_yolotzin_api_pro","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"time_yolotzin_api_pro","real_name_normalized":"time_yolotzin_api_pro","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3ed47f067f5","api_app_id":"AV68RSJH3","always_active":false,"bot_id":"BV881SK2B","image_24":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-512.png","status_text_canonical":"","team":"TV63QKAAU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1583877148},{"id":"UUUKJ03NX","team_id":"TV63QKAAU","name":"kate.d.mangubat","deleted":false,"color":"4bbe2e","real_name":"Kate + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kate + M","real_name_normalized":"Kate M","display_name":"Kate","display_name_normalized":"Kate","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g078604cbcfb","first_name":"Kate","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1583997418},{"id":"UUW1CJZ41","team_id":"TV63QKAAU","name":"yltzndnbr","deleted":false,"color":"e7392d","real_name":"Yolotzin + Dunbar","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Yolotzin + Dunbar","real_name_normalized":"Yolotzin Dunbar","display_name":"Yoyo","display_name_normalized":"Yoyo","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g574a1cc3875","first_name":"Yolotzin","last_name":"Dunbar","image_24":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1584083810},{"id":"UV3CAV859","team_id":"TV63QKAAU","name":"space_kate_m_api_proj","deleted":false,"color":"99a949","real_name":"space_kate_m_api_proj","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"space_kate_m_api_proj","real_name_normalized":"space_kate_m_api_proj","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gbabfb89bbad","api_app_id":"AV22W21DG","always_active":false,"bot_id":"BV3CAV7UK","image_24":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-512.png","status_text_canonical":"","team":"TV63QKAAU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1584239628},{"id":"UV63Y1672","team_id":"TV63QKAAU","name":"tithvorlakmok","deleted":false,"color":"674b1b","real_name":"Lak","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Lak","real_name_normalized":"Lak","display_name":"Lak","display_name_normalized":"Lak","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gfc5b2d94a48","image_24":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1583869256},{"id":"UV66LJW5A","team_id":"TV63QKAAU","name":"noras_api","deleted":false,"color":"684b6c","real_name":"Nora + API","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Nora + API","real_name_normalized":"Nora API","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"46a0f74c1fda","api_app_id":"AV6LEP79B","always_active":false,"image_original":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_original.jpg","is_custom_image":true,"bot_id":"BV8FZCLK1","first_name":"Nora","last_name":"API","image_24":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_72.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_192.jpg","image_512":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_512.jpg","image_1024":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_1024.jpg","status_text_canonical":"","team":"TV63QKAAU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1584322293},{"id":"UV8PJ6R0W","team_id":"TV63QKAAU","name":"diana_slack_cli","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"diana_slack_cli","real_name_normalized":"diana_slack_cli","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"c8e976fcbc63","api_app_id":"AUWEPCVDF","always_active":false,"image_original":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_original.jpg","is_custom_image":true,"bot_id":"BUTPL5J58","first_name":"diana_slack_cli","last_name":"","image_24":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_72.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_192.jpg","image_512":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_512.jpg","image_1024":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_1024.jpg","status_text_canonical":"","team":"TV63QKAAU"},"is_bot":true,"is_app_user":false,"updated":1584228234},{"id":"UVAALE528","team_id":"TV63QKAAU","name":"github","deleted":false,"color":"2b6836","real_name":"GitHub","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"GitHub","real_name_normalized":"GitHub","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"a384f3b8cb58","api_app_id":"A8GBNUWU8","always_active":true,"image_original":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_original.png","is_custom_image":true,"bot_id":"BVAALE484","image_24":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_24.png","image_32":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_32.png","image_48":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_48.png","image_72":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_72.png","image_192":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_192.png","image_512":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_512.png","image_1024":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_1024.png","status_text_canonical":"","team":"TV63QKAAU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":true,"updated":1584036089},{"id":"UVB4TQ89M","team_id":"TV63QKAAU","name":"lak_slackapi","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"lak_slackapi","real_name_normalized":"lak_slackapi","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g6ea0fcda828","api_app_id":"AV998UM2R","always_active":false,"bot_id":"BV98UFAHE","image_24":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-512.png","status_text_canonical":"","team":"TV63QKAAU"},"is_bot":true,"is_app_user":false,"updated":1584323188}],"cache_ts":1584329694,"response_metadata":{"next_cursor":""}}' + http_version: null + recorded_at: Mon, 16 Mar 2020 03:34:54 GMT +recorded_with: VCR 5.1.0 diff --git a/test/cassettes/workspace-details.yml b/test/cassettes/workspace-details.yml new file mode 100644 index 00000000..aa5eaad6 --- /dev/null +++ b/test/cassettes/workspace-details.yml @@ -0,0 +1,172 @@ +--- +http_interactions: +- request: + method: get + uri: https://slack.com/api/users.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '2291' + Connection: + - keep-alive + Date: + - Mon, 16 Mar 2020 03:42:45 GMT + Server: + - Apache + X-Slack-Req-Id: + - 64aa598819eb843643a4e9ca38d03af6 + X-Oauth-Scopes: + - channels:read,users:read,chat:write + X-Accepted-Oauth-Scopes: + - users:read + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Slack-Backend: + - h + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-c20e + X-Cache: + - Miss from cloudfront + Via: + - 1.1 331202b5b8aab67acbf389883133f257.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - exuH6P8xLEYcOYxY5XM0U8NL54x8EdIfyLerg2jD0YtsVPE6HflkNA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TV63QKAAU","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":"TV63QKAAU"},"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":"UUT9Z80AE","team_id":"TV63QKAAU","name":"thenora","deleted":false,"color":"9f69e7","real_name":"Nora","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Nora","real_name_normalized":"Nora","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gecfa8e6728a","first_name":"Nora","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/ecfa8e6728af18fdb2a467aed6cc4688.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0005-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1583868865},{"id":"UUTA3S16E","team_id":"TV63QKAAU","name":"nguyen_diana","deleted":false,"color":"3c989f","real_name":"Diana + Nguyen","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Diana + Nguyen","real_name_normalized":"Diana Nguyen","display_name":"Diana Nguyen","display_name_normalized":"Diana + Nguyen","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g53546304cba","image_24":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/53546304cba703fdbcc3d6eadf959046.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1583876186},{"id":"UUTJAGAEN","team_id":"TV63QKAAU","name":"time_yolotzin_api_pro","deleted":false,"color":"e96699","real_name":"time_yolotzin_api_pro","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"time_yolotzin_api_pro","real_name_normalized":"time_yolotzin_api_pro","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g3ed47f067f5","api_app_id":"AV68RSJH3","always_active":false,"bot_id":"BV881SK2B","image_24":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3ed47f067f52bf041336c4087124e81a.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-512.png","status_text_canonical":"","team":"TV63QKAAU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1583877148},{"id":"UUUKJ03NX","team_id":"TV63QKAAU","name":"kate.d.mangubat","deleted":false,"color":"4bbe2e","real_name":"Kate + M","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Kate + M","real_name_normalized":"Kate M","display_name":"Kate","display_name_normalized":"Kate","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g078604cbcfb","first_name":"Kate","last_name":"M","image_24":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/078604cbcfb8a676a713a3a870a026f9.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1583997418},{"id":"UUW1CJZ41","team_id":"TV63QKAAU","name":"yltzndnbr","deleted":false,"color":"e7392d","real_name":"Yolotzin + Dunbar","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Yolotzin + Dunbar","real_name_normalized":"Yolotzin Dunbar","display_name":"Yoyo","display_name_normalized":"Yoyo","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g574a1cc3875","first_name":"Yolotzin","last_name":"Dunbar","image_24":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/574a1cc387525e2e334bb718a551e3a7.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0026-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1584083810},{"id":"UV3CAV859","team_id":"TV63QKAAU","name":"space_kate_m_api_proj","deleted":false,"color":"99a949","real_name":"space_kate_m_api_proj","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"space_kate_m_api_proj","real_name_normalized":"space_kate_m_api_proj","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gbabfb89bbad","api_app_id":"AV22W21DG","always_active":false,"bot_id":"BV3CAV7UK","image_24":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/babfb89bbada2418eed047a5eb3a5132.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0012-512.png","status_text_canonical":"","team":"TV63QKAAU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1584239628},{"id":"UV63Y1672","team_id":"TV63QKAAU","name":"tithvorlakmok","deleted":false,"color":"674b1b","real_name":"Lak","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Lak","real_name_normalized":"Lak","display_name":"Lak","display_name_normalized":"Lak","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gfc5b2d94a48","image_24":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/fc5b2d94a48b155ada6a0aee8b0882a8.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0010-512.png","status_text_canonical":"","team":"TV63QKAAU"},"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":1583869256},{"id":"UV66LJW5A","team_id":"TV63QKAAU","name":"noras_api","deleted":false,"color":"684b6c","real_name":"Nora + API","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Nora + API","real_name_normalized":"Nora API","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"46a0f74c1fda","api_app_id":"AV6LEP79B","always_active":false,"image_original":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_original.jpg","is_custom_image":true,"bot_id":"BV8FZCLK1","first_name":"Nora","last_name":"API","image_24":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_72.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_192.jpg","image_512":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_512.jpg","image_1024":"https:\/\/avatars.slack-edge.com\/2020-03-15\/988889716034_46a0f74c1fda75680243_1024.jpg","status_text_canonical":"","team":"TV63QKAAU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":false,"updated":1584322293},{"id":"UV8PJ6R0W","team_id":"TV63QKAAU","name":"diana_slack_cli","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"diana_slack_cli","real_name_normalized":"diana_slack_cli","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"c8e976fcbc63","api_app_id":"AUWEPCVDF","always_active":false,"image_original":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_original.jpg","is_custom_image":true,"bot_id":"BUTPL5J58","first_name":"diana_slack_cli","last_name":"","image_24":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_72.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_192.jpg","image_512":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_512.jpg","image_1024":"https:\/\/avatars.slack-edge.com\/2020-03-11\/983924921969_c8e976fcbc63dabe20be_1024.jpg","status_text_canonical":"","team":"TV63QKAAU"},"is_bot":true,"is_app_user":false,"updated":1584228234},{"id":"UVAALE528","team_id":"TV63QKAAU","name":"github","deleted":false,"color":"2b6836","real_name":"GitHub","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"GitHub","real_name_normalized":"GitHub","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"a384f3b8cb58","api_app_id":"A8GBNUWU8","always_active":true,"image_original":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_original.png","is_custom_image":true,"bot_id":"BVAALE484","image_24":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_24.png","image_32":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_32.png","image_48":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_48.png","image_72":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_72.png","image_192":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_192.png","image_512":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_512.png","image_1024":"https:\/\/avatars.slack-edge.com\/2020-03-12\/986735341441_a384f3b8cb58f2705e8a_1024.png","status_text_canonical":"","team":"TV63QKAAU"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"is_app_user":true,"updated":1584036089},{"id":"UVB4TQ89M","team_id":"TV63QKAAU","name":"lak_slackapi","deleted":true,"profile":{"title":"","phone":"","skype":"","real_name":"lak_slackapi","real_name_normalized":"lak_slackapi","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"g6ea0fcda828","api_app_id":"AV998UM2R","always_active":false,"bot_id":"BV98UFAHE","image_24":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/6ea0fcda82863d18be01442fb08dc35b.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0017-512.png","status_text_canonical":"","team":"TV63QKAAU"},"is_bot":true,"is_app_user":false,"updated":1584323188}],"cache_ts":1584330165,"response_metadata":{"next_cursor":""}}' + http_version: null + recorded_at: Mon, 16 Mar 2020 03:42:45 GMT +- request: + method: get + uri: https://slack.com/api/channels.list?token= + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '692' + Connection: + - keep-alive + Date: + - Mon, 16 Mar 2020 03:42:46 GMT + Server: + - Apache + X-Slack-Req-Id: + - 361b62882f18a3245a08b471e7f38eeb + X-Oauth-Scopes: + - channels:read,users:read,chat:write + X-Accepted-Oauth-Scopes: + - channels:read + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Slack-Backend: + - h + X-Content-Type-Options: + - nosniff + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + X-Xss-Protection: + - '0' + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, + x-b3-sampled, x-b3-flags + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-nxpy + X-Cache: + - Miss from cloudfront + Via: + - 1.1 2e20768704c71ff3ce2e677251d27f3c.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C1 + X-Amz-Cf-Id: + - _-sehigPTNC8OnAL8xBqLV9JD0WYc0hWLa7IAFNarsbE5dqkHZFGhA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CV5KRSHJQ","name":"general","is_channel":true,"created":1583868608,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UUT9Z80AE","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"members":["UV63Y1672","UUTA3S16E","UUUKJ03NX","UUT9Z80AE","UUW1CJZ41"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UUT9Z80AE","last_set":1583868608},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UUT9Z80AE","last_set":1583868608},"previous_names":[],"num_members":5},{"id":"CV649DWUV","name":"slack-api","is_channel":true,"created":1583868609,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UUT9Z80AE","name_normalized":"slack-api","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UV3CAV859","UV63Y1672","UUTA3S16E","UUUKJ03NX","UUT9Z80AE","UUW1CJZ41","UUTJAGAEN"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0},"previous_names":[],"num_members":7},{"id":"CV7V4KYLF","name":"random","is_channel":true,"created":1583868609,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UUT9Z80AE","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"members":["UV63Y1672","UUTA3S16E","UUUKJ03NX","UUT9Z80AE","UUW1CJZ41"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UUT9Z80AE","last_set":1583868609},"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":"UUT9Z80AE","last_set":1583868609},"previous_names":[],"num_members":5},{"id":"CVASS4US0","name":"test","is_channel":true,"created":1584050770,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UUT9Z80AE","name_normalized":"test","is_shared":false,"is_org_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"members":["UUT9Z80AE"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0},"previous_names":[],"num_members":1},{"id":"CVBS8GW8M","name":"dianas_test_channel","is_channel":true,"created":1584078400,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UUTA3S16E","name_normalized":"dianas_test_channel","is_shared":false,"is_org_shared":false,"is_member":false,"is_private":false,"is_mpim":false,"members":["UUTA3S16E"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0},"previous_names":[],"num_members":1}],"response_metadata":{"next_cursor":""}}' + http_version: null + recorded_at: Mon, 16 Mar 2020 03:42:46 GMT +recorded_with: VCR 5.1.0 From e6e67e502666eb7cf2c8e113b556a3c7eb89f4b6 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sun, 15 Mar 2020 23:06:31 -0700 Subject: [PATCH 27/35] formatted workspace.rb --- lib/workspace.rb | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/workspace.rb b/lib/workspace.rb index 84583579..ec782102 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -18,7 +18,7 @@ def initialize() #--------------------------Class Methods ------------------------ - #Returns all valid user id and name + #Returns all valid user id and name [Strings] # inputs: aMode that's either "user" or "channel" def valid_inputs_id_names(aMode) valid_inputs = [] @@ -39,8 +39,8 @@ def valid_inputs_id_names(aMode) #---------------------------------------------------------------- #finds a user - #input: aUser_input - #Returns a found user + #input: aUser_input (String) + #Returns a found user (User Oject) def find_user(aUser_input) found_user = nil self.users.each do |user| @@ -54,8 +54,8 @@ def find_user(aUser_input) #---------------------------------------------------------------- #finds a channel - #input: aUser_input - #Returns a found channel + #input: aUser_input (String) + #Returns a found channel (Channel Object) def find_channel(aUser_input) found_channel = nil self.channels.each do |channel| @@ -68,8 +68,8 @@ def find_channel(aUser_input) #---------------------------------------------------------------- #sends message - #input: aUser_message - #return:response code (int) + #input: aUser_message (String) + #return:response code (int) = 200 means "ok" def send_message(aUser_message) response_code = nil @@ -98,11 +98,3 @@ def send_message(aUser_message) end #class end #module -#test_workspace = SlackCli::Workspace.new -# test_workspace.users.each do |user| -# puts user.real_name -# end - -#name = test_workspace.find_user("cheese") -#puts name - From e8de025d415f076bbfcd8df88dc3452e9a3107d5 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sun, 15 Mar 2020 23:07:22 -0700 Subject: [PATCH 28/35] removed comments --- test/test_helper.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index d0e363a2..22ded199 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -22,11 +22,9 @@ VCR.configure do |config| config.cassette_library_dir = "test/cassettes" # folder where casettes will be located config.hook_into :webmock # tie into this other tool called webmock - #config.debug_logger = File.open(ARGV.first, 'w') 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 - # :allow_http_connections_when_no_cassette => true, } # Don't leave our token lying around in a cassette file. From 5f8ba50df4883ce68e55d6ec379c06e1c2461243 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sun, 15 Mar 2020 23:08:08 -0700 Subject: [PATCH 29/35] completed tests --- test/user_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/user_test.rb b/test/user_test.rb index 720c7c4b..f02db901 100644 --- a/test/user_test.rb +++ b/test/user_test.rb @@ -35,4 +35,4 @@ end end end #class -end #modeul \ No newline at end of file +end #module \ No newline at end of file From dcfbeed3e1419730c5a9ce0770671318737734d8 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sun, 15 Mar 2020 23:08:23 -0700 Subject: [PATCH 30/35] completed tests --- test/workspace_test.rb | 96 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 84 insertions(+), 12 deletions(-) diff --git a/test/workspace_test.rb b/test/workspace_test.rb index ae8b90eb..963bca5b 100644 --- a/test/workspace_test.rb +++ b/test/workspace_test.rb @@ -5,22 +5,94 @@ describe SlackCli::Workspace do describe "Workspace" do + before do + #create an instance of a workspace + VCR.use_cassette("workspace-details") do + @test_workspace = SlackCli::Workspace.new() + end + end + describe "Workspace Instantiation" do it "creates an instance of a workspace" do - puts "here" - # #create a known workspace - #VCR.use_cassette("workspace-details", :record => :new_episodes) do - #test_workspace = SlackCli::Workspace.new() + #expect a workspace to be workspace object + expect(@test_workspace).must_be_kind_of SlackCli::Workspace + assert_nil(@test_workspace.selected) + end + end #instance of workspace - #expect a workspace to be workspace object - #expect(test_workspace).must_be_kind_of SlackCli::Workspace - # # expect(test_workspace.name).must_equal "channelname" - #end + describe "valid_inputs_id_names method" do + it "returns all valid ids and names based on user" do + valid_inputs = @test_workspace.valid_inputs_id_names("user") + user_array = valid_inputs.find_all { |user| user == "kate.d.mangubat" } + expect(user_array[0]).must_equal "kate.d.mangubat" + valid_inputs = @test_workspace.valid_inputs_id_names("blahblah") + expect(valid_inputs.length).must_equal 0 end - # it "validates Channel paramters" do - # expect{SlackCli::Channel.new("1", 1, "channeltopic", "channelmembercount")}.must_raise ArgumentError - # end - end #instance of workspace + it "returns all valid ids and names based on channel" do + valid_inputs = @test_workspace.valid_inputs_id_names("channel") + channels = valid_inputs.find_all { |channel| channel == "slack-api" } + expect(channels[0]).must_equal "slack-api" + end + end + + describe "find_user method" do + it "finds a user based on input by a user" do + #find me: kate.d.mangubat (nominal test) + found_user = @test_workspace.find_user("kate.d.mangubat") + expect(found_user.name).must_equal "kate.d.mangubat" + #doesn't find user (edge case) + found_user = @test_workspace.find_user("blahblahhblah") + assert_nil(found_user) + end + end + + describe "find_channel method" do + it "finds a channel based on input by a user" do + #find slack-api (nominal test) + found_channel = @test_workspace.find_channel("slack-api") + expect(found_channel.name).must_equal "slack-api" + #doesn't find channel (edge case) + found_channel = @test_workspace.find_channel("blahblahhblah") + assert_nil(found_channel) + end + end + + describe "send_message method" do + it "send message to user" do + VCR.use_cassette("sendmessage-details") do + #NOMINAL need to select a user + found_user = @test_workspace.find_user("kate.d.mangubat") + #save selectes user + @test_workspace.selected = found_user + #send message to my id: "UUUKJ03NX" + #message "so many testsssssss" + response_code = @test_workspace.send_message("so many testssss") + #returns response code which is set to nil + expect(response_code).must_equal 200 + #EDGE CASE + @test_workspace.selected = nil + response_code = @test_workspace.send_message("so many testssss") + expect(response_code).must_equal nil + end + end + + it "sends message to channel" do + VCR.use_cassette("sendmessagechannel-details") do + #need to select a channel + found_channel = @test_workspace.find_channel("slack-api") + #save selectes channel + @test_workspace.selected = found_channel + #send message to channel: "slack-api" + #message "so many testsssssss" + response_code = @test_workspace.send_message("so many testssss") + #returns response code which is set to nil + expect(response_code).must_equal 200 + end + end + + end #send message method + + end #class end #module \ No newline at end of file From d2236a483051620918d0c26af9130b28e13f9452 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sun, 15 Mar 2020 23:09:00 -0700 Subject: [PATCH 31/35] updated gitignore to exclude history and coverage --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 3ff4fada..689b4205 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ /coverage/ +coverage/ .DS_Store # Ignore environemnt variables .env + +#Ignore history +.history From 84ec7f2aaa4987e12b07201ae18f207671d666f2 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Sun, 15 Mar 2020 23:10:28 -0700 Subject: [PATCH 32/35] updated to ignore launch.json --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 689b4205..8fa18cf6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ coverage/ #Ignore history .history + +#launch.Json file +launch.json \ No newline at end of file From 8b68971031341e4450e18a9fcf31e491a31939d6 Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Mon, 16 Mar 2020 00:00:28 -0700 Subject: [PATCH 33/35] formatted --- lib/channel.rb | 12 +----------- lib/user.rb | 19 ------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/lib/channel.rb b/lib/channel.rb index 3c6c9ac1..703f4dca 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -34,15 +34,5 @@ def self.load_all(url) end return channels end #load_all method - - end #class -end #module - -# testchannels = SlackCli::Channel.load_all -# testchannels.each do |channel| -# puts channel.id -# puts channel.name -# puts channel.topic -# puts channel.member_count -# end \ No newline at end of file +end #module \ No newline at end of file diff --git a/lib/user.rb b/lib/user.rb index 80b9c60c..3a959f1f 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -23,13 +23,6 @@ def self.load_all(url) response = HTTParty.get(url) #request that will return the response #parse response and get users response['members'].each do |member| - # "id": "UUUKJ03NX", - # "team_id": "TV63QKAAU", - # "name": "kate.d.mangubat", - # "deleted": false, - # "color": "4bbe2e", - # "real_name": "Kate Mangubat" - #create a user id = member["id"] name = member["name"] @@ -44,17 +37,5 @@ def self.load_all(url) end return users end #load_all method - end #class end #module - -# testuser = SlackCli::User.new(1, "kate", "katem") -# puts testuser.handle -# all_users = SlackCli::User.load_all - -# all_users.each do |user| -# puts user.name -# puts user.real_name -# puts user.status_text -# puts user.status_emoji -# end From 0d52e1e6d0efb791a1033f0f99c01ded6a59452f Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Mon, 16 Mar 2020 00:02:24 -0700 Subject: [PATCH 34/35] formatted --- lib/slack.rb | 3 --- test/channel_test.rb | 2 +- test/recipient_test.rb | 3 --- test/workspace_test.rb | 7 +------ 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/slack.rb b/lib/slack.rb index 9cfebc01..95deabc0 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -93,9 +93,6 @@ def main puts "What is your next selection?" user_input = gets.chomp #main prompt end - - # TODO project - puts "Thank you for using the Ada Slack CLI" end #main diff --git a/test/channel_test.rb b/test/channel_test.rb index 2efa528e..f74a7682 100644 --- a/test/channel_test.rb +++ b/test/channel_test.rb @@ -35,4 +35,4 @@ end end end #class -end #modeul \ No newline at end of file +end #module \ No newline at end of file diff --git a/test/recipient_test.rb b/test/recipient_test.rb index 25446a1c..8f001b98 100644 --- a/test/recipient_test.rb +++ b/test/recipient_test.rb @@ -1,8 +1,5 @@ require_relative 'test_helper' -# url = ENV['BASE_URL'] + ENV['SUB_USER_URL'] + "token=" + ENV['SLACK_TOKEN'] -# url = ENV['BASE_URL'] + ENV['SUB_CHANNEL_URL'] + "token=" + ENV['SLACK_TOKEN'] - describe SlackCli::Recipient do describe "Recipient" do describe 'Recipient Instantiation' do diff --git a/test/workspace_test.rb b/test/workspace_test.rb index 963bca5b..9d71ea11 100644 --- a/test/workspace_test.rb +++ b/test/workspace_test.rb @@ -1,6 +1,4 @@ require_relative 'test_helper' -#require_relative '../lib/user' -#require_relative '../lib/channel' require_relative '../lib/workspace' describe SlackCli::Workspace do @@ -90,9 +88,6 @@ expect(response_code).must_equal 200 end end - - end #send message method - - + end end #class end #module \ No newline at end of file From 4b66852e1548b51c200dc00b1ee2ccdb3bf51b4d Mon Sep 17 00:00:00 2001 From: Kate Mangubat Date: Thu, 26 Mar 2020 12:30:43 -0700 Subject: [PATCH 35/35] added response error --- lib/channel.rb | 3 +++ lib/user.rb | 3 +++ lib/workspace.rb | 25 ++++++++++++++----------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/channel.rb b/lib/channel.rb index 703f4dca..1815b8ae 100644 --- a/lib/channel.rb +++ b/lib/channel.rb @@ -20,6 +20,9 @@ def self.load_all(url) channels = [] #send request to Slack API using users.list endpoint response = HTTParty.get(url) #request that will return the response + if response.code != 200 || response["ok"] == false + raise SlackAPIError, "We encountered a problem: #{response["error"]}" + end #parse response and get users response['channels'].each do |channel| id = channel["id"] diff --git a/lib/user.rb b/lib/user.rb index 3a959f1f..9c021aa2 100644 --- a/lib/user.rb +++ b/lib/user.rb @@ -21,6 +21,9 @@ def self.load_all(url) users = [] #send request to Slack API using users.list endpoint response = HTTParty.get(url) #request that will return the response + if response.code != 200 || response["ok"] == false + raise SlackAPIError, "We encountered a problem: #{response["error"]}" + end #parse response and get users response['members'].each do |member| #create a user diff --git a/lib/workspace.rb b/lib/workspace.rb index ec782102..150958b6 100644 --- a/lib/workspace.rb +++ b/lib/workspace.rb @@ -76,17 +76,20 @@ def send_message(aUser_message) if self.selected != nil #if true, prompt user: "what's your message" - #then send message to selected - payload = { - :channel => self.selected.id, - :text => aUser_message, - :token => ENV['SLACK_TOKEN'] - } - payload_options = { - :body => payload - } - url = ENV['BASE_URL'] + ENV['SUB_MESSAGE_URL'] - response = HTTParty.post(url, payload_options) + #then send message to selected + payload = { + :channel => self.selected.id, + :text => aUser_message, + :token => ENV['SLACK_TOKEN'] + } + payload_options = { + :body => payload + } + url = ENV['BASE_URL'] + ENV['SUB_MESSAGE_URL'] + response = HTTParty.post(url, payload_options) + if response.code != 200 || response["ok"] == false + raise SlackAPIError, "We encountered a problem: #{response["error"]}" + end return response.code #if it is nil, else