From 943be09d7ec752adc6cbd4bab6ec2758d2a32176 Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Sun, 21 Jan 2024 18:49:17 -0500 Subject: [PATCH] remove stock plugin; it's borked The stock_quote gem the plugin is based on was yanked from RubyGems. So, bye-bye plugin. --- Gemfile | 1 - Gemfile.lock | 17 ----------------- plugins/stock.rb | 37 ------------------------------------- 3 files changed, 55 deletions(-) delete mode 100644 plugins/stock.rb diff --git a/Gemfile b/Gemfile index f0cbcac..3e67e14 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,6 @@ gem 'sanitize', ">= 2.1", "< 7.0" gem 'sinatra', "~> 1.4" gem "slack-ruby-client" gem 'sqlite3', "~> 1.3" -gem "stock_quote", ">= 1.2.6" gem 'thin', '>= 1.8.0' gem 'twilio-ruby', ">= 4.13.0" gem 'twitter-stream', ">= 0.1.12" diff --git a/Gemfile.lock b/Gemfile.lock index 9106fea..f63ab7d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,8 +36,6 @@ GEM crass (1.0.6) daemons (1.4.1) diff-lcs (1.5.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) em-http-request (1.1.7) addressable (>= 2.3.4) cookiejar (!= 0.3.1) @@ -58,8 +56,6 @@ GEM hashie (5.0.0) hpricot (0.8.6) htmlentities (4.3.4) - http-cookie (1.0.3) - domain_name (~> 0.5) http_parser.rb (0.8.0) httparty (0.17.1) mime-types (~> 3.0) @@ -67,7 +63,6 @@ GEM i18n (1.8.10) concurrent-ruby (~> 1.0) image_size (2.0.2) - json (2.5.1) jwt (2.2.1) method_source (0.8.2) mime-types (3.4.1) @@ -77,7 +72,6 @@ GEM minitest (5.14.4) multi_xml (0.6.0) multipart-post (2.1.1) - netrc (0.11.0) nio4r (2.5.8) nokogiri (1.13.8) mini_portile2 (~> 2.8.0) @@ -95,10 +89,6 @@ GEM rack rake (13.0.6) rb-readline (0.5.3) - rest-client (2.0.2) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) rexml (3.2.5) roauth (0.0.8) rspec (3.11.0) @@ -134,9 +124,6 @@ GEM slop (3.6.0) sqlite3 (1.4.2) stemmer (1.0.1) - stock_quote (3.0.0) - json - rest-client (~> 2.0.2) thin (1.8.1) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) @@ -154,9 +141,6 @@ GEM classifier (= 1.3.1) tzinfo (2.0.4) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.6) unidecode (1.0.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) @@ -194,7 +178,6 @@ DEPENDENCIES sinatra (~> 1.4) slack-ruby-client sqlite3 (~> 1.3) - stock_quote (>= 1.2.6) thin (>= 1.8.0) twilio-ruby (>= 4.13.0) twitter-stream (>= 0.1.12) diff --git a/plugins/stock.rb b/plugins/stock.rb deleted file mode 100644 index e7c60d6..0000000 --- a/plugins/stock.rb +++ /dev/null @@ -1,37 +0,0 @@ -# encoding: UTF-8 -require 'stock_quote' -class Stock < Linkbot::Plugin - - def initialize - @config = Linkbot::Config["plugins"]["stock"] - - if @config && @config['enabled'] - if @config['iex_api_key'] - register :regex => Regexp.new('\$(\w+)') - help "$ returns that stock's price" - else - Linkbot.log.warn "Stock plugin requires an API key to IEX https://iexcloud.io/cloud-login#/register/." - end - end - end - - def on_message(message, matches) - ticker = matches[0] - StockQuote::Stock.new(api_key: @config['iex_api_key']) - stock = StockQuote::Stock.quote(ticker) - - return [] unless stock.response_code == 200 - - price = stock.bid - name = stock.name - movement = stock.change - pct = stock.change_percent_change - upordown = movement < 0 ? '↓' : '↑' - movetext = "#{upordown} #{movement.abs} #{pct}" - - msg = "#{name} #{price} #{movetext}" - - [msg] - end - -end