From bd72f4f13cc3a7cca685aafecdaf6fa6b6655683 Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:41:00 -0400 Subject: [PATCH 01/11] Create EventHandler class to identify and classify different event types --- lib/stealth/services/bandwidth/client.rb | 87 +++---- .../services/bandwidth/event_handler.rb | 21 ++ .../services/bandwidth/message_handler.rb | 96 +++---- .../services/bandwidth/reply_handler.rb | 241 +++++++++--------- 4 files changed, 234 insertions(+), 211 deletions(-) create mode 100644 lib/stealth/services/bandwidth/event_handler.rb diff --git a/lib/stealth/services/bandwidth/client.rb b/lib/stealth/services/bandwidth/client.rb index 07ad670..426803f 100644 --- a/lib/stealth/services/bandwidth/client.rb +++ b/lib/stealth/services/bandwidth/client.rb @@ -1,45 +1,46 @@ # frozen_string_literal: true -require 'http' - -require 'stealth/services/bandwidth/message_handler' -require 'stealth/services/bandwidth/reply_handler' -require 'stealth/services/bandwidth/setup' - -module Stealth - module Services - module Bandwidth - class Client < Stealth::Services::BaseClient - - attr_reader :http_client, :reply, :endpoint - - def initialize(reply:) - @reply = reply - account_id = Stealth.config.bandwidth.account_id - username = Stealth.config.bandwidth.api_username - password = Stealth.config.bandwidth.api_password - application_id = Stealth.config.bandwidth.application_id - @endpoint = "https://messaging.bandwidth.com/api/v2/users/#{account_id}/messages" - @http_client = HTTP - .timeout(connect: 15, read: 30) - .basic_auth(user: username, pass: password) - .headers('Content-Type' => 'application/json') - end - - def transmit - # Don't transmit anything for delays - return true if reply.blank? - - json_reply = Oj.dump(reply, mode: :compat) - response = http_client.post(endpoint, body: json_reply) - - Stealth::Logger.l( - topic: 'bandwidth', - message: "Transmitting. Response: #{response.status.code}: #{response.body}" - ) - end - - end - end - end -end +# require 'http' + +# require 'stealth/services/bandwidth/message_handler' +# require 'stealth/services/bandwidth/reply_handler' +# require 'stealth/services/bandwidth/setup' + +# module Stealth +# module Services +# module Bandwidth +# class Client < Stealth::Services::BaseClient + +# attr_reader :http_client, :reply, :endpoint + +# def initialize(reply:) +# @reply = reply +# bandwidth = Stealth.configurations[:bandwidth] +# account_id = bandwidth.account_id +# username = bandwidth.api_username +# password = bandwidth.api_password +# application_id = bandwidth.application_id +# @endpoint = "https://messaging.bandwidth.com/api/v2/users/#{account_id}/messages" +# @http_client = HTTP +# .timeout(connect: 15, read: 30) +# .basic_auth(user: username, pass: password) +# .headers('Content-Type' => 'application/json') +# end + +# def transmit +# # Don't transmit anything for delays +# return true if reply.blank? + +# json_reply = Oj.dump(reply, mode: :compat) +# response = http_client.post(endpoint, body: json_reply) + +# Stealth::Logger.l( +# topic: 'bandwidth', +# message: "Transmitting. Response: #{response.status.code}: #{response.body}" +# ) +# end + +# end +# end +# end +# end diff --git a/lib/stealth/services/bandwidth/event_handler.rb b/lib/stealth/services/bandwidth/event_handler.rb new file mode 100644 index 0000000..076d549 --- /dev/null +++ b/lib/stealth/services/bandwidth/event_handler.rb @@ -0,0 +1,21 @@ +module Stealth + module Services + module Bandwidth + + class EventHandler + def self.determine_event_type(request) + # WIP will handle calls and other events here + case request.params.dig(:_json)&.first&.dig(:type) + when 'message-received' + :text_message_receive + # when 'unsubscribe' + # :unsubscribe + else + :unknown_event + end + end + end + + end + end +end diff --git a/lib/stealth/services/bandwidth/message_handler.rb b/lib/stealth/services/bandwidth/message_handler.rb index 65a9b21..8da42e9 100644 --- a/lib/stealth/services/bandwidth/message_handler.rb +++ b/lib/stealth/services/bandwidth/message_handler.rb @@ -1,50 +1,50 @@ # frozen_string_literal: true -module Stealth - module Services - module Bandwidth - class MessageHandler < Stealth::Services::BaseMessageHandler - attr_reader :service_message, :params, :headers - - def initialize(params:, headers:) - @params = params - @headers = headers - end - - def coordinate - case params.dig('message', 'direction') - when "in" - Stealth::Services::HandleMessageJob.perform_async( - 'bandwidth', - params, - headers - ) - when "out" - # Ignoring outbound messages - end - - # Relay our acceptance - [202, 'Accepted'] - end - - def process - @service_message = ServiceMessage.new(service: 'bandwidth') - - service_message.sender_id = params.dig('message', 'from') - service_message.target_id = params.dig('message', 'to') - service_message.message = params.dig('message', 'text') - service_message.timestamp = params.dig('message', 'time') - params.dig('message', 'media')&.each do |attachment_url| - service_message.attachments << { - url: attachment_url - } - end - - service_message - end - - end - - end - end -end +# module Stealth +# module Services +# module Bandwidth +# class MessageHandler < Stealth::Services::BaseMessageHandler +# attr_reader :service_message, :params, :headers + +# def initialize(params:, headers:) +# @params = params +# @headers = headers +# end + +# def coordinate +# case params.dig('message', 'direction') +# when "in" +# Stealth::Services::HandleMessageJob.perform_async( +# 'bandwidth', +# params, +# headers +# ) +# when "out" +# # Ignoring outbound messages +# end + +# # Relay our acceptance +# [202, 'Accepted'] +# end + +# def process +# @service_message = ServiceMessage.new(service: 'bandwidth') + +# service_message.sender_id = params.dig('message', 'from') +# service_message.target_id = params.dig('message', 'to') +# service_message.message = params.dig('message', 'text') +# service_message.timestamp = params.dig('message', 'time') +# params.dig('message', 'media')&.each do |attachment_url| +# service_message.attachments << { +# url: attachment_url +# } +# end + +# service_message +# end + +# end + +# end +# end +# end diff --git a/lib/stealth/services/bandwidth/reply_handler.rb b/lib/stealth/services/bandwidth/reply_handler.rb index d03592e..87ef8c1 100644 --- a/lib/stealth/services/bandwidth/reply_handler.rb +++ b/lib/stealth/services/bandwidth/reply_handler.rb @@ -1,128 +1,129 @@ # coding: utf-8 # frozen_string_literal: true -module Stealth - module Services - module Bandwidth - class ReplyHandler < Stealth::Services::BaseReplyHandler +# module Stealth +# module Services +# module Bandwidth +# class ReplyHandler < Stealth::Services::BaseReplyHandler - ALPHA_ORDINALS = ('A'..'Z').to_a.freeze +# ALPHA_ORDINALS = ('A'..'Z').to_a.freeze - attr_reader :recipient_id, :reply, :translated_reply +# attr_reader :recipient_id, :reply, :translated_reply - def initialize(recipient_id: nil, reply: nil) - @recipient_id = recipient_id - @reply = reply - end +# def initialize(recipient_id: nil, reply: nil) +# binding.pry +# @recipient_id = recipient_id +# @reply = reply +# end - def text - check_text_length - - @translated_reply = reply['text'] +# def text +# check_text_length + +# @translated_reply = reply['text'] + +# suggestions = generate_suggestions(suggestions: reply['suggestions']) +# buttons = generate_buttons(buttons: reply['buttons']) - suggestions = generate_suggestions(suggestions: reply['suggestions']) - buttons = generate_buttons(buttons: reply['buttons']) - - if suggestions.present? - @translated_reply = [ - @translated_reply, - 'Reply with:' - ].join("\n\n") - - suggestions.each_with_index do |suggestion, i| - @translated_reply = [ - @translated_reply, - "\"#{ALPHA_ORDINALS[i]}\" for #{suggestion}" - ].join("\n") - end - end - - if buttons.present? - buttons.each do |button| - @translated_reply = [ - @translated_reply, - button - ].join("\n\n") - end - end - - format_response({ text: @translated_reply }) - end - - def image - check_text_length - - format_response({ text: reply['text'], media: [reply['image_url']] }) - end - - def audio - check_text_length - - format_response({ text: reply['text'], media: [reply['audio_url']] }) - end - - def video - check_text_length - - format_response({ text: reply['text'], media: [reply['video_url']] }) - end - - def file - check_text_length - - format_response({ text: reply['text'], media: [reply['file_url']] }) - end - - def delay - - end - - private - - def check_text_length - if reply['text'].present? && reply['text'].size > 2048 - raise(ArgumentError, 'Text messages must be 2048 characters or less.') - end - end - - def format_response(response) - sender_info = { - from: Stealth.config.bandwidth.from_phone.to_s, - to: recipient_id, - applicationId: Stealth.config.bandwidth.application_id - } - - response.merge(sender_info) - end - - def generate_suggestions(suggestions:) - return if suggestions.blank? - - mf = suggestions.collect do |suggestion| - suggestion['text'] - end.compact - end - - def generate_buttons(buttons:) - return if buttons.blank? - - sms_buttons = buttons.map do |button| - case button['type'] - when 'url' - "#{button['text']}: #{button['url']}" - when 'payload' - "To #{button['text'].downcase}: Text #{button['payload'].upcase}" - when 'call' - "#{button['text']}: #{button['phone_number']}" - else # Don't raise for unsupported buttons - next - end - end.compact - - sms_buttons - end - - end - end - end -end +# if suggestions.present? +# @translated_reply = [ +# @translated_reply, +# 'Reply with:' +# ].join("\n\n") + +# suggestions.each_with_index do |suggestion, i| +# @translated_reply = [ +# @translated_reply, +# "\"#{ALPHA_ORDINALS[i]}\" for #{suggestion}" +# ].join("\n") +# end +# end + +# if buttons.present? +# buttons.each do |button| +# @translated_reply = [ +# @translated_reply, +# button +# ].join("\n\n") +# end +# end + +# format_response({ text: @translated_reply }) +# end + +# def image +# check_text_length + +# format_response({ text: reply['text'], media: [reply['image_url']] }) +# end + +# def audio +# check_text_length + +# format_response({ text: reply['text'], media: [reply['audio_url']] }) +# end + +# def video +# check_text_length + +# format_response({ text: reply['text'], media: [reply['video_url']] }) +# end + +# def file +# check_text_length + +# format_response({ text: reply['text'], media: [reply['file_url']] }) +# end + +# def delay + +# end + +# private + +# def check_text_length +# if reply['text'].present? && reply['text'].size > 2048 +# raise(ArgumentError, 'Text messages must be 2048 characters or less.') +# end +# end + +# def format_response(response) +# sender_info = { +# from: Stealth.config.bandwidth.from_phone.to_s, +# to: recipient_id, +# applicationId: Stealth.config.bandwidth.application_id +# } + +# response.merge(sender_info) +# end + +# def generate_suggestions(suggestions:) +# return if suggestions.blank? + +# mf = suggestions.collect do |suggestion| +# suggestion['text'] +# end.compact +# end + +# def generate_buttons(buttons:) +# return if buttons.blank? + +# sms_buttons = buttons.map do |button| +# case button['type'] +# when 'url' +# "#{button['text']}: #{button['url']}" +# when 'payload' +# "To #{button['text'].downcase}: Text #{button['payload'].upcase}" +# when 'call' +# "#{button['text']}: #{button['phone_number']}" +# else # Don't raise for unsupported buttons +# next +# end +# end.compact + +# sms_buttons +# end + +# end +# end +# end +# end From 646c2ae754f818cfe622e75e27b0f64717a455cf Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Thu, 8 Aug 2024 11:27:33 -0400 Subject: [PATCH 02/11] Setup a ServiceMessage --- .../services/bandwidth/event_handler.rb | 16 +++++---- .../services/bandwidth/service_message.rb | 34 +++++++++++++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 lib/stealth/services/bandwidth/service_message.rb diff --git a/lib/stealth/services/bandwidth/event_handler.rb b/lib/stealth/services/bandwidth/event_handler.rb index 076d549..c9315b9 100644 --- a/lib/stealth/services/bandwidth/event_handler.rb +++ b/lib/stealth/services/bandwidth/event_handler.rb @@ -4,14 +4,18 @@ module Bandwidth class EventHandler def self.determine_event_type(request) - # WIP will handle calls and other events here - case request.params.dig(:_json)&.first&.dig(:type) + # Create a new instance of ServiceMessage with the request params and headers + service_message = Stealth::Services::Bandwidth::ServiceMessage.new( + params: request.params.dig(:_json)&.first, + headers: request.headers + ).process + + # Determine the event type and include the service_message in the response + case service_message.event_type when 'message-received' - :text_message_receive - # when 'unsubscribe' - # :unsubscribe + { type: :text_message_receive, service_message: service_message } else - :unknown_event + { type: :unknown_event } end end end diff --git a/lib/stealth/services/bandwidth/service_message.rb b/lib/stealth/services/bandwidth/service_message.rb new file mode 100644 index 0000000..ab59ba8 --- /dev/null +++ b/lib/stealth/services/bandwidth/service_message.rb @@ -0,0 +1,34 @@ +module Stealth + module Services + module Bandwidth + + class ServiceMessage < Stealth::ServiceMessage + attr_reader :params, :headers + + def initialize(params:, headers:) + super(service: 'bandwidth') + @params = params + @headers = headers + end + + def process + self.sender_id = params.dig('message', 'from') + self.target_id = params.dig('to') + self.message = params.dig('message', 'text') + self.event_type = params.dig('type') + self.timestamp = params.dig('time') + + # Handle attachments if any + params.dig('message', 'media')&.each do |attachment_url| + service_message.attachments << { + url: attachment_url + } + end + + self + end + end + + end + end +end From 54583f567d1505ef2bff99efddb3125e41263e74 Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Fri, 9 Aug 2024 15:42:31 -0400 Subject: [PATCH 03/11] Setup a ServiceCall --- .../services/bandwidth/call_event_handler.rb | 25 +++++++++++++++++ ...nt_handler.rb => message_event_handler.rb} | 6 ++--- .../services/bandwidth/service_call.rb | 27 +++++++++++++++++++ .../services/bandwidth/service_message.rb | 2 +- 4 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 lib/stealth/services/bandwidth/call_event_handler.rb rename lib/stealth/services/bandwidth/{event_handler.rb => message_event_handler.rb} (79%) create mode 100644 lib/stealth/services/bandwidth/service_call.rb diff --git a/lib/stealth/services/bandwidth/call_event_handler.rb b/lib/stealth/services/bandwidth/call_event_handler.rb new file mode 100644 index 0000000..33b2354 --- /dev/null +++ b/lib/stealth/services/bandwidth/call_event_handler.rb @@ -0,0 +1,25 @@ +module Stealth + module Services + module Bandwidth + + class CallEventHandler + def self.determine_event_type(request) + # Create a new instance of ServiceMessage with the request params and headers + service_call = Stealth::Services::Bandwidth::ServiceCall.new( + params: request.params, + headers: request.headers + ).process + + # Determine the event type and include the service_message in the response + case service_call.service_event_type + when 'initiate' + { type: :call_received, service_call: service_call } + else + { type: :unknown_event } + end + end + end + + end + end +end diff --git a/lib/stealth/services/bandwidth/event_handler.rb b/lib/stealth/services/bandwidth/message_event_handler.rb similarity index 79% rename from lib/stealth/services/bandwidth/event_handler.rb rename to lib/stealth/services/bandwidth/message_event_handler.rb index c9315b9..9c23491 100644 --- a/lib/stealth/services/bandwidth/event_handler.rb +++ b/lib/stealth/services/bandwidth/message_event_handler.rb @@ -2,7 +2,7 @@ module Stealth module Services module Bandwidth - class EventHandler + class MessageEventHandler def self.determine_event_type(request) # Create a new instance of ServiceMessage with the request params and headers service_message = Stealth::Services::Bandwidth::ServiceMessage.new( @@ -11,9 +11,9 @@ def self.determine_event_type(request) ).process # Determine the event type and include the service_message in the response - case service_message.event_type + case service_message.service_event_type when 'message-received' - { type: :text_message_receive, service_message: service_message } + { type: :text_received, service_message: service_message } else { type: :unknown_event } end diff --git a/lib/stealth/services/bandwidth/service_call.rb b/lib/stealth/services/bandwidth/service_call.rb new file mode 100644 index 0000000..186b359 --- /dev/null +++ b/lib/stealth/services/bandwidth/service_call.rb @@ -0,0 +1,27 @@ +module Stealth + module Services + module Bandwidth + + class ServiceCall < Stealth::ServiceCall + attr_reader :params, :headers + + def initialize(params:, headers:) + super(service: 'bandwidth') + @params = params + @headers = headers + end + + def process + self.call_id = params['callId'] + self.call_url = params['callUrl'] + self.sender_id = params['from'] + self.target_id = params['to'] + self.service_event_type = params['eventType'] + + self + end + end + + end + end +end diff --git a/lib/stealth/services/bandwidth/service_message.rb b/lib/stealth/services/bandwidth/service_message.rb index ab59ba8..3549790 100644 --- a/lib/stealth/services/bandwidth/service_message.rb +++ b/lib/stealth/services/bandwidth/service_message.rb @@ -15,7 +15,7 @@ def process self.sender_id = params.dig('message', 'from') self.target_id = params.dig('to') self.message = params.dig('message', 'text') - self.event_type = params.dig('type') + self.service_event_type = params.dig('type') self.timestamp = params.dig('time') # Handle attachments if any From 024d3cac13d891a69a473b2ed6488e089ec79364 Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Thu, 6 Feb 2025 13:20:23 -0500 Subject: [PATCH 04/11] Add Support for Replies in Stealth 3.0 --- lib/stealth/services/bandwidth/client.rb | 83 +++--- .../services/bandwidth/event_handler.rb | 72 ++++++ .../services/bandwidth/reply_handler.rb | 242 +++++++++--------- 3 files changed, 229 insertions(+), 168 deletions(-) create mode 100644 lib/stealth/services/bandwidth/event_handler.rb diff --git a/lib/stealth/services/bandwidth/client.rb b/lib/stealth/services/bandwidth/client.rb index 426803f..199df2f 100644 --- a/lib/stealth/services/bandwidth/client.rb +++ b/lib/stealth/services/bandwidth/client.rb @@ -1,46 +1,45 @@ # frozen_string_literal: true -# require 'http' +require 'http' # require 'stealth/services/bandwidth/message_handler' -# require 'stealth/services/bandwidth/reply_handler' -# require 'stealth/services/bandwidth/setup' - -# module Stealth -# module Services -# module Bandwidth -# class Client < Stealth::Services::BaseClient - -# attr_reader :http_client, :reply, :endpoint - -# def initialize(reply:) -# @reply = reply -# bandwidth = Stealth.configurations[:bandwidth] -# account_id = bandwidth.account_id -# username = bandwidth.api_username -# password = bandwidth.api_password -# application_id = bandwidth.application_id -# @endpoint = "https://messaging.bandwidth.com/api/v2/users/#{account_id}/messages" -# @http_client = HTTP -# .timeout(connect: 15, read: 30) -# .basic_auth(user: username, pass: password) -# .headers('Content-Type' => 'application/json') -# end - -# def transmit -# # Don't transmit anything for delays -# return true if reply.blank? - -# json_reply = Oj.dump(reply, mode: :compat) -# response = http_client.post(endpoint, body: json_reply) - -# Stealth::Logger.l( -# topic: 'bandwidth', -# message: "Transmitting. Response: #{response.status.code}: #{response.body}" -# ) -# end - -# end -# end -# end -# end +require 'stealth/services/bandwidth/setup' +require 'stealth/services/bandwidth/event_handler' +require 'stealth/services/bandwidth/reply_handler' + +module Stealth + module Services + module Bandwidth + class Client < Stealth::Services::BaseClient + + attr_reader :http_client, :reply, :endpoint + + def initialize(reply:, **args) + @reply = reply + account_id = Stealth.config.dig('bandwidth', 'account_id') + username = Stealth.config.dig('bandwidth', 'api_username') + password = Stealth.config.dig('bandwidth', 'api_password') + + @endpoint = "https://messaging.bandwidth.com/api/v2/users/#{account_id}/messages" + @http_client = HTTP + .timeout(connect: 15, read: 30) + .basic_auth(user: username, pass: password) + .headers('Content-Type' => 'application/json; charset=utf-8') + end + + def transmit + # Don't transmit anything for delays + return true if reply.blank? + json_reply = Oj.dump(reply, mode: :compat) + response = http_client.post(endpoint, body: json_reply) + + Stealth::Logger.l( + topic: 'bandwidth', + message: "Transmitting. Response: #{response.status.code}: #{response.body}" + ) + end + + end + end + end +end diff --git a/lib/stealth/services/bandwidth/event_handler.rb b/lib/stealth/services/bandwidth/event_handler.rb new file mode 100644 index 0000000..a91c026 --- /dev/null +++ b/lib/stealth/services/bandwidth/event_handler.rb @@ -0,0 +1,72 @@ +module Stealth + module Services + module Bandwidth + + class EventHandler < Stealth::ServiceEvent + attr_reader :params, :headers + attr_accessor :sender_id, :target_id, :message, :timestamp, :event_type, :event, :attachments, :selected_option, :previous_message, :nlp_result + + def initialize(params:, headers:) + super(service: 'bandwidth') + @params = parse(params) + @headers = headers + @attachments = [] + end + + def coordinate + return [202, 'Accepted'] if should_ignore_event?(params) + Stealth::Services::HandleEventJob.perform_async('bandwidth', params, headers) + [202, 'Accepted'] + end + + + def process + self.sender_id = params.dig('message', 'from') + self.target_id = params.dig('message', 'to').first + self.message = params.dig('message', 'text') + self.timestamp = params.dig('message', 'time') + params.dig('message', 'media')&.each do |attachment_url| + self.attachments << { + url: attachment_url + } + end + + mapped_event = map_event_type + self.event_type = mapped_event[:event_type] + self.event = mapped_event[:event] + + self + end + + private + + def should_ignore_event?(params) + event = params.dig('type') + + ignored_events = [ + event["message-sending"].present?, + event["message-delivered"].present? + ] + + ignored_events.any? + end + + def parse(params) + return params["_json"] if params["_json"].present? + params + end + + def map_event_type + event_type = params.dig('type') + + event_mapping = { + 'message-received' => 'text_received' + } + + Stealth::EventMapping.map_event(service: 'bandwidth', event_type: event_mapping[event_type]) + end + end + + end + end +end diff --git a/lib/stealth/services/bandwidth/reply_handler.rb b/lib/stealth/services/bandwidth/reply_handler.rb index 87ef8c1..47f6b41 100644 --- a/lib/stealth/services/bandwidth/reply_handler.rb +++ b/lib/stealth/services/bandwidth/reply_handler.rb @@ -1,129 +1,119 @@ # coding: utf-8 # frozen_string_literal: true -# module Stealth -# module Services -# module Bandwidth -# class ReplyHandler < Stealth::Services::BaseReplyHandler - -# ALPHA_ORDINALS = ('A'..'Z').to_a.freeze - -# attr_reader :recipient_id, :reply, :translated_reply - -# def initialize(recipient_id: nil, reply: nil) -# binding.pry -# @recipient_id = recipient_id -# @reply = reply -# end - -# def text -# check_text_length - -# @translated_reply = reply['text'] - -# suggestions = generate_suggestions(suggestions: reply['suggestions']) -# buttons = generate_buttons(buttons: reply['buttons']) - -# if suggestions.present? -# @translated_reply = [ -# @translated_reply, -# 'Reply with:' -# ].join("\n\n") - -# suggestions.each_with_index do |suggestion, i| -# @translated_reply = [ -# @translated_reply, -# "\"#{ALPHA_ORDINALS[i]}\" for #{suggestion}" -# ].join("\n") -# end -# end - -# if buttons.present? -# buttons.each do |button| -# @translated_reply = [ -# @translated_reply, -# button -# ].join("\n\n") -# end -# end - -# format_response({ text: @translated_reply }) -# end - -# def image -# check_text_length - -# format_response({ text: reply['text'], media: [reply['image_url']] }) -# end - -# def audio -# check_text_length - -# format_response({ text: reply['text'], media: [reply['audio_url']] }) -# end - -# def video -# check_text_length - -# format_response({ text: reply['text'], media: [reply['video_url']] }) -# end - -# def file -# check_text_length - -# format_response({ text: reply['text'], media: [reply['file_url']] }) -# end - -# def delay - -# end - -# private - -# def check_text_length -# if reply['text'].present? && reply['text'].size > 2048 -# raise(ArgumentError, 'Text messages must be 2048 characters or less.') -# end -# end - -# def format_response(response) -# sender_info = { -# from: Stealth.config.bandwidth.from_phone.to_s, -# to: recipient_id, -# applicationId: Stealth.config.bandwidth.application_id -# } - -# response.merge(sender_info) -# end - -# def generate_suggestions(suggestions:) -# return if suggestions.blank? - -# mf = suggestions.collect do |suggestion| -# suggestion['text'] -# end.compact -# end - -# def generate_buttons(buttons:) -# return if buttons.blank? - -# sms_buttons = buttons.map do |button| -# case button['type'] -# when 'url' -# "#{button['text']}: #{button['url']}" -# when 'payload' -# "To #{button['text'].downcase}: Text #{button['payload'].upcase}" -# when 'call' -# "#{button['text']}: #{button['phone_number']}" -# else # Don't raise for unsupported buttons -# next -# end -# end.compact - -# sms_buttons -# end - -# end -# end -# end -# end +module Stealth + module Services + module Bandwidth + class ReplyHandler < Stealth::Services::BaseReplyHandler + + ALPHA_ORDINALS = ('A'..'Z').to_a.freeze + + attr_reader :recipient_id, :reply, :translated_reply + + def initialize(reply: nil, **args) + @recipient_id = args[:recipient_id] + @reply = reply + end + + def text + check_text_length + @translated_reply = reply[:text] + + suggestions = reply[:suggestions] + + buttons = generate_buttons(buttons: reply[:buttons]) + if suggestions.present? + @translated_reply = [ + @translated_reply, + 'Reply with:' + ].join("\n\n") + + suggestions.each_with_index do |suggestion, i| + @translated_reply = [ + @translated_reply, + "\"#{ALPHA_ORDINALS[i]}\" for #{suggestion}" + ].join("\n") + end + end + + if buttons.present? + buttons.each do |button| + @translated_reply = [ + @translated_reply, + button + ].join("\n\n") + end + end + + format_response({ text: @translated_reply }) + end + + def image + check_text_length + + format_response({ text: reply[:text], media: [reply[:image_url]] }) + end + + def audio + check_text_length + + format_response({ text: reply[:text], media: [reply[:audio_url]] }) + end + + def video + check_text_length + + format_response({ text: reply[:text], media: [reply[:video_url]] }) + end + + def file + check_text_length + + format_response({ text: reply[:text], media: [reply[:file_url]] }) + end + + def delay + + end + + private + + def check_text_length + if reply[:text].present? && reply[:text].size > 2048 + raise(ArgumentError, 'Text messages must be 2048 characters or less.') + end + end + + def format_response(response) + sender_info = { + from: Stealth.config.dig('bandwidth', 'from_phone'), + to: recipient_id, + applicationId: Stealth.config.dig('bandwidth', 'application_id') + } + + response.merge(sender_info) + end + + def generate_buttons(buttons:) + return if buttons.blank? + + sms_buttons = buttons.map do |button| + case button[:type] + when 'url' + "#{button[:text]}: #{button[:url]}" + when 'payload' + "To #{button[:text].downcase}: Text #{button[:payload].upcase}" + when 'call' + "#{button[:text]}: #{button[:phone_number]}" + else # Don't raise for unsupported buttons + next + end + end.compact + + sms_buttons + end + + end + end + end +end From 23908ae01a8381034360987717642c9e30596841 Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Fri, 7 Feb 2025 15:52:06 -0500 Subject: [PATCH 05/11] Clean up --- VERSION | 2 +- .../services/bandwidth/call_event_handler.rb | 25 ---------- lib/stealth/services/bandwidth/client.rb | 1 - .../bandwidth/message_event_handler.rb | 25 ---------- .../services/bandwidth/message_handler.rb | 50 ------------------- .../services/bandwidth/service_call.rb | 27 ---------- .../services/bandwidth/service_message.rb | 34 ------------- 7 files changed, 1 insertion(+), 163 deletions(-) delete mode 100644 lib/stealth/services/bandwidth/call_event_handler.rb delete mode 100644 lib/stealth/services/bandwidth/message_event_handler.rb delete mode 100644 lib/stealth/services/bandwidth/message_handler.rb delete mode 100644 lib/stealth/services/bandwidth/service_call.rb delete mode 100644 lib/stealth/services/bandwidth/service_message.rb diff --git a/VERSION b/VERSION index 9084fa2..227cea2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.0 +2.0.0 diff --git a/lib/stealth/services/bandwidth/call_event_handler.rb b/lib/stealth/services/bandwidth/call_event_handler.rb deleted file mode 100644 index 33b2354..0000000 --- a/lib/stealth/services/bandwidth/call_event_handler.rb +++ /dev/null @@ -1,25 +0,0 @@ -module Stealth - module Services - module Bandwidth - - class CallEventHandler - def self.determine_event_type(request) - # Create a new instance of ServiceMessage with the request params and headers - service_call = Stealth::Services::Bandwidth::ServiceCall.new( - params: request.params, - headers: request.headers - ).process - - # Determine the event type and include the service_message in the response - case service_call.service_event_type - when 'initiate' - { type: :call_received, service_call: service_call } - else - { type: :unknown_event } - end - end - end - - end - end -end diff --git a/lib/stealth/services/bandwidth/client.rb b/lib/stealth/services/bandwidth/client.rb index 199df2f..e45439e 100644 --- a/lib/stealth/services/bandwidth/client.rb +++ b/lib/stealth/services/bandwidth/client.rb @@ -2,7 +2,6 @@ require 'http' -# require 'stealth/services/bandwidth/message_handler' require 'stealth/services/bandwidth/setup' require 'stealth/services/bandwidth/event_handler' require 'stealth/services/bandwidth/reply_handler' diff --git a/lib/stealth/services/bandwidth/message_event_handler.rb b/lib/stealth/services/bandwidth/message_event_handler.rb deleted file mode 100644 index 9c23491..0000000 --- a/lib/stealth/services/bandwidth/message_event_handler.rb +++ /dev/null @@ -1,25 +0,0 @@ -module Stealth - module Services - module Bandwidth - - class MessageEventHandler - def self.determine_event_type(request) - # Create a new instance of ServiceMessage with the request params and headers - service_message = Stealth::Services::Bandwidth::ServiceMessage.new( - params: request.params.dig(:_json)&.first, - headers: request.headers - ).process - - # Determine the event type and include the service_message in the response - case service_message.service_event_type - when 'message-received' - { type: :text_received, service_message: service_message } - else - { type: :unknown_event } - end - end - end - - end - end -end diff --git a/lib/stealth/services/bandwidth/message_handler.rb b/lib/stealth/services/bandwidth/message_handler.rb deleted file mode 100644 index 8da42e9..0000000 --- a/lib/stealth/services/bandwidth/message_handler.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -# module Stealth -# module Services -# module Bandwidth -# class MessageHandler < Stealth::Services::BaseMessageHandler -# attr_reader :service_message, :params, :headers - -# def initialize(params:, headers:) -# @params = params -# @headers = headers -# end - -# def coordinate -# case params.dig('message', 'direction') -# when "in" -# Stealth::Services::HandleMessageJob.perform_async( -# 'bandwidth', -# params, -# headers -# ) -# when "out" -# # Ignoring outbound messages -# end - -# # Relay our acceptance -# [202, 'Accepted'] -# end - -# def process -# @service_message = ServiceMessage.new(service: 'bandwidth') - -# service_message.sender_id = params.dig('message', 'from') -# service_message.target_id = params.dig('message', 'to') -# service_message.message = params.dig('message', 'text') -# service_message.timestamp = params.dig('message', 'time') -# params.dig('message', 'media')&.each do |attachment_url| -# service_message.attachments << { -# url: attachment_url -# } -# end - -# service_message -# end - -# end - -# end -# end -# end diff --git a/lib/stealth/services/bandwidth/service_call.rb b/lib/stealth/services/bandwidth/service_call.rb deleted file mode 100644 index 186b359..0000000 --- a/lib/stealth/services/bandwidth/service_call.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Stealth - module Services - module Bandwidth - - class ServiceCall < Stealth::ServiceCall - attr_reader :params, :headers - - def initialize(params:, headers:) - super(service: 'bandwidth') - @params = params - @headers = headers - end - - def process - self.call_id = params['callId'] - self.call_url = params['callUrl'] - self.sender_id = params['from'] - self.target_id = params['to'] - self.service_event_type = params['eventType'] - - self - end - end - - end - end -end diff --git a/lib/stealth/services/bandwidth/service_message.rb b/lib/stealth/services/bandwidth/service_message.rb deleted file mode 100644 index 3549790..0000000 --- a/lib/stealth/services/bandwidth/service_message.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Stealth - module Services - module Bandwidth - - class ServiceMessage < Stealth::ServiceMessage - attr_reader :params, :headers - - def initialize(params:, headers:) - super(service: 'bandwidth') - @params = params - @headers = headers - end - - def process - self.sender_id = params.dig('message', 'from') - self.target_id = params.dig('to') - self.message = params.dig('message', 'text') - self.service_event_type = params.dig('type') - self.timestamp = params.dig('time') - - # Handle attachments if any - params.dig('message', 'media')&.each do |attachment_url| - service_message.attachments << { - url: attachment_url - } - end - - self - end - end - - end - end -end From ee0cfe10996fcc84eec205dc732e55aba78e86ed Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Fri, 7 Feb 2025 15:54:08 -0500 Subject: [PATCH 06/11] Update Gemfile and Stealth version dependency --- Gemfile | 2 +- Gemfile.lock | 289 +++++++++++++++++++++++++++++--------- stealth-bandwidth.gemspec | 2 +- 3 files changed, 223 insertions(+), 70 deletions(-) diff --git a/Gemfile b/Gemfile index 859742e..c1bd833 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -gem 'stealth', '>= 2.0.0.beta6' +gem 'stealth', git: 'git@github.com:hellostealth/stealth.git', branch: '3.0-mountable' gemspec diff --git a/Gemfile.lock b/Gemfile.lock index abcb25e..525b10b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,99 +1,252 @@ +GIT + remote: git@github.com:hellostealth/stealth.git + revision: 1dcdc7d3fe8bf5851d10840ff9d8546f26248f95 + branch: 3.0-mountable + specs: + stealth (3.0.0.alpha1) + rails (>= 7.1.3.4) + redis (~> 5.0) + sidekiq (~> 7.0) + spectre_ai (~> 1.2.0) + PATH remote: . specs: stealth-bandwidth (1.1.0) http (~> 4.1) oj (~> 3.11) - stealth (>= 2.0.0.beta6) + stealth (>= 3.0.0.alpha1) GEM remote: https://rubygems.org/ specs: - activesupport (6.1.7) - concurrent-ruby (~> 1.0, >= 1.0.2) + actioncable (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) + actionmailer (7.2.2.1) + actionpack (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.2.1) + actionview (= 7.2.2.1) + activesupport (= 7.2.2.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.2) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.2.1) + actionpack (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.2.2.1) + activesupport (= 7.2.2.1) + globalid (>= 0.3.6) + activemodel (7.2.2.1) + activesupport (= 7.2.2.1) + activerecord (7.2.2.1) + activemodel (= 7.2.2.1) + activesupport (= 7.2.2.1) + timeout (>= 0.4.0) + activestorage (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activesupport (= 7.2.2.1) + marcel (~> 1.0) + activesupport (7.2.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) - addressable (2.8.1) - public_suffix (>= 2.0.2, < 6.0) - concurrent-ruby (1.1.10) - connection_pool (2.3.0) - diff-lcs (1.5.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) - ffi (1.15.5) - ffi-compiler (1.0.1) - ffi (>= 1.0.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9) + builder (3.3.0) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) + crass (1.0.6) + date (3.4.1) + diff-lcs (1.5.1) + domain_name (0.6.20240107) + drb (2.2.1) + erubi (1.13.1) + ffi (1.17.1) + ffi-compiler (1.3.2) + ffi (>= 1.15.5) rake + globalid (1.2.1) + activesupport (>= 6.1) http (4.4.1) addressable (~> 2.3) http-cookie (~> 1.0) http-form_data (~> 2.2) http-parser (~> 1.2.0) - http-cookie (1.0.5) + http-cookie (1.0.8) domain_name (~> 0.5) http-form_data (2.3.0) http-parser (1.2.3) ffi-compiler (>= 1.0, < 2.0) - i18n (1.12.0) + i18n (1.14.7) concurrent-ruby (~> 1.0) - minitest (5.16.3) - multi_json (1.15.0) - mustermann (2.0.2) - ruby2_keywords (~> 0.0.1) - nio4r (2.5.8) - oj (3.13.23) - public_suffix (5.0.0) - puma (5.6.5) - nio4r (~> 2.0) - rack (2.2.4) - rack-protection (2.2.2) - rack + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + logger (1.6.5) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + mini_mime (1.1.5) + mini_portile2 (2.8.8) + minitest (5.25.4) + net-imap (0.5.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol + nio4r (2.7.4) + nokogiri (1.18.2) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + oj (3.16.9) + bigdecimal (>= 3.0) + ostruct (>= 0.2) + ostruct (0.6.1) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio + public_suffix (6.0.1) + racc (1.8.1) + rack (2.2.10) + rack-session (1.0.2) + rack (< 3) rack-test (1.1.0) rack (>= 1.0, < 3) - rake (13.0.6) - redis (4.8.0) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.2.2.1) + actioncable (= 7.2.2.1) + actionmailbox (= 7.2.2.1) + actionmailer (= 7.2.2.1) + actionpack (= 7.2.2.1) + actiontext (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activemodel (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + bundler (>= 1.15.0) + railties (= 7.2.2.1) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.2.1) + rdoc (6.12.0) + psych (>= 4.0.0) + redis (5.3.0) + redis-client (>= 0.22.0) + redis-client (0.23.2) + connection_pool + reline (0.6.0) + io-console (~> 0.5) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.3) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-support (3.11.0) - rspec_junit_formatter (0.5.1) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - ruby2_keywords (0.0.5) - sidekiq (6.5.6) - connection_pool (>= 2.2.5) - rack (~> 2.0) - redis (>= 4.5.0, < 5) - sinatra (2.2.2) - mustermann (~> 2.0) - rack (~> 2.2) - rack-protection (= 2.2.2) - tilt (~> 2.0) - stealth (2.0.0.beta6) - activesupport (~> 6.0) - multi_json (~> 1.12) - puma (>= 4.2, < 6.0) - sidekiq (~> 6.0) - sinatra (~> 2.0) - thor (~> 1.0) - thor (1.2.1) - tilt (2.0.11) - tzinfo (2.0.5) + securerandom (0.4.1) + sidekiq (7.3.8) + base64 + connection_pool (>= 2.3.0) + logger + rack (>= 2.2.4) + redis-client (>= 0.22.2) + spectre_ai (1.2.0) + stringio (3.1.2) + thor (1.3.2) + timeout (0.4.3) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) - zeitwerk (2.6.0) + useragent (0.16.11) + webrick (1.9.1) + websocket-driver (0.7.7) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) PLATFORMS ruby @@ -102,7 +255,7 @@ DEPENDENCIES rack-test (~> 1.1) rspec (~> 3.6) rspec_junit_formatter (~> 0.3) - stealth (>= 2.0.0.beta6) + stealth! stealth-bandwidth! BUNDLED WITH diff --git a/stealth-bandwidth.gemspec b/stealth-bandwidth.gemspec index 326e78d..017d90e 100644 --- a/stealth-bandwidth.gemspec +++ b/stealth-bandwidth.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |s| s.authors = ['Mauricio Gomes', 'Emilie Morissette'] s.email = ['mauricio@edge14.com', 'emorissettegregoire@gmail.com'] - s.add_dependency 'stealth', '>= 2.0.0.beta6' + s.add_dependency 'stealth', '>= 3.0.0.alpha1' s.add_dependency 'http', '~> 4.1' s.add_dependency 'oj', '~> 3.11' From 0c4666898a63561750c328cd87c2f55210d811e6 Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:02:52 -0500 Subject: [PATCH 07/11] Update stealth-bandwidth version --- .github/workflows/release.yml | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12a67bf..de849be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.0 bundler-cache: true - name: Publish gem env: diff --git a/Gemfile.lock b/Gemfile.lock index 525b10b..b3e8516 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ GIT PATH remote: . specs: - stealth-bandwidth (1.1.0) + stealth-bandwidth (2.0.0) http (~> 4.1) oj (~> 3.11) stealth (>= 3.0.0.alpha1) From 2d02ee5e1c1a4ca0941f7cc4f8af4d2b1e8daede Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:10:40 -0500 Subject: [PATCH 08/11] Use https instead of git --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index c1bd833..b414015 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -gem 'stealth', git: 'git@github.com:hellostealth/stealth.git', branch: '3.0-mountable' +gem 'stealth', git: 'https://github.com/hellostealth/stealth.git', branch: '3.0-mountable' gemspec diff --git a/Gemfile.lock b/Gemfile.lock index b3e8516..366a2c0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GIT - remote: git@github.com:hellostealth/stealth.git + remote: https://github.com/hellostealth/stealth.git revision: 1dcdc7d3fe8bf5851d10840ff9d8546f26248f95 branch: 3.0-mountable specs: From ee4eb3f466f08cdb466f7c210a24aa423dd1218c Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:13:53 -0500 Subject: [PATCH 09/11] Update ruby version in ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fe30fb..4dacecd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,5 +9,5 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.0 bundler-cache: true From 1c175cdc6ddb51029fe12a4ecc76469f644438b0 Mon Sep 17 00:00:00 2001 From: Emilie <45463745+emorissettegregoire@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:18:36 -0500 Subject: [PATCH 10/11] Update bundler --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 366a2c0..7d2ee82 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -259,4 +259,4 @@ DEPENDENCIES stealth-bandwidth! BUNDLED WITH - 2.2.32 + 2.6.3 From 624cbe81860df9bb3e342872ea0494913a286024 Mon Sep 17 00:00:00 2001 From: Matthew Black Date: Mon, 10 Feb 2025 14:51:16 -0800 Subject: [PATCH 11/11] Update Authors --- stealth-bandwidth.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stealth-bandwidth.gemspec b/stealth-bandwidth.gemspec index 017d90e..161a334 100644 --- a/stealth-bandwidth.gemspec +++ b/stealth-bandwidth.gemspec @@ -9,8 +9,8 @@ Gem::Specification.new do |s| s.homepage = 'https://github.com/hellostealth/stealth-bandwidth' s.licenses = ['MIT'] s.version = version - s.authors = ['Mauricio Gomes', 'Emilie Morissette'] - s.email = ['mauricio@edge14.com', 'emorissettegregoire@gmail.com'] + s.authors = ['Emilie Morissette'] + s.email = ['emorissettegregoire@gmail.com'] s.add_dependency 'stealth', '>= 3.0.0.alpha1' s.add_dependency 'http', '~> 4.1'