Method: GCM::SuccessfulConnection#write

Defined in:
lib/mercurius/testing/gcm/successful_connection.rb

#write(json) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mercurius/testing/gcm/successful_connection.rb', line 5

def write(json)
  tokens = json[:registration_ids]

  json = {
    'multicast_id' => '123',
    'success' => tokens.size,
    'failure' => 0,
    'canonical_ids' => 0,
    'results' => tokens.map { |token| valid_token_json(token) }
  }.to_json

  Mercurius::FakeResponse.new body: json, status: 200
end