0.0
No commit activity in last 3 years
No release in over 3 years
This API wrapper is meant to provide a rails friendly configurable api wrapper to access DIDWW's SOAP based API using Savon gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 10.0
~> 3.0

Runtime

~> 2.11.1
 Project Readme

DIDWW

A simple Rails friendly API wrapper for DIDWW's SOAP based API

Installation

Add this line to your application's Gemfile:

gem 'DIDWW', git: 'https://github.com/modulis/DIDWW-API-WRAPPER.git'

And then execute:

$ bundle

Or install it yourself as:

$ gem install DIDWW

Usage

Configuration

First you must configure DIDWW or you won't be able to make requests.

DIDWW.configure do |config|
  config.api_username = 'user@user.ca' # Your api username given to you by didww
  config.api_key = 'example_key_u90sd8f7sd9' # Your secret api key given to you by didww
  config.sandbox = false # Optional. True by default, you must set it to live manually.
end

For secret information like your api_key it's recommended that you use something like environment variables. For example:

DIDWW.configure do |config|
  config.api_key = ENV['DIDWW_API_KEY']
end

Building the client

You can create a client which will inheret DIDWW configuration automatically using

client = DIDWW::Client.new

If you would like to change the configuration for a specific client you'll have to do so manually:

client.configuration.sandbox = false # sets this client to live mode

Making calls

A list of methods can be seen in METHOD_TRANSLATIONS in the client class in the source code. Making a call is as easy as:

client = DIDWW::Client.new
client.check_pstn_number(pstn_number: 1111111)

Convenience methods

DIDWW has a few convenience methods to use in your code:

DIDWW.configure do |config|
  config.sandbox = true
end
DIDWW.sandbox? #=> true
DIDWW.live? #=> false
DIDWW.mode #=> :sandbox (alternatively :live)

Development

You have access to a developer console to use the gem interactively by running bin/console from the project directory. Please write specs for any additions, and use shared examples when possible.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/DIDWW.

License

The gem is available as open source under the terms of the MIT License.