diff --git a/.gitignore b/.gitignore index 8d6a243f..7bca64ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.env *.gem *.rbc /.config @@ -53,4 +54,4 @@ build-iPhoneSimulator/ .env # Ignore cassette files -/specs/cassettes/ +/test/cassettes/ diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 00000000..58e18732 --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1,57 @@ +.env +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# Used by dotenv library to load environment variables. +# .env + +## Specific to RubyMotion: +.dat* +.repl_history +build/ +*.bridgesupport +build-iPhoneOS/ +build-iPhoneSimulator/ + +## Specific to RubyMotion (use of CocoaPods): +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# vendor/Pods/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + +# Ignore environemnt variables +.env + +# Ignore cassette files +/specs/cassettes/ diff --git a/lib/channel.rb b/lib/channel.rb new file mode 100644 index 00000000..e5e69f47 --- /dev/null +++ b/lib/channel.rb @@ -0,0 +1,49 @@ +require 'httparty' +require 'dotenv' +Dotenv.load +require 'pry' +require_relative 'recipient' +require 'table_print' + +class Channel < Recipient + attr_reader :slack_id, :name, :topic, :member_count + @@channels_list = [] + BASE_URL = "https://slack.com/api/channels.list" + API_KEY = ENV['SLACK_API_TOKEN'] + + def initialize(slack_id, name, topic, member_count) + super(slack_id, name) + @topic = topic + @member_count = member_count + @@channels_list << self + end + + def self.list + query = { + token: API_KEY + } + response = HTTParty.get(BASE_URL, query: query) + + return response + end + + def self.printed_channels_list + channels_array = [] + + self.list["channels"].each do |channel| + channels_array << {"name" => channel["name"],"topic" => channel["purpose"]["value"], "Member Count"=> channel["num_members"], "Slack ID"=> channel["id"]} + end + + return channels_array + end + + def self.select_channel_details(desired_channel) + self.printed_channels_list.each do |channel| + if channel["name"] == desired_channel || channel["Slack ID"] == desired_channel + return channel + end + end + statement = "Not a valid Channel name/Slack ID" + return statement + end +end \ No newline at end of file diff --git a/lib/recipient.rb b/lib/recipient.rb new file mode 100644 index 00000000..c1d06ac0 --- /dev/null +++ b/lib/recipient.rb @@ -0,0 +1,14 @@ +class Recipient + attr_reader :slack_id, :name + class SlackApiError < Exception + end + + def initialize(slack_id, name) + @slack_id = slack_id + @name = name + end + + def self.list + raise NotImplementedError, "Implement me in a child class!" + end +end \ No newline at end of file diff --git a/lib/slack.rb b/lib/slack.rb index 960cf2f7..66edfdb3 100755 --- a/lib/slack.rb +++ b/lib/slack.rb @@ -1,10 +1,48 @@ #!/usr/bin/env ruby +require "httparty" +require_relative "channel" +require_relative "user" +require "dotenv" +Dotenv.load +require 'table_print' +require 'pry' def main - puts "Welcome to the Ada Slack CLI!" + puts"Welcome to the Ada Slack CLI!" + puts"Select an option by number:" + options_array=["List Channels","List Users","Select User","Select Channel","Quit"] + options_array.each_with_index{ |channel, index| + puts"#{index+1}.#{channel}" + } + + user_answer = gets.chomp.to_i + + while user_answer != 5 + if user_answer == 1 + Channel.printed_channels_list - # TODO project + elsif user_answer == 2 + puts User.printed_users_list + elsif user_answer == 3 + puts User.printed_users_list + puts "Please enter a username or Slack ID:" + desired_person = gets.chomp + puts User.select_user_details(desired_person) + + elsif user_answer == 4 + Channel.printed_channels_list + puts "Please enter a channel name or Slack ID" + desired_channel = gets.chomp + puts Channel.select_channel_details(desired_channel) + end + + puts "Select an option by number:" + options_array.each_with_index { |channel,index| + puts "#{index+1}.#{channel}" + } + user_answer = gets.chomp.to_i + end puts "Thank you for using the Ada Slack CLI" end diff --git a/lib/user.rb b/lib/user.rb new file mode 100644 index 00000000..c82b8840 --- /dev/null +++ b/lib/user.rb @@ -0,0 +1,44 @@ +require 'httparty' +require 'dotenv' +Dotenv.load +require 'pry' +require 'table_print' +class User < Recipient + attr_reader :slack_id, :name, :real_name + @@users_list = [] + BASE_URL = "https://slack.com/api/users.list" + API_KEY = ENV['SLACK_API_TOKEN'] + + def initialize(slack_id, name, real_name) + super(slack_id, name) + @real_name = real_name + @@users_list << self + end + + def self.list + query = { + token: API_KEY + } + response = HTTParty.get(BASE_URL, query: query) + return response + end + + def self.printed_users_list + users_array = [] + self.list["members"].each do |member| + users_array << {"User Name" => member["name"],"Real Name" => member["real_name"],"Slack ID"=> member["id"]} + end + return users_array + end + + def self.select_user_details(desired_person) + self.printed_users_list.each do |user_hash| + if user_hash["User Name"] == desired_person || user_hash["Slack ID"] == desired_person + return user_hash + end + end + + statement = "Not a valid Username/Slack ID" + return statement + end +end \ No newline at end of file diff --git a/lib/workspace.rb b/lib/workspace.rb new file mode 100644 index 00000000..e69de29b diff --git a/test/cassettes/channel-tests.yml b/test/cassettes/channel-tests.yml new file mode 100644 index 00000000..fb8f7821 --- /dev/null +++ b/test/cassettes/channel-tests.yml @@ -0,0 +1,220 @@ +--- +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: + - '53' + Connection: + - keep-alive + Date: + - Wed, 11 Sep 2019 22:20:36 GMT + Server: + - Apache + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + X-Accepted-Oauth-Scopes: + - channels:read + Vary: + - Accept-Encoding + X-Slack-Req-Id: + - 5f291dbf-5181-4a7a-a0aa-5e1e46b8649c + X-Xss-Protection: + - '0' + X-Content-Type-Options: + - nosniff + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-vui8 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 a3bd0eb50c22e4d5fbda56a30b96002d.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - lPy3rnBE6GvRpY_UYYF33kS75WhLDo-i2fpeLrFMFMwkbZge_uoDHw== + body: + encoding: ASCII-8BIT + string: '{"ok":false,"error":"not_authed"}' + http_version: + recorded_at: Wed, 11 Sep 2019 22:20:34 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: + - '599' + Connection: + - keep-alive + Date: + - Wed, 11 Sep 2019 22:31:00 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 2d902ccd-c9f8-4458-a2ad-ca964ef97a5a + X-Oauth-Scopes: + - identify,read,post,client,apps + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - channels:read,read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-udcv + X-Cache: + - Miss from cloudfront + Via: + - 1.1 078ca3a7cfdee29c8e3514176205c50a.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19 + X-Amz-Cf-Id: + - 9SW3dIMAfd7u0JmyRxR7wha-tHMksRKPdjy4OqOdnclWj9jZzDwZAw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"channels":[{"id":"CN70NEJ92","name":"ada-developers-academy","is_channel":true,"created":1568140876,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN7EHLGQ5","name_normalized":"ada-developers-academy","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UN7EHLGQ5","UN9ADP0KZ"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0},"previous_names":[],"num_members":2},{"id":"CN12DA91P","name":"general","is_channel":true,"created":1568140875,"is_archived":false,"is_general":true,"unlinked":0,"creator":"UN7EHLGQ5","name_normalized":"general","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UN7EHLGQ5","UN9ADP0KZ"],"topic":{"value":"Company-wide + announcements and work-based matters","creator":"UN7EHLGQ5","last_set":1568140875},"purpose":{"value":"This + channel is for workspace-wide communication and announcements. All members + are in this channel.","creator":"UN7EHLGQ5","last_set":1568140875},"previous_names":[],"num_members":2},{"id":"CN9LMGB8E","name":"random","is_channel":true,"created":1568140875,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN7EHLGQ5","name_normalized":"random","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UN7EHLGQ5","UN9ADP0KZ"],"topic":{"value":"Non-work + banter and water cooler conversation","creator":"UN7EHLGQ5","last_set":1568140875},"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":"UN7EHLGQ5","last_set":1568140875},"previous_names":[],"num_members":2},{"id":"CMXCAQGP5","name":"sick-rides","is_channel":true,"created":1568223519,"is_archived":false,"is_general":false,"unlinked":0,"creator":"UN7EHLGQ5","name_normalized":"sick-rides","is_shared":false,"is_org_shared":false,"is_member":true,"is_private":false,"is_mpim":false,"members":["UN7EHLGQ5","UN9ADP0KZ"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"post + your cool cars here","creator":"UN7EHLGQ5","last_set":1568223520},"previous_names":[],"num_members":2}]}' + http_version: + recorded_at: Wed, 11 Sep 2019 22:30:58 GMT +- 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: + - '935' + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 19:44:26 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 79d72217-8d8e-4597-854a-a827b8b9f638 + X-Oauth-Scopes: + - identify,read,post,client,apps + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read,read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-1zz5 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 b2f9564ebf9c745cc2ceae96d434977e.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - D768CfxyOcScMjXpbgvlgscMpDKL4YZQ_Ls7ZuwkliDri4Qu610w2A== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"UN7EHLGQ5","team_id":"TN12D9LHF","name":"farahdavoodi","deleted":false,"color":"9f69e7","real_name":"farah","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"farah","real_name_normalized":"farah","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd5897757f8e","email":"farahdavoodi@gmail.com","first_name":"farah","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568223956},{"id":"UN9ADP0KZ","team_id":"TN12D9LHF","name":"stephanie.garcia400","deleted":false,"color":"e7392d","real_name":"Stephanie + Garcia","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Stephanie + Garcia","real_name_normalized":"Stephanie Garcia","display_name":"Stephanie + Garcia","display_name_normalized":"Stephanie Garcia","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gbfa378df3b8","email":"stephanie.garcia400@myci.csuci.edu","image_24":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568141360,"has_2fa":false},{"id":"USLACKBOT","team_id":"TN12D9LHF","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":"TN12D9LHF"},"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}],"cache_ts":1568317466}' + http_version: + recorded_at: Thu, 12 Sep 2019 19:44:25 GMT +recorded_with: VCR 5.0.0 diff --git a/test/cassettes/user-tests.yml b/test/cassettes/user-tests.yml new file mode 100644 index 00000000..74c07171 --- /dev/null +++ b/test/cassettes/user-tests.yml @@ -0,0 +1,307 @@ +--- +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: + - '937' + Connection: + - keep-alive + Date: + - Thu, 12 Sep 2019 19:47:25 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - e076b3e4-c677-44e4-bc82-2af386ec3a28 + X-Oauth-Scopes: + - identify,read,post,client,apps + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read,read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-qdiq + X-Cache: + - Miss from cloudfront + Via: + - 1.1 2dc84924ce70e874a873764fe1415858.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19 + X-Amz-Cf-Id: + - 2lX7FHRgQM9hBNN6rVMEAXCX6pHQs3m38zvP4CDELmXS_bXPFzxfIw== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"UN7EHLGQ5","team_id":"TN12D9LHF","name":"farahdavoodi","deleted":false,"color":"9f69e7","real_name":"farah","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"farah","real_name_normalized":"farah","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd5897757f8e","email":"farahdavoodi@gmail.com","first_name":"farah","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568223956},{"id":"UN9ADP0KZ","team_id":"TN12D9LHF","name":"stephanie.garcia400","deleted":false,"color":"e7392d","real_name":"Stephanie + Garcia","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Stephanie + Garcia","real_name_normalized":"Stephanie Garcia","display_name":"Stephanie + Garcia","display_name_normalized":"Stephanie Garcia","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gbfa378df3b8","email":"stephanie.garcia400@myci.csuci.edu","image_24":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568141360,"has_2fa":false},{"id":"USLACKBOT","team_id":"TN12D9LHF","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":"TN12D9LHF"},"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}],"cache_ts":1568317645}' + http_version: + recorded_at: Thu, 12 Sep 2019 19:47:23 GMT +- 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: + - '935' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 19:34:46 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 52391197-f357-4d97-bce1-098abe448de5 + X-Oauth-Scopes: + - identify,channels:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-an04 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 39688168a2a3353be1f3c9378d12d89f.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - dPEgVH1mxwx6XlZkPjgxIf_e1c3KBX9RTzQ-J6I5HpJzDQ2MkB_ocA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN12D9LHF","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":"TN12D9LHF"},"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":"UN7EHLGQ5","team_id":"TN12D9LHF","name":"farahdavoodi","deleted":false,"color":"9f69e7","real_name":"farah","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"farah","real_name_normalized":"farah","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd5897757f8e","first_name":"farah","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568223956,"has_2fa":false},{"id":"UN9ADP0KZ","team_id":"TN12D9LHF","name":"stephanie.garcia400","deleted":false,"color":"e7392d","real_name":"Stephanie + Garcia","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Stephanie + Garcia","real_name_normalized":"Stephanie Garcia","display_name":"Stephanie + Garcia","display_name_normalized":"Stephanie Garcia","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gbfa378df3b8","image_24":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568141360,"has_2fa":false}],"cache_ts":1568403286,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 19:34:45 GMT +- 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: + - '935' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 19:35:12 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - c1324278-a757-4188-845d-46154e5b5d7e + X-Oauth-Scopes: + - identify,channels:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-8emn + X-Cache: + - Miss from cloudfront + Via: + - 1.1 1b74ccf4cb51eacf97a0e6d60ae46a3f.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - FZ5cVjwsZ7a_Jqy7baHtcr-54xIdwDBptFCLFhJHDh32_0ZcPK9X0w== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN12D9LHF","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":"TN12D9LHF"},"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":"UN7EHLGQ5","team_id":"TN12D9LHF","name":"farahdavoodi","deleted":false,"color":"9f69e7","real_name":"farah","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"farah","real_name_normalized":"farah","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd5897757f8e","first_name":"farah","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568223956,"has_2fa":false},{"id":"UN9ADP0KZ","team_id":"TN12D9LHF","name":"stephanie.garcia400","deleted":false,"color":"e7392d","real_name":"Stephanie + Garcia","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Stephanie + Garcia","real_name_normalized":"Stephanie Garcia","display_name":"Stephanie + Garcia","display_name_normalized":"Stephanie Garcia","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gbfa378df3b8","image_24":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568141360,"has_2fa":false}],"cache_ts":1568403312,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 19:35:11 GMT +- 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: + - '935' + Connection: + - keep-alive + Date: + - Fri, 13 Sep 2019 19:35:31 GMT + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Slack-Req-Id: + - 2b09e52d-0c50-42db-9f02-f41425bfa83e + X-Oauth-Scopes: + - identify,channels:read,users:read,chat:write:bot + Expires: + - Mon, 26 Jul 1997 05:00:00 GMT + Cache-Control: + - private, no-cache, no-store, must-revalidate + Access-Control-Expose-Headers: + - x-slack-req-id, retry-after + X-Xss-Protection: + - '0' + X-Accepted-Oauth-Scopes: + - users:read + Vary: + - Accept-Encoding + Pragma: + - no-cache + Access-Control-Allow-Headers: + - slack-route, x-slack-version-ts + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Referrer-Policy: + - no-referrer + Access-Control-Allow-Origin: + - "*" + X-Via: + - haproxy-www-61a2 + X-Cache: + - Miss from cloudfront + Via: + - 1.1 7e87179efaa9e3c316bd3d3a74cfded8.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - SEA19-C2 + X-Amz-Cf-Id: + - LdoQ714TEpaAr1FesQu66uzqbBS5ddnKmvnkGRfbgpaZR9TrKaH4vA== + body: + encoding: ASCII-8BIT + string: '{"ok":true,"members":[{"id":"USLACKBOT","team_id":"TN12D9LHF","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":"TN12D9LHF"},"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":"UN7EHLGQ5","team_id":"TN12D9LHF","name":"farahdavoodi","deleted":false,"color":"9f69e7","real_name":"farah","tz":"America\/Los_Angeles","tz_label":"Pacific + Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"farah","real_name_normalized":"farah","display_name":"","display_name_normalized":"","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gd5897757f8e","first_name":"farah","last_name":"","image_24":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/d5897757f8e8a7677a3786b9ca90ce9d.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0005-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568223956,"has_2fa":false},{"id":"UN9ADP0KZ","team_id":"TN12D9LHF","name":"stephanie.garcia400","deleted":false,"color":"e7392d","real_name":"Stephanie + Garcia","tz":"America\/Los_Angeles","tz_label":"Pacific Daylight Time","tz_offset":-25200,"profile":{"title":"","phone":"","skype":"","real_name":"Stephanie + Garcia","real_name_normalized":"Stephanie Garcia","display_name":"Stephanie + Garcia","display_name_normalized":"Stephanie Garcia","status_text":"","status_emoji":"","status_expiration":0,"avatar_hash":"gbfa378df3b8","image_24":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/bfa378df3b85d9cd3bc67a1438db57aa.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F80588%2Fimg%2Favatars%2Fuser_shapes%2Fava_0003-512.png","status_text_canonical":"","team":"TN12D9LHF"},"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":1568141360,"has_2fa":false}],"cache_ts":1568403331,"response_metadata":{"next_cursor":""}}' + http_version: + recorded_at: Fri, 13 Sep 2019 19:35:30 GMT +recorded_with: VCR 5.0.0 diff --git a/test/channel_test.rb b/test/channel_test.rb new file mode 100644 index 00000000..33f612e5 --- /dev/null +++ b/test/channel_test.rb @@ -0,0 +1,54 @@ +require_relative 'test_helper' + + describe "Channel Class"do + + describe "self.list method" do + it "should return true if the list was returned" do + VCR.use_cassette("channel-tests") do + response = Channel.list + expect(response["ok"]).must_equal true + end + end + end + + describe "self.printed_channels_list" do + + it "should contain a channel named general" do + VCR.use_cassette("channel-tests") do + channels_array = Channel.printed_channels_list + channels_array.each do |channel| + if channel["name"] == "general" + assert (channel), "Expected true" + end + end + end + end + + it "should return an array of channels" do + VCR.use_cassette("channel-tests") do + channels_array = Channel.printed_channels_list + expect(channels_array).must_be_kind_of Array + end + end + end + + describe "self.select_channel_details method" do + it "should return true four 'general' details" do + VCR.use_cassette("channel-tests") do + desired_person = Channel.select_channel_details("general") + expect(desired_person["name"]).must_equal "general" + expect(desired_person["topic"]).must_equal "This channel is for workspace-wide communication and announcements. All members are in this channel." + expect(desired_person["name"]).must_be_kind_of String + expect(desired_person["topic"]).must_be_kind_of String + end + end + + it "should return 'Not valid' statement if the Channel does not exist" do + VCR.use_cassette("channel-tests") do + desired_channel = Channel.select_channel_details("alsdjflai") + expect(desired_channel).must_equal "Not a valid Channel name/Slack ID" + end + end + end +end + diff --git a/test/recipient_test.rb b/test/recipient_test.rb new file mode 100644 index 00000000..0c106a87 --- /dev/null +++ b/test/recipient_test.rb @@ -0,0 +1,18 @@ +require_relative 'test_helper' + +describe "Recipient Class" do + describe "Constructor" do + it "Should return a recipient class instance" do + #Expect recipient.new + slack_id = 1 + name = "Dom" + slacker = Recipient.new(slack_id, name) + expect(slacker.slack_id).must_equal slack_id + expect(slacker.name).must_equal "Dom" + end + end + + xdescribe "send message method" do + it "Should send a message to" + end +end \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index 90aeb408..7ab99062 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -9,9 +9,23 @@ require 'minitest/skip_dsl' require 'vcr' +require_relative '../lib/recipient' +require_relative '../lib/workspace' +require_relative '../lib/user' +require_relative '../lib/channel' + + Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new VCR.configure do |config| - config.cassette_library_dir = "test/cassettes" - config.hook_into :webmock -end + config.cassette_library_dir = "test/cassettes" # folder where casettes will be located + config.hook_into :webmock # tie into this other tool called webmock + config.default_cassette_options = { + :record => :new_episodes, # record new data when we don't have it yet + :match_requests_on => [:method, :uri, :body], # The http method, URI and body of a request all need to match + } + # Don't leave our token lying around in a cassette file. + config.filter_sensitive_data("") do + ENV["SLACK_API_TOKEN"] + end +end \ No newline at end of file diff --git a/test/user_test.rb b/test/user_test.rb new file mode 100644 index 00000000..19f08b62 --- /dev/null +++ b/test/user_test.rb @@ -0,0 +1,53 @@ +require_relative 'test_helper' +require 'pry' + +describe "user class" do + describe "self.list method" do + it "should return true if API was validated correctly" do + VCR.use_cassette("user-tests") do + response = User.list + expect(response["ok"]).must_equal true + end + end + end + + describe "self.printed_users_list" do + + it "should contain a user named slackbot" do + VCR.use_cassette("user-tests") do + users_array = User.printed_users_list + users_array.each do |user| + if user["name"] == "slackbot" + assert (user), "Expected true" + end + end + end + end + + it "should return an array of users" do + VCR.use_cassette("user-tests") do + users_array = User.printed_users_list + expect(users_array).must_be_kind_of Array + end + end + end + + describe "self.select_user_details method" do + it "should return true four slackbot details" do + VCR.use_cassette("user-tests") do + desired_person = User.select_user_details("slackbot") + expect(desired_person["User Name"]).must_equal "slackbot" + expect(desired_person["Slack ID"]).must_equal "USLACKBOT" + expect(desired_person["User Name"]).must_be_kind_of String + expect(desired_person["Slack ID"]).must_be_kind_of String + end + end + + it "should return 'Not valid' statement if the user does not exist" do + VCR.use_cassette("user-tests") do + desired_person = User.select_user_details("alsdjflai") + expect(desired_person).must_equal "Not a valid Username/Slack ID" + end + end + end +end diff --git a/test/workspace_test.rb b/test/workspace_test.rb new file mode 100644 index 00000000..e69de29b