class Textmagic::REST::Sessions
Public Instance Methods
Creating is not supported.
# File lib/textmagic-ruby/rest/sessions.rb 72 def create(params={}) 73 raise '`create` method is not supported for this resource.' 74 end
Delete session by ID. Returns true if success.
- uid
-
Session
ID. Required.
Example:
r = client.sessions.delete 123123
Textmagic::REST::ListResource#delete
# File lib/textmagic-ruby/rest/sessions.rb 85 def delete(uid) 86 super uid 87 end
Get session by ID. Returns Session
object.
- uid
-
Session
ID. Required.
Example:
@session = client.sessions.get 123131
Textmagic::REST::ListResource#get
# File lib/textmagic-ruby/rest/sessions.rb 36 def get(uid) 37 super uid 38 end
Get all user message sessions. Returns PaginateResource
object, contains array of Session
objects.
The following params keys are supported:
- page
-
Fetch specified results page. Defaults 1
- limit
-
How many results on page. Defaults 10
Example:
@sessions = client.sessions.list
Textmagic::REST::ListResource#list
# File lib/textmagic-ruby/rest/sessions.rb 19 def list(params={}) 20 [:search, 'search'].each do |search| 21 params.delete search 22 end 23 super params 24 end
Fetch messages by given session id. An useful synonym for “messages/search” command with provided `session_id` parameter. Returns PaginateResource
object, contains array of Message
objects.
- uid
-
Session
ID. Required.
The following params keys are supported:
- page
-
Fetch specified results page. Defaults 1
- limit
-
How many results on page. Defaults 10
Example:
@messages = client.sessions.messages 123
# File lib/textmagic-ruby/rest/sessions.rb 57 def messages(uid, params={}) 58 response = @client.get "#{@path}/#{uid}/messages", params 59 PaginateResource.new "#{@path}", @client, response, Textmagic::REST::Message 60 end
Updating is not supported.
# File lib/textmagic-ruby/rest/sessions.rb 65 def update(uid, params={}) 66 raise '`update` method is not supported for this resource.' 67 end