ReadyTalk
A Ruby wrapper for the ReadyTalk API. It provides a set of classes that map to API endpoints and data structures.
Installation
Include this line to your application's Gemfile:
gem 'readytalk'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install readytalk
Documentation
Configuration
If you are using Rails, the readytalk gem can be configured in an initializer or environment file.
Configuration options can be passed as a block or set as a Hash.
ReadyTalk.configure do |config|
config.tollfree = 0000000000 # your toll free number
config.accesscode = 1212121 # your access code
config.passcode = 1234 # your passcode
config.test_mode = true # if true, operate in sandbox mode: https://apidev-cc.readytalk.com
end
Outside the Rails environment configuration options can be set directly on the
ReadyTalk
module.
ReadyTalk.config.tollfree = 0000000000
ReadyTalk.config.accesscode = 1212121
ReadyTalk.config.passcode = 1234
Usage
All ReadyTalk API endpoints have an equivalent method call. Consult API documentation for list of required and optional input parameters.
-
ReadyTalk::Account
-
self.get_option(option_name)
- Get Account Option -
self.list_international_numbers()
- List International Numbers -
self.list_questions(input_params)
- List Poll Questions
-
-
ReadyTalk::Meeting
-
self.create(input_params)
- Create Meetings -
self.list(input_params)
- List Meetings -
self.details(id)
- Meeting Details -
details()
- Meeting Details -
cancel(input_params)
- Cancel Meeting -
update(input_params)
- Update Meeting -
create_registration(input_params)
- Create Registration -
create_invitations(input_params)
- Create Invitations -
list_registrations(input_params)
- List Registrations -
list_surveys(input_params)
- List Post Event Surveys -
list_chats()
- List Chats
-
-
ReadyTalk::Recording
-
self.list(input_params)
- List Recordings -
self.details(id, input_params)
- Recording Details -
details(input_params)
- Recording Details -
list_registrations(input_params)
- List Recording Registrations
-
An example API call might resemble the following:
ReadyTalk::Meeting.create(
title: 'Test Meeting',
host_name: 'Stevie Tester',
from_email: 'sevetester@example.com',
start_date_iso8601: '2016-01-30T08:00:00-05:00',
duration_in_seconds: '3600',
time_zone: 'EST',
registration: 'PRE_REG_AUTOMATIC_CONFIRMATION_NO_NOTIFICATION',
type: 'WEB_AND_AUDIO',
audio: {on_demand: 'DISPLAY_TOLLFREE_DISPLAY_TOLL'}
)
The documented API Data Types
have equivalent ReadyTalk
namespaced classes. All attributes are accessible via
method calls.
> meeting = ReadyTalk::Meeting.details(012345)
=> #<ReadyTalk::Meeting @data={"id"=>"012345"...}>
> meeting.id
=> 012345
> meeting.meeting_details
=> #<ReadyTalk::MeetingDetails @data={"meetingType"=>"WEB_AND_AUDIO"...}>
> meeting.meeting_details.meeting_type
=> "WEB_AND_AUDIO"
API list endpoints return ReadyTalk::ReadyTalkList
objects, which respond
to []
, first
, last
, size
, each
, and empty?
.
Any additional attributes returned by a list endpoint, such as paging_criteria
,
are also available via method calls on the list object.
Handling Errors
Errors returned by the API are raised as ReadyTalk::ReadyTalkError
. It is possible
for multiple errors to be returned for a given request. raw API errors are accessible
via the errors
method on ReadyTalk::ReadyTalkError
.
Additionally, the full_messages
method will return an Array containing the messages
for each error.
TODO/Coming Soon
Tests will be coming very shortly. I also plan on developing a mock webhook for use in external projects.