From e67c75b45a7e389f6343039ff32b2a80d2717937 Mon Sep 17 00:00:00 2001 From: Alexander Klaiber Date: Wed, 3 Sep 2014 11:41:50 +0200 Subject: [PATCH] Update README.md --- README.md | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f9f1fc5..b845418 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,24 @@ Or install it yourself as: ## Usage ``` ruby -collapse_key = '_GCM_COLLAPS_KEY_' -data = { foo: 'bar' } +Rgcm::Message.new('_API_KEY_').post('_GCM_REGESTRATION_ID_', { foo: 'bar' }) # => Rgcm::Response -Rgcm::Message.new('_API_KEY_').post('_GCM_REGESTRATION_ID_', collapse_key, data) # => Rgcm::Response +Rgcm::Message.new('_API_KEY_').post(['_GCM_REGESTRATION_ID_1_', '_GCM_REGESTRATION_ID_2_'], { foo: 'bar' }) # => Rgcm::Response +``` + +With collapse_key: -Rgcm::Message.new('_API_KEY_').post(['_GCM_REGESTRATION_ID_1_', '_GCM_REGESTRATION_ID_2_'], collapse_key, data) # => Rgcm::Response +``` ruby +Rgcm::Message.new('_API_KEY_').post('_GCM_REGESTRATION_ID_', { foo: 'bar' }, {collapse_key: 'collapse_key'}) # => Rgcm::Response ``` +With time_to_live: + +``` ruby +Rgcm::Message.new('_API_KEY_').post('_GCM_REGESTRATION_ID_', { foo: 'bar' }, {time_to_live: 3}) # => Rgcm::Response +``` + + With rails YML config file: ``` yml @@ -52,12 +62,9 @@ production: ``` ``` ruby -collapse_key = '_GCM_COLLAPS_KEY_' -data = { foo: 'bar' } - -Rgcm::Message.new.post('_GCM_REGESTRATION_ID_', collapse_key, data) # => Rgcm::Response +Rgcm::Message.new.post('_GCM_REGESTRATION_ID_', data) # => Rgcm::Response -Rgcm::Message.new.post(['_GCM_REGESTRATION_ID_1_', '_GCM_REGESTRATION_ID_2_'], collapse_key, data) # => Rgcm::Response +Rgcm::Message.new.post(['_GCM_REGESTRATION_ID_1_', '_GCM_REGESTRATION_ID_2_'], data) # => Rgcm::Response ``` Rgcm::Response methods: @@ -75,7 +82,7 @@ Rgcm::Response methods: ``` ``` ruby -response = Rgcm::Message.new('_API_KEY_').post('_GCM_REGESTRATION_ID_', collapse_key, data) +response = Rgcm::Message.new('_API_KEY_').post('_GCM_REGESTRATION_ID_', data) response.count_successes # => 1 response.count_failures # => 0