Module: BurstSms::MessagesAdd

Included in:
API
Defined in:
lib/burstsms/messages_add.rb

Defined Under Namespace

Classes: Response

Instance Method Summary collapse

Instance Method Details

#add_message(from, list_id, message, options = {}) ⇒ Object



6
7
8
9
# File 'lib/burstsms/messages_add.rb', line 6

def add_message(from, list_id, message, options={})
  @response = post_to_api(add_message_body(from, list_id, message, options))
  Response.parse(@response.body)
end

#add_message_body(from, list_id, message, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/burstsms/messages_add.rb', line 11

def add_message_body(from, list_id, message, options={})
  build_request("messages.add", :list_id => list_id,   
                                :caller_id => check_valid_sender(from),
                                :message => encode_msg(message),
                                :sendtime => (options.has_key?(:sendtime) ? options[:sendtime] : nil),
                                :validity => (options.has_key?(:validity) ? options[:validity] : nil),
                                :contact_list => (options.has_key?(:contact_list) ? options[:contact_list] : nil)
                                )
end