Mock::Bandwidth

Gem Version mock-bandwidth

This is a SchoolStatus implementation to mock Bandwidth-sdk to perform requests to bandwidth-oai

Installation

To install using bundler grab the latest stable version:

gem install mock-bandwidth

Requirements

Defaults Prism

  • proxy_address = bandwidth_mock_server
  • proxy_port = 4010
  • proxy_protocol = http

Features Support

Support Mock::Bandwidth
:white_check_mark: Bandwidth::MessagesApi.new.create_message(account_id, body)

Trigger resources updates

Mock::Bandwidth::Webhooks Support
Webhooks::Messages :white_check_mark:

How to use

Initializer sample

Bandwidth.configure do |config| # Configure Basic Auth
  config.username = "username"
  config.password = "password"
  config.configure_faraday_connection do |connection|
    connection.proxy = "http://mock-server.test"
    connection.use Mock::Bandwidth::Middleware::Proxy
  end
end

Mock::Bandwidth.configure do |config|
  config.webhook_message_status_url = "http://my-server.com/webhooks/bandwidth/messages_updates"
  # optional
  # config.disable_webhooks = true
end

Example

from = "+18001234123123"
application_id = "12341234"
account_id = "123123"
text = "sms text"
to = "+17001234123123"

body = Bandwidth::MessageRequest.new(
  {
    from: from,
    application_id: application_id,
    to: [to],
    text: text
  }
)
messaging_api_instance = Bandwidth::MessagesApi.new
response = messaging_api_instance.create_message(account_id, body)

=> #<Bandwidth::Message:0x00005f39e4efcae0 @application_id="12341234", @from="+18001234123123", @id="1737987840867jqaf7b3rad1a6fn", @owner="+18001234123123", @text="sms text", @to=["+17001234123123"]>

Run tests

rake test