fcmpush 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +72 -0
- data/LICENSE.txt +21 -0
- data/README.md +76 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fcmpush.gemspec +31 -0
- data/lib/fcmpush.rb +206 -0
- data/lib/fcmpush/configuration.rb +18 -0
- data/lib/fcmpush/version.rb +3 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a1d606a6d62730fa14527ad867232572409cc0ab91588afef463bde484d3cc67
|
4
|
+
data.tar.gz: a8e8ff06445e412e845be30f39e5cd041f01b1140feb4b6d34c858ff541066c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c164d0dd6c2f2500568cb25947a37bae806792ce49f18d9c7c861fbffe1047cd5210b3fef39cb371d8fcf46813fcdbf66dfd5a16e57aadf77e508cd23f424e24
|
7
|
+
data.tar.gz: 7541a889589bab2b5dba22acf7e29c4dcdac4b761846a5aa8a693278cce1ab16ab924ec9c6a90aaa2088827fc308a4b5703d8b2bb2461333d3bfd9260f6ad666
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fcmpush (0.1.1)
|
5
|
+
googleauth (>= 0.10.0)
|
6
|
+
net-http-persistent (>= 3.1.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.7.0)
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
13
|
+
byebug (11.0.1)
|
14
|
+
coderay (1.1.2)
|
15
|
+
connection_pool (2.2.2)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
faraday (0.17.0)
|
18
|
+
multipart-post (>= 1.2, < 3)
|
19
|
+
googleauth (0.10.0)
|
20
|
+
faraday (~> 0.12)
|
21
|
+
jwt (>= 1.4, < 3.0)
|
22
|
+
memoist (~> 0.16)
|
23
|
+
multi_json (~> 1.11)
|
24
|
+
os (>= 0.9, < 2.0)
|
25
|
+
signet (~> 0.12)
|
26
|
+
jwt (2.2.1)
|
27
|
+
memoist (0.16.0)
|
28
|
+
method_source (0.9.2)
|
29
|
+
multi_json (1.13.1)
|
30
|
+
multipart-post (2.1.1)
|
31
|
+
net-http-persistent (3.1.0)
|
32
|
+
connection_pool (~> 2.2)
|
33
|
+
os (1.0.1)
|
34
|
+
pry (0.12.2)
|
35
|
+
coderay (~> 1.1.0)
|
36
|
+
method_source (~> 0.9.0)
|
37
|
+
pry-byebug (3.7.0)
|
38
|
+
byebug (~> 11.0)
|
39
|
+
pry (~> 0.10)
|
40
|
+
public_suffix (4.0.1)
|
41
|
+
rake (10.5.0)
|
42
|
+
rspec (3.9.0)
|
43
|
+
rspec-core (~> 3.9.0)
|
44
|
+
rspec-expectations (~> 3.9.0)
|
45
|
+
rspec-mocks (~> 3.9.0)
|
46
|
+
rspec-core (3.9.0)
|
47
|
+
rspec-support (~> 3.9.0)
|
48
|
+
rspec-expectations (3.9.0)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.9.0)
|
51
|
+
rspec-mocks (3.9.0)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.9.0)
|
54
|
+
rspec-support (3.9.0)
|
55
|
+
signet (0.12.0)
|
56
|
+
addressable (~> 2.3)
|
57
|
+
faraday (~> 0.9)
|
58
|
+
jwt (>= 1.5, < 3.0)
|
59
|
+
multi_json (~> 1.10)
|
60
|
+
|
61
|
+
PLATFORMS
|
62
|
+
ruby
|
63
|
+
|
64
|
+
DEPENDENCIES
|
65
|
+
bundler (~> 2.0)
|
66
|
+
fcmpush!
|
67
|
+
pry-byebug
|
68
|
+
rake (~> 10.0)
|
69
|
+
rspec (~> 3.0)
|
70
|
+
|
71
|
+
BUNDLED WITH
|
72
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Takayuki Miyahara
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Fcmpush
|
2
|
+
|
3
|
+
Fcmpush is an Firebase Cloud Messaging(FCM) Client. It implements [FCM HTTP v1 API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages).
|
4
|
+
This gem supports HTTP v1 API only, **NOT supported [legacy HTTP protocol](https://firebase.google.com/docs/cloud-messaging/http-server-ref)**, because both authentication method is different.
|
5
|
+
|
6
|
+
fcmpush is highly inspired by [andpush gem](https://github.com/yuki24/andpush).
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'fcmpush'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install fcmpush
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
on Rails, config/initializers/fcmpush.rb
|
27
|
+
```ruby
|
28
|
+
Fcmpush.configure do |config|
|
29
|
+
# firebase web console => project settings => service account => firebase admin sdk => generate new private key
|
30
|
+
config.json_key_io = "#{Rails.root}/path/to/service_account_credentials.json"
|
31
|
+
|
32
|
+
# Or set environment variables
|
33
|
+
# ENV['GOOGLE_ACCOUNT_TYPE'] = 'service_account'
|
34
|
+
# ENV['GOOGLE_CLIENT_ID'] = '000000000000000000000'
|
35
|
+
# ENV['GOOGLE_CLIENT_EMAIL'] = 'xxxx@xxxx.iam.gserviceaccount.com'
|
36
|
+
# ENV['GOOGLE_PRIVATE_KEY'] = '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n\
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
for more detail. see [here](https://github.com/googleapis/google-auth-library-ruby#example-service-account).
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
require 'fcmpush'
|
44
|
+
|
45
|
+
project_id = "..." # Your project_id
|
46
|
+
device_token = "..." # The device token of the device you'd like to push a message to
|
47
|
+
|
48
|
+
client = Fcmpush.new(project_id)
|
49
|
+
payload = { # ref. https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
|
50
|
+
message: {
|
51
|
+
token: device_token,
|
52
|
+
notification: {
|
53
|
+
title: "this is title",
|
54
|
+
body: "this is message body"
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
response = client.push(payload)
|
60
|
+
|
61
|
+
json = response.json
|
62
|
+
json[:name] # => "projects/[your_project_id]/messages/0:1571037134532751%31bd1c9631bd1c96"
|
63
|
+
```
|
64
|
+
|
65
|
+
## Future Work
|
66
|
+
- topic subscribe/unsubscribe
|
67
|
+
- auto refresh access_token before expiry
|
68
|
+
- [DEV] compare other gems
|
69
|
+
|
70
|
+
## Contributing
|
71
|
+
|
72
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/miyataka/fcmpush.
|
73
|
+
|
74
|
+
## License
|
75
|
+
|
76
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fcmpush"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/fcmpush.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'fcmpush/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'fcmpush'
|
7
|
+
spec.version = Fcmpush::VERSION
|
8
|
+
spec.authors = ['Takayuki Miyahara']
|
9
|
+
spec.email = ['voyager.3taka28@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Firebase Cloud Messaging API wrapper for ruby, supports HTTP v1 only.'
|
12
|
+
spec.homepage = 'https://github.com/miyataka/fcmpush'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
16
|
+
spec.metadata['source_code_uri'] = 'https://github.com/miyataka/fcmpush'
|
17
|
+
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_dependency 'googleauth', '>= 0.10.0'
|
26
|
+
spec.add_dependency 'net-http-persistent', '>= 3.1.0'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
|
+
end
|
data/lib/fcmpush.rb
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
require 'fcmpush/configuration'
|
2
|
+
require 'fcmpush/version'
|
3
|
+
|
4
|
+
require 'net/http/persistent'
|
5
|
+
require 'json'
|
6
|
+
require 'googleauth'
|
7
|
+
|
8
|
+
module Fcmpush
|
9
|
+
class Error < StandardError; end
|
10
|
+
DOMAIN = 'https://fcm.googleapis.com'.freeze
|
11
|
+
V1_ENDPOINT_PREFIX = '/v1/projects/'.freeze
|
12
|
+
V1_ENDPOINT_SUFFIX = '/messages:send'.freeze
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def build(project_id, domain: nil)
|
16
|
+
::Fcmpush::Client.new(domain || DOMAIN, project_id, configuration)
|
17
|
+
end
|
18
|
+
alias new build
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.configuration
|
22
|
+
@configuration ||= Configuration.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.reset
|
26
|
+
@configuration = Configuration.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.configure(&block)
|
30
|
+
yield(configuration(&block))
|
31
|
+
end
|
32
|
+
|
33
|
+
class Client
|
34
|
+
attr_reader :domain, :path, :connection, :access_token, :configuration
|
35
|
+
|
36
|
+
def initialize(domain, project_id, configuration, **options)
|
37
|
+
@domain = domain
|
38
|
+
@project_id = project_id
|
39
|
+
@path = V1_ENDPOINT_PREFIX + project_id.to_s + V1_ENDPOINT_SUFFIX
|
40
|
+
@options = {}.merge(options)
|
41
|
+
@configuration = configuration
|
42
|
+
@access_token = authorize
|
43
|
+
@connection = Net::HTTP::Persistent.new
|
44
|
+
end
|
45
|
+
|
46
|
+
def authorize
|
47
|
+
@auth ||= if configuration.json_key_io
|
48
|
+
Google::Auth::ServiceAccountCredentials.make_creds(
|
49
|
+
json_key_io: File.open(configuration.json_key_io),
|
50
|
+
scope: configuration.scope
|
51
|
+
)
|
52
|
+
else
|
53
|
+
# from ENV
|
54
|
+
Google::Auth::ServiceAccountCredentials.make_creds(
|
55
|
+
scope: configuration.scope
|
56
|
+
)
|
57
|
+
end
|
58
|
+
@auth.fetch_access_token!['access_token']
|
59
|
+
end
|
60
|
+
|
61
|
+
def push(body, query: {}, headers: {})
|
62
|
+
uri = URI.join(domain, path)
|
63
|
+
uri.query = URI.encode_www_form(query) unless query.empty?
|
64
|
+
|
65
|
+
headers = authorized_header(headers)
|
66
|
+
post = Net::HTTP::Post.new(uri, headers)
|
67
|
+
post.body = body.is_a?(String) ? body : body.to_json
|
68
|
+
|
69
|
+
response = exception_handler(connection.request(uri, post))
|
70
|
+
JsonResponse.new(response)
|
71
|
+
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
72
|
+
raise NetworkError, "A network error occurred: #{e.class} (#{e.message})"
|
73
|
+
end
|
74
|
+
|
75
|
+
def authorized_header(headers)
|
76
|
+
headers.merge('Content-Type' => 'application/json',
|
77
|
+
'Accept' => 'application/json',
|
78
|
+
'Authorization' => "Bearer #{access_token}")
|
79
|
+
end
|
80
|
+
|
81
|
+
def exception_handler(response)
|
82
|
+
error = STATUS_TO_EXCEPTION_MAPPING[response.code]
|
83
|
+
raise error.new("Receieved an error response #{response.code} #{error.to_s.split('::').last}: #{response.body}", response) if error
|
84
|
+
|
85
|
+
response
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
class JsonResponse < DelegateClass(Net::HTTPResponse)
|
90
|
+
alias response __getobj__
|
91
|
+
alias headers to_hash
|
92
|
+
HAS_SYMBOL_GC = RUBY_VERSION > '2.2.0'
|
93
|
+
|
94
|
+
def json
|
95
|
+
parsable? ? JSON.parse(body, symbolize_names: HAS_SYMBOL_GC) : nil
|
96
|
+
end
|
97
|
+
|
98
|
+
def inspect
|
99
|
+
"#<JsonResponse response: #{response.inspect}, json: #{json}>"
|
100
|
+
end
|
101
|
+
alias to_s inspect
|
102
|
+
|
103
|
+
def parsable?
|
104
|
+
!body.nil? && !body.empty?
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class APIError < StandardError; end
|
109
|
+
class NetworkError < APIError; end
|
110
|
+
|
111
|
+
class HttpError < APIError
|
112
|
+
attr_reader :response
|
113
|
+
|
114
|
+
def initialize(message, response)
|
115
|
+
super(message)
|
116
|
+
@response = response
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class ClientError < HttpError; end
|
121
|
+
|
122
|
+
class BadRequest < ClientError; end # status: 400
|
123
|
+
class Unauthorized < ClientError; end # status: 401
|
124
|
+
class PaymentRequired < ClientError; end # status: 402
|
125
|
+
class Forbidden < ClientError; end # status: 403
|
126
|
+
class NotFound < ClientError; end # status: 404
|
127
|
+
class MethodNotAllowed < ClientError; end # status: 405
|
128
|
+
class NotAcceptable < ClientError; end # status: 406
|
129
|
+
class ProxyAuthenticationRequired < ClientError; end # status: 407
|
130
|
+
class RequestTimeout < ClientError; end # status: 408
|
131
|
+
class Conflict < ClientError; end # status: 409
|
132
|
+
class Gone < ClientError; end # status: 410
|
133
|
+
class LengthRequired < ClientError; end # status: 411
|
134
|
+
class PreconditionFailed < ClientError; end # status: 412
|
135
|
+
class PayloadTooLarge < ClientError; end # status: 413
|
136
|
+
class URITooLong < ClientError; end # status: 414
|
137
|
+
class UnsupportedMediaType < ClientError; end # status: 415
|
138
|
+
class RangeNotSatisfiable < ClientError; end # status: 416
|
139
|
+
class ExpectationFailed < ClientError; end # status: 417
|
140
|
+
class ImaTeapot < ClientError; end # status: 418
|
141
|
+
class MisdirectedRequest < ClientError; end # status: 421
|
142
|
+
class UnprocessableEntity < ClientError; end # status: 422
|
143
|
+
class Locked < ClientError; end # status: 423
|
144
|
+
class FailedDependency < ClientError; end # status: 424
|
145
|
+
class UpgradeRequired < ClientError; end # status: 426
|
146
|
+
class PreconditionRequired < ClientError; end # status: 428
|
147
|
+
class TooManyRequests < ClientError; end # status: 429
|
148
|
+
class RequestHeaderFieldsTooLarge < ClientError; end # status: 431
|
149
|
+
class UnavailableForLegalReasons < ClientError; end # status: 451
|
150
|
+
|
151
|
+
class ServerError < HttpError; end
|
152
|
+
|
153
|
+
class InternalServerError < ServerError; end # status: 500
|
154
|
+
class NotImplemented < ServerError; end # status: 501
|
155
|
+
class BadGateway < ServerError; end # status: 502
|
156
|
+
class ServiceUnavailable < ServerError; end # status: 503
|
157
|
+
class GatewayTimeout < ServerError; end # status: 504
|
158
|
+
class HTTPVersionNotSupported < ServerError; end # status: 505
|
159
|
+
class VariantAlsoNegotiates < ServerError; end # status: 506
|
160
|
+
class InsufficientStorage < ServerError; end # status: 507
|
161
|
+
class LoopDetected < ServerError; end # status: 508
|
162
|
+
class NotExtended < ServerError; end # status: 510
|
163
|
+
class NetworkAuthenticationRequired < ServerError; end # status: 511
|
164
|
+
|
165
|
+
STATUS_TO_EXCEPTION_MAPPING = {
|
166
|
+
'400' => BadRequest,
|
167
|
+
'401' => Unauthorized,
|
168
|
+
'402' => PaymentRequired,
|
169
|
+
'403' => Forbidden,
|
170
|
+
'404' => NotFound,
|
171
|
+
'405' => MethodNotAllowed,
|
172
|
+
'406' => NotAcceptable,
|
173
|
+
'407' => ProxyAuthenticationRequired,
|
174
|
+
'408' => RequestTimeout,
|
175
|
+
'409' => Conflict,
|
176
|
+
'410' => Gone,
|
177
|
+
'411' => LengthRequired,
|
178
|
+
'412' => PreconditionFailed,
|
179
|
+
'413' => PayloadTooLarge,
|
180
|
+
'414' => URITooLong,
|
181
|
+
'415' => UnsupportedMediaType,
|
182
|
+
'416' => RangeNotSatisfiable,
|
183
|
+
'417' => ExpectationFailed,
|
184
|
+
'418' => ImaTeapot,
|
185
|
+
'421' => MisdirectedRequest,
|
186
|
+
'422' => UnprocessableEntity,
|
187
|
+
'423' => Locked,
|
188
|
+
'424' => FailedDependency,
|
189
|
+
'426' => UpgradeRequired,
|
190
|
+
'428' => PreconditionRequired,
|
191
|
+
'429' => TooManyRequests,
|
192
|
+
'431' => RequestHeaderFieldsTooLarge,
|
193
|
+
'451' => UnavailableForLegalReasons,
|
194
|
+
'500' => InternalServerError,
|
195
|
+
'501' => NotImplemented,
|
196
|
+
'502' => BadGateway,
|
197
|
+
'503' => ServiceUnavailable,
|
198
|
+
'504' => GatewayTimeout,
|
199
|
+
'505' => HTTPVersionNotSupported,
|
200
|
+
'506' => VariantAlsoNegotiates,
|
201
|
+
'507' => InsufficientStorage,
|
202
|
+
'508' => LoopDetected,
|
203
|
+
'510' => NotExtended,
|
204
|
+
'511' => NetworkAuthenticationRequired
|
205
|
+
}.freeze
|
206
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Fcmpush
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :scope, :json_key_io
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@scope = ['https://www.googleapis.com/auth/firebase.messaging']
|
7
|
+
|
8
|
+
# set file path
|
9
|
+
@json_key_io = nil
|
10
|
+
|
11
|
+
# Or Environment Variable
|
12
|
+
# ENV['GOOGLE_ACCOUNT_TYPE'] = 'service_account'
|
13
|
+
# ENV['GOOGLE_CLIENT_ID'] = '000000000000000000000'
|
14
|
+
# ENV['GOOGLE_CLIENT_EMAIL'] = 'xxxx@xxxx.iam.gserviceaccount.com'
|
15
|
+
# ENV['GOOGLE_PRIVATE_KEY'] = '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fcmpush
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takayuki Miyahara
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: googleauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.10.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.10.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-http-persistent
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- voyager.3taka28@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- ".travis.yml"
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- fcmpush.gemspec
|
102
|
+
- lib/fcmpush.rb
|
103
|
+
- lib/fcmpush/configuration.rb
|
104
|
+
- lib/fcmpush/version.rb
|
105
|
+
homepage: https://github.com/miyataka/fcmpush
|
106
|
+
licenses:
|
107
|
+
- MIT
|
108
|
+
metadata:
|
109
|
+
homepage_uri: https://github.com/miyataka/fcmpush
|
110
|
+
source_code_uri: https://github.com/miyataka/fcmpush
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubygems_version: 3.0.3
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Firebase Cloud Messaging API wrapper for ruby, supports HTTP v1 only.
|
130
|
+
test_files: []
|