@@ -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-<usr> 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 <component_jid> "\
"<component_password> <server_hostname> "\
"<server_port> <application_id> "\
- "<http_listen_port> <mms_proxy_prefix_url> [V1_creds_file]"
+ "<http_listen_port> <mms_proxy_prefix_url>"
exit 0
end