lib/sms_notify/api.rb in cdyne-sms-notify-0.9.6 vs lib/sms_notify/api.rb in cdyne-sms-notify-0.10.0
- old
+ new
@@ -58,28 +58,38 @@
# * phone_number
# * message
#
# == Optional Attributes
# * scheduled_time
- # * response
- # * response_post_url
+ # * allow_responses
+ # * status_post_url
+ #
+ # == Example
+ # options = {
+ # :allow_responses => true,
+ # :scheduled_time => Time.now + 60,
+ # :status_post_url => 'http://foo.com'
+ # }
+ #
+ # @api.send_advanced_message('1234567890', 'Affirmative!', options)
def send_advanced_message(phone_number, message, options={})
opts = {
- :response => false,
+ :allow_responses => false,
:scheduled_time => Time.now,
- :response_post_url => ''
+ :status_post_url => ''
}.merge(options)
- soap_driver.sendSMSAdvanced( :Request => {
+ result = soap_driver.sendSMSAdvanced( :Request => {
:PhoneNumber => phone_number,
:Message => message,
:Licensekey => license_key,
:ScheduledTime => opts[:scheduled_time].utc.xmlschema(2),
- :Response => opts[:response],
- :ResponsePostURL => opts[:response_post_url]
+ :Response => opts[:allow_responses],
+ :ResponsePostURL => opts[:status_post_url]
}
)
+ MessageStatus.new(Response.parse(result))
end
# Implements +GetSMSStatus+[http://ws.cdyne.com/SmsWS/SMS.asmx?op=GetSMSStatus].
#
# == Required Attributes
@@ -104,10 +114,10 @@
# * text_id
#
# Returns an array of #MessageStatus objects.
#
# == Example:
- # @api.message_response("c7d8a")
+ # @api.message_responses("c7d8a")
def message_responses(text_id)
command = Command.new('GetSMSResponse', license_key)
responses = Response.parse( command.execute({:TextID => text_id}) )["ArrayOfSmsResponse"]["SmsResponse"]
responses.is_a?(Array) ? responses.collect { |r| MessageResponse.new(r) } : MessageResponse.new(responses)
end