Skip to content

Commit

Permalink
Update to FCM URLs for device groups features
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-M-Thomaz committed Mar 28, 2019
1 parent 9fdc66a commit ad2e977
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/fcm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class FCM
FORMAT = :json

# constants
GROUP_NOTIFICATION_BASE_URI = 'https://android.googleapis.com'
INSTANCE_ID_API = 'https://iid.googleapis.com'
TOPIC_REGEX = /[a-zA-Z0-9\-_.~%]+/

Expand Down Expand Up @@ -49,8 +48,8 @@ def create_notification_key(key_name, project_id, registration_ids = [])
'project_id' => project_id
}

for_uri(GROUP_NOTIFICATION_BASE_URI, extra_headers) do |connection|
response = connection.post('/gcm/notification', post_body.to_json)
for_uri(BASE_URI, extra_headers) do |connection|
response = connection.post('/fcm/notification', post_body.to_json)
build_response(response)
end
end
Expand All @@ -65,8 +64,8 @@ def add_registration_ids(key_name, project_id, notification_key, registration_id
'project_id' => project_id
}

for_uri(GROUP_NOTIFICATION_BASE_URI, extra_headers) do |connection|
response = connection.post('/gcm/notification', post_body.to_json)
for_uri(BASE_URI, extra_headers) do |connection|
response = connection.post('/fcm/notification', post_body.to_json)
build_response(response)
end
end
Expand All @@ -81,8 +80,8 @@ def remove_registration_ids(key_name, project_id, notification_key, registration
'project_id' => project_id
}

for_uri(GROUP_NOTIFICATION_BASE_URI, extra_headers) do |connection|
response = connection.post('/gcm/notification', post_body.to_json)
for_uri(BASE_URI, extra_headers) do |connection|
response = connection.post('/fcm/notification', post_body.to_json)
build_response(response)
end
end
Expand All @@ -99,8 +98,8 @@ def recover_notification_key(key_name, project_id)
'project_id' => project_id
}

for_uri(GROUP_NOTIFICATION_BASE_URI, extra_headers) do |connection|
response = connection.get('/gcm/notification', params)
for_uri(BASE_URI, extra_headers) do |connection|
response = connection.get('/fcm/notification', params)
build_response(response)
end
end
Expand Down

1 comment on commit ad2e977

@Alan-M-Thomaz
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to new URL.
#56

Please sign in to comment.