Module: OnSIP::Session::ClassMethods
- Included in:
- OnSIP::Session
- Defined in:
- lib/onsip/session.rb
Instance Method Summary collapse
Instance Method Details
#create(username, password) ⇒ Object
27 28 29 30 |
# File 'lib/onsip/session.rb', line 27 def create(username, password) response = OnSIP.connection.get('/api', {'Action' => 'SessionCreate', 'Username' => username, 'Password' => password, 'Output' => 'json'}, {}) process_create_session_response response end |
#process_create_session_response(response) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/onsip/session.rb', line 32 def process_create_session_response(response) session = nil r = response.env.body['Response']['Context'] if r['Request'] && (r['Request']['IsValid'] == 'true') && r['Session'] h = r['Session'].delete_if { |key| %w().include?(key) } session = new h else raise OnSIPRequestException, 'Problem with session request' end session end |