lib/urbanairship.rb in urbanairship-2.2.4 vs lib/urbanairship.rb in urbanairship-2.3.0
- old
+ new
@@ -65,14 +65,10 @@
def tags
do_request(:get, "/api/tags/", :authenticate_with => :master_secret)
end
- def segments
- do_request(:get, "/api/segments", :authenticate_with => :master_secret)
- end
-
def add_tag(tag)
do_request(:put, "/api/tags/#{tag}", :authenticate_with => :master_secret, :content_type => 'text/plain')
end
def remove_tag(tag)
@@ -91,9 +87,29 @@
do_request(:delete, "/api/device_tokens/#{params[:device_token]}/tags/#{params[:tag]}", :authenticate_with => :master_secret)
end
def device_tokens_count
do_request(:get, "/api/device_tokens/count/", :authenticate_with => :master_secret)
+ end
+
+ def segments
+ do_request(:get, "/api/segments", :authenticate_with => :master_secret)
+ end
+
+ def create_segment(segment)
+ do_request(:post, "/api/segments", :body => segment.to_json, :authenticate_with => :master_secret)
+ end
+
+ def segment(id)
+ do_request(:get, "/api/segments/#{id}", :authenticate_with => :master_secret)
+ end
+
+ def update_segment(id, segment)
+ do_request(:put, "/api/segments/#{id}", :body => segment.to_json, :authenticate_with => :master_secret)
+ end
+
+ def delete_segment(id)
+ do_request(:delete, "/api/segments/#{id}", :authenticate_with => :master_secret)
end
private
def do_request(http_method, path, options = {})