Class: CTM::MessageList

Inherits:
List
  • Object
show all
Defined in:
lib/ctm/message_list.rb

Instance Attribute Summary

Attributes inherited from List

#filters, #list_type, #objects, #page, #per_page, #token, #total_entries, #total_pages

Instance Method Summary collapse

Methods inherited from List

#create, #each, #each_page, #find, #get

Constructor Details

#initialize(options = {}, token = nil) ⇒ MessageList

Returns a new instance of MessageList.



3
4
5
6
# File 'lib/ctm/message_list.rb', line 3

def initialize(options={}, token=nil)
  super('Message', options, token)
  @list_type_path = "accounts/#{@account_id}/sms"
end

Instance Method Details

#send_message(to, from, message) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/ctm/message_list.rb', line 8

def send_message(to, from, message)
  options = {:to => to, :from => from, :msg => message}
  path_str = "/api/v1/#{@list_type_path}.json"
  res = self.class.post(path_str, :body => options.merge(:auth_token => @token))
  data = res.parsed_response
  puts data.inspect
  (data["status"] == "processing")
end