Skip to content

Commit cfb5a23

Browse files
committed
Adds documentation in the README about how to provide FB credentials
1 parent 07941b3 commit cfb5a23

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,41 @@ For Android you will need a device running 2.3 (or newer) that also have the Goo
2222
A version of supported Ruby, currently:
2323
`ruby >= 2.4`
2424

25+
## Getting Started
26+
To use this gem, you need to instantiate a client with your firebase credentials:
27+
28+
```ruby
29+
fcm = FCM.new(
30+
API_TOKEN,
31+
GOOGLE_APPLICATION_CREDENTIALS_PATH,
32+
FIREBASE_PROJECT_ID
33+
)
34+
```
35+
36+
## About the `GOOGLE_APPLICATION_CREDENTIALS_PATH`
37+
The `GOOGLE_APPLICATION_CREDENTIALS_PATH` is meant to contain your firebase credentials.
38+
39+
The easiest way to provide them is to pass here an absolute path to a file with your credentials:
40+
41+
```ruby
42+
fcm = FCM.new(
43+
API_TOKEN,
44+
'/path/to/credentials.json',
45+
FIREBASE_PROJECT_ID
46+
)
47+
```
48+
49+
As per their secret nature, you might not want to have them in your repository. In that case, another supported solution is to pass a `StringIO` that contains your credentials:
50+
51+
```ruby
52+
fcm = FCM.new(
53+
API_TOKEN,
54+
StringIO.new(ENV.fetch('FIREBASE_CREDENTIALS')),
55+
FIREBASE_PROJECT_ID
56+
)
57+
58+
```
59+
2560
## Usage
2661

2762
## HTTP v1 API

0 commit comments

Comments
 (0)