Module: TropoRest::Client::Session

Included in:
TropoRest::Client
Defined in:
lib/tropo_rest/client/session.rb

Constant Summary collapse

PLURAL_PATH =
"sessions".freeze

Instance Method Summary collapse

Instance Method Details

#create_session(token, params = {}) ⇒ Hashie::Mash

Creates a session for the given token

Parameters:

  • token (String)

    The token of the application.

  • params (Hash) (defaults to: {})

    The parameters to pass to the session.

Returns:

  • (Hashie::Mash)

    The session object.

See Also:



13
14
15
16
17
18
19
# File 'lib/tropo_rest/client/session.rb', line 13

def create_session(token, params={})
  params.merge!('token' => token)
  params.merge!(params) { |k,v| v.to_s } # custom parameters must be strings
  response = post(PLURAL_PATH, params)
  response.id = response.id.strip if response.id
  response
end