From 2c59c74b8e4eef178abe77d792eab67d3150231d Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 10 May 2022 15:23:35 -0500 Subject: [PATCH] v1 is dead, remove hacks --- sgx-bwmsgsv2.rb | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index d0e02fb3de43ee9307c5877d4aee00a618fd430b..bdaf73956c368cee6cb5228214cc0364279f7481 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -106,21 +106,11 @@ module SGXbwmsgsv2 def self.send_media(from, to, media_url, desc=nil, subject=nil, m=nil) # we assume media_url is one of these (always the case so far): - # https://api.catapult.inetwork.com/v1/users/[uid]/media/[file] # https://messaging.bandwidth.com/api/v2/users/[u]/media/[path] usr = to pth = '' if media_url.start_with?( - 'https://api.catapult.inetwork.com/v1/users/') - - # TODO: MUST fix this TERRIBLE hack - # there must be a catapult_cred- key with V1 creds - usr = 'v1' - - pth = media_url.split('/', 8)[7] - - elsif media_url.start_with?( 'https://messaging.bandwidth.com/api/v2/users/') pth = media_url.split('/', 9)[8] @@ -222,20 +212,12 @@ module SGXbwmsgsv2 ) # pth looks like one of: # "api/v2/users/#{user_id}/[endpoint_name]" - # "v1/users/#{user_id}/[endpoint_name]" url_prefix = '' # TODO: need to make a separate thing for voice.bw.c eventually if pth.start_with? 'api/v2/users' url_prefix = 'https://messaging.bandwidth.com/' - elsif pth.start_with? 'v1/users' - # begin hack for running V2 messages along with V1 voice - url_prefix = 'https://api.catapult.inetwork.com/' - # TODO: set token and secret to vals provided at startup - # TODO: replace pth's user_id with user_id from ARGV[7] - # -> pth = "v1/users/#{new_id}/" + pth.split('/', 4)[3] - # TODO: else error end EM::HttpRequest.new( @@ -1046,11 +1028,11 @@ at_exit do puts "Soprani.ca/SMS Gateway for XMPP - Bandwidth API V2\n"\ "==>> last commit of this version is " + `git rev-parse HEAD` + "\n" - if ARGV.size != 7 and ARGV.size != 8 + if ARGV.size != 7 puts "Usage: sgx-bwmsgsv2.rb "\ " "\ " "\ - " [V1_creds_file]" + " " exit 0 end