Sha256: 7d53c354d4aa43be673ed91821d69f9b8def3147ba540e22c9ee0cce3064877e

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

require 'httparty'
require 'pair/config'

module Pair
  module Api
    include HTTParty
    extend self

    def setup
      base_uri Pair.config.host
      default_params :api_token => Pair.config.api_token
      yield
    end

    def create_session(session)
      setup do
        post("/v1/sessions", {
          :body => {
            :session => {
              :name         => session.name,
              :viewers      => session.viewers,
              :participants => session.participants,
              :tunnel       => {
                :host_login => session.host_login
              }
            }
          }
        })
      end
    end

    def join_session(session)
      setup do
        options = { :query => { :name => session.name, :host => session.host, :format => "json" } }
        get("/v1/sessions/search.json", options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pair-0.0.4 lib/pair/api.rb