module EventMachine::Smsified::SubscriptionsModule

Public Instance Methods

create_inbound_subscription(destination_address, options, &blk) click to toggle source

Creates an inbound subscription

@param [required, String] destination_address to subscribe to @param [required, Hash] params to send an sms @option params [optional, String] :notify_url to send callbacks to @option params [optional, String] :client_correlator to update @option params [optional, String] :callback_data to update @return [Object] A Response Object with http and data instance methods @param [required, String] notify_url to send callbacks to @return [Object] A Response Object with http and data instance methods @example

subscriptions.create_inbound_subscription('tel:+14155551212', :notify_url => 'http://foobar.com')
# File lib/em-smsified/subscriptions.rb, line 17
def create_inbound_subscription(destination_address, options, &blk)
  query = options.merge({ :destination_address => destination_address })
  
  post("/smsmessaging/inbound/subscriptions", 
       camelcase_keys(query),
       SMSIFIED_HTTP_HEADERS, &blk
       )

end
create_outbound_subscription(sender_address, options, &blk) click to toggle source

Creates an outbound subscription

@param [required, String] sender_address to subscribe to @option params [optional, String] :notify_url to send callbacks to @option params [optional, String] :client_correlator to update @option params [optional, String] :callback_data to update @return [Object] A Response Object with http and data instance methods @example

subscriptions.create_outbound_subscription('tel:+14155551212', :notify_url => 'http://foobar.com')
# File lib/em-smsified/subscriptions.rb, line 37
def create_outbound_subscription(sender_address, options, &blk)
  post("/smsmessaging/outbound/#{sender_address}/subscriptions", 
       build_query_string(options),
       SMSIFIED_HTTP_HEADERS, &blk
       )
end
delete_inbound_subscription(subscription_id, &blk) click to toggle source

Deletes an inbound subscription

@param [required, String] subscription_id to delete @return [Object] A Response Object with http and data instance methods @example

subscriptions.delete_inbound_subscription('89edd71c1c7f3d349f9a3a4d5d2d410c')
# File lib/em-smsified/subscriptions.rb, line 51
def delete_inbound_subscription(subscription_id, &blk)
  delete("/smsmessaging/inbound/subscriptions/#{subscription_id}", SMSIFIED_HTTP_HEADERS, &blk)
end
delete_outbound_subscription(subscription_id, &blk) click to toggle source

Deletes an outbound subscription

@param [required, String] subscription_id to delete @return [Object] A Response Object with http and data instance methods @example

subscriptions.delete_outbound_subscription('89edd71c1c7f3d349f9a3a4d5d2d410c')
# File lib/em-smsified/subscriptions.rb, line 62
def delete_outbound_subscription(subscription_id, &blk)
  delete("/smsmessaging/outbound/subscriptions/#{subscription_id}", SMSIFIED_HTTP_HEADERS, &blk)
end
inbound_subscriptions(destination_address, &blk) click to toggle source

Fetches the inbound subscriptions

@param [required, String] destination_address to fetch the subscriptions for @return [Object] A Response Object with http and data instance methods @example

subscriptions.inbound_subscriptions('tel:+14155551212')
# File lib/em-smsified/subscriptions.rb, line 73
def inbound_subscriptions(destination_address, &blk)
  get("/smsmessaging/inbound/subscriptions?destinationAddress=#{destination_address}",  SMSIFIED_HTTP_HEADERS, &blk)
end
outbound_subscriptions(sender_address, &blk) click to toggle source

Fetches the outbound subscriptions

@param [required, String] sender_address to fetch the subscriptions for @return [Object] A Response Object with http and data instance methods @example

subscriptions.outbound_subscriptions('tel:+14155551212')
# File lib/em-smsified/subscriptions.rb, line 84
def outbound_subscriptions(sender_address, &blk)
  get("/smsmessaging/outbound/subscriptions?senderAddress=#{sender_address}", SMSIFIED_HTTP_HEADERS, &blk)
end
update_inbound_subscription(subscription_id, options, &blk) click to toggle source

Updates an inbound subscription

@option params [required, String] subscription_id updating @param [required, Hash] params to update the inbound subscription with @option params [optional, String] :notify_url to send callbacks to @option params [optional, String] :client_correlator to update @option params [optional, String] :callback_data to update @return [Object] A Response Object with http and data instance methods @example

subscriptions.update_inbound_subscription('89edd71c1c7f3d349f9a3a4d5d2d410c', :notify_url => 'foobar')
# File lib/em-smsified/subscriptions.rb, line 99
def update_inbound_subscription(subscription_id, options, &blk)
  post("/smsmessaging/inbound/subscriptions/#{subscription_id}", 
       build_query_string(options),
       SMSIFIED_HTTP_HEADERS, &blk
       )
end
update_outbound_subscription(sender_address, options, &blk) click to toggle source

Updates an outbound subscription

@option params [required, String] sender_address updating @param [required, Hash] params to update the outbound subscription with @option params [optional, String] :notify_url to send callbacks to @option params [optional, String] :client_correlator to update @option params [optional, String] :callback_data to update @return [Object] A Response Object with http and data instance methods @example

subscriptions.update_outbound_subscription('tel:+14155551212', :notify_url => 'foobar')
# File lib/em-smsified/subscriptions.rb, line 117
def update_outbound_subscription(sender_address, options, &blk)
  post("/smsmessaging/outbound/#{sender_address}/subscriptions",                                   build_query_string(options), 
       SMSIFIED_HTTP_HEADERS, &blk
       )
end