em-sessions

em-sessions is rest-sessions ruby client, about see: rest-sessions.

Installation

Install em-sessions as a gem:

gem install em-sessions

or add to your Gemfile:

# Gemfile
gem 'em-http-request'
gem 'em-sessions'

and run bundle install to install the dependency.

Initialize

# default: init(url = 'localhost:3000', app = 'weapp')
Em::Sessions.init
client = Em::Sessions.client

or

client = Em::Sessions.client 'localhost:3000', 'weapp'

Notice

client`s all methods return two params, one code, one json, such as:

 client.create '1' # [200, {"token": "9kwi9wu429dkw8urkhr923jrekw32" ]

you can

 code, json = client.create '1'
 json['token'] # 9kwi9wu429dkw8urkhr923jrekw32

Use List


  client.create(id, out_time = 7200, ip = '0.0.0.0')

  client.find_by_token(token)

  client.find_by_id(id)

  client.set_params_by_token(token, params = {})

  client.delete_by_token(token)

  client.delete_by_id(id)

  client.delete_all

  client.activity?

Copyright © 2011-2016. See LICENSE for details.