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 = '[email protected]' # 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.