lib/smsified/subscriptions.rb in smsified-0.1.6 vs lib/smsified/subscriptions.rb in smsified-0.1.7

- old
+ new

@@ -46,11 +46,14 @@ def create_inbound_subscription(destination_address, options) query = options.merge({ :destination_address => destination_address }) Response.new self.class.post("/smsmessaging/inbound/subscriptions", :basic_auth => @auth, - :body => camelcase_keys(query)) + :body => camelcase_keys(query), + :headers => SMSIFIED_HTTP_HEADERS + ) + end ## # Creates an outbound subscription # @@ -62,55 +65,57 @@ # @example # subscriptions.create_outbound_subscription('tel:+14155551212', :notify_url => 'http://foobar.com') def create_outbound_subscription(sender_address, options) Response.new self.class.post("/smsmessaging/outbound/#{sender_address}/subscriptions", :basic_auth => @auth, - :body => build_query_string(options)) + :body => build_query_string(options), + :headers => SMSIFIED_HTTP_HEADERS + ) end ## # 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') def delete_inbound_subscription(subscription_id) - Response.new self.class.delete("/smsmessaging/inbound/subscriptions/#{subscription_id}", :basic_auth => @auth) + Response.new self.class.delete("/smsmessaging/inbound/subscriptions/#{subscription_id}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS) end ## # 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') def delete_outbound_subscription(sender_address) - Response.new self.class.delete("/smsmessaging/outbound/subscriptions/#{sender_address}", :basic_auth => @auth) + Response.new self.class.delete("/smsmessaging/outbound/subscriptions/#{sender_address}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS) end ## # 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') def inbound_subscriptions(destination_address) - Response.new self.class.get("/smsmessaging/inbound/subscriptions?destinationAddress=#{destination_address}", :basic_auth => @auth) + Response.new self.class.get("/smsmessaging/inbound/subscriptions?destinationAddress=#{destination_address}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS) end ## # 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') def outbound_subscriptions(sender_address) - Response.new self.class.get("/smsmessaging/outbound/subscriptions?senderAddress=#{sender_address}", :basic_auth => @auth) + Response.new self.class.get("/smsmessaging/outbound/subscriptions?senderAddress=#{sender_address}", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS) end ## # Updates an inbound subscription # @@ -123,11 +128,13 @@ # @example # subscriptions.update_inbound_subscription('89edd71c1c7f3d349f9a3a4d5d2d410c', :notify_url => 'foobar') def update_inbound_subscription(subscription_id, options) Response.new self.class.post("/smsmessaging/inbound/subscriptions/#{subscription_id}", :basic_auth => @auth, - :body => build_query_string(options)) + :body => build_query_string(options), + :headers => SMSIFIED_HTTP_HEADERS + ) end ## # Updates an outbound subscription # @@ -140,9 +147,11 @@ # @example # subscriptions.update_outbound_subscription('tel:+14155551212', :notify_url => 'foobar') def update_outbound_subscription(sender_address, options) Response.new self.class.post("/smsmessaging/outbound/#{sender_address}/subscriptions", :basic_auth => @auth, - :body => build_query_string(options)) + :body => build_query_string(options), + :headers => SMSIFIED_HTTP_HEADERS + ) end end end \ No newline at end of file