Skip to content

Commit 95dca01

Browse files
committed
create fcm legacy http protocol client
1 parent 708d500 commit 95dca01

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

lib/fcm/client.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
3+
require 'fcm/connection'
4+
require 'fcm/response'
5+
require 'fcm/client/notification_delivery'
6+
require 'fcm/client/notification_setting'
7+
require 'fcm/client/instance_topic_management'
8+
9+
module Fcm
10+
# Fcm Client class for legacy http protocol API connections
11+
#
12+
# @see https://firebase.google.com/docs/cloud-messaging/http-server-ref
13+
class Client
14+
include Fcm::Connection
15+
include Fcm::Response
16+
include Fcm::Client::NotificationDilivery
17+
include Fcm::Client::NotificationSetting
18+
include Fcm::Client::InstanceTopicManagement
19+
20+
# @see https://firebase.google.com/docs/projects/api-keys
21+
# @param api_key [String] Firebase API key
22+
# @return [Client] client instance
23+
def initialize(api_key)
24+
@api_key = api_key
25+
end
26+
27+
private
28+
29+
def authorization_headers
30+
{
31+
'Content-Type' => 'application/json',
32+
'Authorization' => "key=#{@api_key}"
33+
}
34+
end
35+
end
36+
end

0 commit comments

Comments
 (0)