Module: GCM::TokenSerializer
- Defined in:
- lib/mercurius/testing/gcm/token_serializer.rb
Instance Method Summary collapse
- #canonical_token_json(tokens, canonical_ids_map) ⇒ Object
- #invalid_token_json(token, error) ⇒ Object
- #valid_token_json(token) ⇒ Object
Instance Method Details
#canonical_token_json(tokens, canonical_ids_map) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/mercurius/testing/gcm/token_serializer.rb', line 11 def canonical_token_json(tokens, canonical_ids_map) tokens.map do |token| hash = { 'message_id' => SecureRandom.hex } if canonical_id = canonical_ids_map[token] hash['registration_id'] = canonical_id end hash end end |
#invalid_token_json(token, error) ⇒ Object
7 8 9 |
# File 'lib/mercurius/testing/gcm/token_serializer.rb', line 7 def invalid_token_json(token, error) { 'error' => error } end |
#valid_token_json(token) ⇒ Object
3 4 5 |
# File 'lib/mercurius/testing/gcm/token_serializer.rb', line 3 def valid_token_json(token) { 'message_id' => SecureRandom.hex } end |