class Textmagic::REST::Chats
Public Instance Methods
create(params={})
click to toggle source
Creating is not supported.
# File lib/textmagic-ruby/rest/chats.rb 47 def create(params={}) 48 raise '`create` method is not supported for this resource.' 49 end
delete(uid)
click to toggle source
Deleting is not supported.
# File lib/textmagic-ruby/rest/chats.rb 68 def delete(uid) 69 raise '`delete` method is not supported for this resource.' 70 end
get(uid)
click to toggle source
Getting by ID is not supported. Try get_by_phone
instead.
# File lib/textmagic-ruby/rest/chats.rb 54 def get(uid) 55 raise '`get` method by ID is not supported for this resource, use `get_by_phone`.' 56 end
get_by_phone(phone, params={})
click to toggle source
Fetch messages from chat with specified phone number.
- phone
-
Phone number in E.164 format. Required.
The following params keys are supported:
- page
-
Fetch specified results page. Defaults 1
- limit
-
How many results on page. Defaults 10
Example:
@chat_messages = client.chats.get_by_phone 99990000
# File lib/textmagic-ruby/rest/chats.rb 39 def get_by_phone(phone, params={}) 40 response = @client.get "#{@path}/#{phone}", params 41 PaginateResource.new "#{@path}", @client, response, Textmagic::REST::ChatMessage 42 end
list(params={})
click to toggle source
Get all user chats.
The following params keys are supported:
- page
-
Fetch specified results page. Defaults 1
- limit
-
How many results on page. Defaults 10
Example:
@chats = client.chats.list
Calls superclass method
# File lib/textmagic-ruby/rest/chats.rb 17 def list(params={}) 18 [:search, 'search'].each do |search| 19 params.delete search 20 end 21 super params 22 end
update(uid, params={})
click to toggle source
Updating is not supported.
# File lib/textmagic-ruby/rest/chats.rb 61 def update(uid, params={}) 62 raise '`update` method is not supported for this resource.' 63 end