www.fgks.org   »   [go: up one dir, main page]

Skip to content

Commit

Permalink
Fix "retrieve notification key" query
Browse files Browse the repository at this point in the history
Before, we were sending the wrong parameters to the "retrieve
notification key" endpoint. By submitting invalid arguments, we were
causing every request to fail. We fixed the query for the "retrieve
notification key" endpoint.
  • Loading branch information
purinkle committed Jul 7, 2020
1 parent fcf66dc commit b328a75
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
6 changes: 1 addition & 5 deletions lib/fcm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ def remove_registration_ids(key_name, project_id, notification_key, registration
alias remove remove_registration_ids

def recover_notification_key(key_name, project_id)
params = {
query: {
notification_key_name: key_name
}
}
params = {notification_key_name: key_name}

extra_headers = {
'project_id' => project_id
Expand Down
19 changes: 19 additions & 0 deletions spec/fcm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,25 @@
end # remove context
end

describe "#recover_notification_key" do
it "sends a 'retrieve notification key' request" do
uri = "#{FCM::GROUP_NOTIFICATION_BASE_URI}/gcm/notification"
endpoint = stub_request(:get, uri).with(
headers: {
'Content-Type' => 'application/json',
'Authorization' => "key=TEST_SERVER_KEY",
'project_id' => "TEST_PROJECT_ID"
},
query: {notification_key_name: "TEST_KEY_NAME"}
)
client = FCM.new("TEST_SERVER_KEY")

client.recover_notification_key("TEST_KEY_NAME", "TEST_PROJECT_ID")

expect(endpoint).to have_been_requested
end
end

describe 'subscribing to a topic' do
# TODO
end
Expand Down

0 comments on commit b328a75

Please sign in to comment.