Coder Social home page Coder Social logo

kazoo-client's Introduction

Kazoo::Client

Client library gem for use with the 2600Hz Kazoo phone system

Installation

Add this line to your application's Gemfile:

gem 'kazoo-client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kazoo-client

Usage Examples

Initialize

This will log in and get an auth token

api_url = "https://api.example.com"
version = "v2"
session = Kazoo::Client.new(api_url, version, username, password, realm)

You can then do any of the api calls until the auth token expires

Devices

Devices are often physical devices, but can be softphones, landlines, etc.

Get all Devices

devices = session.get_devices

Add a Device

device = { data: {
  name: '100',
  device_type: 'sip_device',
  enabled: true,
  mac_address: 'de:ad:be:ef:ca:fe' } }
session.add_device(device)

Get a Device

device_id = '0123456789abcdef0123456789abcdef'
session.get_device(device_id)

Update a Device

device = { data: {
  name: '101',
  device_type: 'sip_device',
  enabled: true,
  mac_address: 'de:ad:be:ef:ca:fe' } }
session.update_device(device_id, device)

Sync or reboot a device

session.sync_device(device_id)

sync_device is an api v2 only call

Delete a Device

session.delete_device(device_id)

Users

Get all Users

users = session.get_users

Add a User

user = { data: {
  first_name:"George",
  last_name:"Test",
  username:"georgetest",
  vm_to_email_enabled:true } }
session.add_user(user_json)

Get a User

user_id = '0123456789abcdef0123456789abcdef'
session.get_user(user_id)

Update a User

user = { data: {
  first_name:"George",
  last_name:"Test 2",
  username:"georgetest",
  vm_to_email_enabled:true } }
session.update_user(user_id, user)

Delete a User

session.delete_user(user_id)

Get all hotdesk

session.get_all_hotdesk

Development

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/square/kazoo-client.

License

Copyright 2017 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

kazoo-client's People

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.