Created
April 28, 2020 07:00
-
-
Save kouheiszk/715e6bf3cee13e6aa613b0fff587bcc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "fcm" | |
require "pry" | |
server_key = ENV.fetch("FCM_SERVER_KEY") | |
fmc_token = ENV.fetch("FCM_TOKEN") | |
client = FCM.new(server_key) | |
result = client.send_with_notification_key( | |
fmc_token, | |
data: {}, | |
notification: { | |
title: "今日の天気予報", | |
body: "今日は地域によっては夕方から雨になるそうです。", | |
sound: :default, | |
}, | |
content_available: true, | |
mutable_content: true, | |
priority: :high, | |
) | |
puts result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
source "https://rubygems.org" | |
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | |
gem "fcm" | |
gem "pry" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment