Module: Pair::Api

Extended by:
Api
Includes:
HTTParty
Included in:
Api
Defined in:
lib/pair/api.rb

Instance Method Summary collapse

Instance Method Details

#create_session(session) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pair/api.rb', line 15

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

#join_session(session) ⇒ Object



32
33
34
35
36
37
# File 'lib/pair/api.rb', line 32

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

#setupObject



9
10
11
12
13
# File 'lib/pair/api.rb', line 9

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