firefighter 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.irbrc +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +52 -4
- data/lib/firefighter/realtime_database.rb +5 -0
- data/lib/firefighter/version.rb +1 -1
- data/lib/firefighter/web.rb +5 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a61aa83a2c470f2eda4d65b090c4c2e9b3135e47fa9e7fb8c7cc6634687493f4
|
4
|
+
data.tar.gz: afcc14b8df36736a6827f3b83196181f428e5526a1eaee48eea44ad0a27bd769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaec303e311e8a70f25873345c9e43ad4eac2be9253e88745b2e66c0a9e4177b0185c6b027b94a1f7a560b8d66b648cd18d3960939a283b3171f50e08e9decad
|
7
|
+
data.tar.gz: 1c99438eb83576cd16ae696bd018df8505587038300d797d5c238be66a4a30488437cf74151d632483626e15c929716d0b167198de1b99f3f557cf34a81d889e
|
data/.irbrc
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Talk to Firebase API from Ruby:
|
4
4
|
|
5
|
-
- signup
|
6
|
-
- read, write, add data
|
7
|
-
- generate JWT tokens for token-auth
|
5
|
+
- identity: signup, account_info, accounts_download
|
6
|
+
- realtime: read, write, add, delete data
|
7
|
+
- tokens: generate JWT tokens for token-auth
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -24,7 +24,49 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
|
27
|
+
```ruby
|
28
|
+
# Firefighter::Identitytoolkit
|
29
|
+
# from_env uses environment variables:
|
30
|
+
# - FIREBASE_WEB_API_KEY
|
31
|
+
# - FIREBASE_SERVICE_ACCOUNT_EMAIL
|
32
|
+
identitytoolkit = Firefighter::Identitytoolkit.from_env
|
33
|
+
|
34
|
+
account = identitytoolkit.signup('test@test.de', 'totalgeheimespasswort')
|
35
|
+
|
36
|
+
account = identitytoolkit.account_info(account['idToken'])
|
37
|
+
|
38
|
+
accounts = identitytoolkit.download_accounts
|
39
|
+
|
40
|
+
token = identitytoolkit.fetch_access_token
|
41
|
+
|
42
|
+
# Firefighter::RealtimeDatabase
|
43
|
+
# from_env uses environment variables:
|
44
|
+
# - FIREBASE_WEB_DB_NAME
|
45
|
+
# - FIREBASE_WEB_DB_SECRET
|
46
|
+
realtime_database = Firefighter::RealtimeDatabase.from_env
|
47
|
+
|
48
|
+
realtime_database.write("some-path/key", {some: 'data'})
|
49
|
+
|
50
|
+
hash = realtime_database.read("some-path/key")
|
51
|
+
|
52
|
+
realtime_database.add("some-path/list", {some: 'data'})
|
53
|
+
|
54
|
+
list = realtime_database.read("some-path/list")
|
55
|
+
|
56
|
+
realtime_database.delete("some-path/list")
|
57
|
+
|
58
|
+
# Firefighter::TokenGenerator
|
59
|
+
# from_env uses environment variables:
|
60
|
+
# - FIREBASE_SERVICE_ACCOUNT_EMAIL
|
61
|
+
# - FIREBASE_SERVICE_ACCOUNT_PRIVATE_KEY
|
62
|
+
token_generator = Firefighter::TokenGenerator.from_env
|
63
|
+
|
64
|
+
access_token = token_generator.create_access_token
|
65
|
+
|
66
|
+
custom_token = token_generator.create_custom_token('someUid', data: {some: 'payload'})
|
67
|
+
|
68
|
+
payload = token_generator.read_token(custom_token)
|
69
|
+
```
|
28
70
|
|
29
71
|
## Development
|
30
72
|
|
@@ -39,3 +81,9 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/phoet/
|
|
39
81
|
## Code of Conduct
|
40
82
|
|
41
83
|
Everyone interacting in the Firefighter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/phoet/firefighter/blob/master/CODE_OF_CONDUCT.md).
|
84
|
+
|
85
|
+
## Changelog
|
86
|
+
|
87
|
+
### 0.3.0
|
88
|
+
|
89
|
+
- adds `Firefighter::RealtimeDatabase#delete`
|
data/lib/firefighter/version.rb
CHANGED
data/lib/firefighter/web.rb
CHANGED
@@ -9,9 +9,12 @@ module Firefighter
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(method, url, data = {}, headers = {})
|
12
|
-
|
12
|
+
case method
|
13
|
+
when :get
|
13
14
|
response = HTTP.get(url, headers: headers)
|
14
|
-
|
15
|
+
when :delete
|
16
|
+
response = HTTP.delete(url, headers: headers)
|
17
|
+
when :form
|
15
18
|
response = HTTP.send(:post, url, form: data, headers: headers)
|
16
19
|
else
|
17
20
|
response = HTTP.send(method, url, json: data, headers: headers)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firefighter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- phoet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".circleci/config.yml"
|
133
133
|
- ".gitignore"
|
134
|
+
- ".irbrc"
|
134
135
|
- ".rspec"
|
135
136
|
- CODE_OF_CONDUCT.md
|
136
137
|
- Gemfile
|
@@ -166,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
167
|
version: '0'
|
167
168
|
requirements: []
|
168
169
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.6
|
170
|
+
rubygems_version: 2.7.6
|
170
171
|
signing_key:
|
171
172
|
specification_version: 4
|
172
173
|
summary: Firebase API Wrapper
|