Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
aklaiber committed Sep 3, 2014
1 parent 403d49f commit e67c75b
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit e67c75b

Please sign in to comment.