Giter VIP home page Giter VIP logo

mock-twilio's Introduction

Mock::Twilio::Client

Gem Version mock-twilio

This is a SchoolStatus implementation to mock twilio client to perform requests to twilio-oai

Installation

To install using bundler grab the latest stable version:

gem install mock-twilio

Requirements

OR

Defaults Prism

  • proxy_address = twilio_mock_server
  • proxy_port = 4010
  • proxy_protocol = http

Features Support

Mock::Twilio::Client Support
client.messages.create(to: "+593978613041", body: "Testing SMS", from: "+13212855389")
client.messaging.v1.services("MG"+"F"*32).phone_numbers.create(phone_number_sid: @phone_number_sid)
client.available_phone_numbers('US').local.list(limit: 20)
client.incoming_phone_numbers.create(phone_number: "+1987654321", voice_url: "#{BASE_URL}/api/v1/twilio_calls/incoming", sms_url: "#{BASE_URL}/api/v1/twilio_requests/inbound")
client.lookups.v2.phone_numbers("+14159929960").fetch(fields: :line_type_intelligence)
client.calls.create(url: '<http://demo.twilio.com/docs/voice.xml>', to: '+14155551212', from: '+15017122661', status_callback: '<https://myapp.com/events>', status_callback_event: ['ringing'], status_callback_method: 'POST')
client.conferences("CF"+("F")*32).participants.create(label: 'customer', early_media: true, beep: 'onEnter', status_callback: '<https://myapp.com/events>', status_callback_event: ['ringing'], record: true, from: '+15017122661', to: '+15558675310')
client.trusthub.v1.customer_profiles.create(**twilio_attributes)
client.trusthub.v1.customer_profiles(customer_profile_sid).customer_profiles_entity_assignments.create(object_sid:)
client.trusthub.v1.end_users.create(**twilio_parameters)
client.trusthub.v1.supporting_documents.create(**twilio_parameters)
client.addresses.create(**twilio_parameters)
client.trusthub.v1.customer_profiles.create(**twilio_attributes)
client.trusthub.v1.customer_profiles(customer_profile.sid).customer_profiles_evaluations.create(policy_sid:)

Trigger resources updates

Mock::Twilio::Webhooks Support
Webhooks::Messages
Webhooks::InboundMessages
Webhooks::Calls
Webhooks::CallStatusUpdates
Webhooks::Conferences
Webhooks::CustomerProfiles
Webhooks::Brands

How to use

Initializer sample

Mock::Twilio.configure do |config|
  config.host = "http://shunkan-ido-service"
  config.forwarded_host = "shunkan-ido-service"
  config.port = "3000"
  config.proto = "http"
end

Example

export TWILIO_ACCOUNT_SID=ACFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
export TWILIO_API_KEY=SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
export TWILIO_API_SECRET=ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

mock_client = Mock::Twilio::Client.new
client = Twilio::REST::Client.new(nil, nil, nil, nil, mock_client)
client.messages.create(to: "+593978613041", body: "RB This is the ship that made the Kesssssel Run in fourteen parsecs?", from: "+13212855389")

Run tests

rake test

Swagger - OpenApi Issues

  • Array and Boolean validations due open api formats, ie params as status_callback_event, early_media. Validations removed for them on json files.

mock-twilio's People

Contributors

torukmnk avatar

Stargazers

 avatar Tyler McClellan avatar

Watchers

Josh Deere avatar R D avatar  avatar

mock-twilio's Issues

Support SIDs to follow up updates

Twilio OAI returns static response values

We would like to respond with sid, message_sid, message_uuid, etc. from the request to follow up further updates and integrate webhooks.

Current response

  {"body"=>"string",
   "num_segments"=>"string",
   "direction"=>"inbound",
   "from"=>"string",
   "to"=>"string",
   "date_updated"=>"string",
   "price"=>"string",
   "error_message"=>"string",
   "uri"=>"string",
   "account_sid"=>"stringstringstringstringstringstri",
   "num_media"=>"string",
   "status"=>"queued",
   "messaging_service_sid"=>"stringstringstringstringstringstri",
   "sid"=>"stringstringstringstringstringstri",
   "date_sent"=>"string",
   "date_created"=>"string",
   "error_code"=>0,
   "price_unit"=>"string",
   "api_version"=>"string",
   "subresource_uris"=>{}
   } 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.