firebase-messaging 1.0.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2457b8486e444c5c4b9d50099924150dcad1e9a
4
- data.tar.gz: 96a73f5abb72f599609961b382b6ec59bd4a3c40
3
+ metadata.gz: 257e5061706ff8fdd922b375f24787518e2e0d6f
4
+ data.tar.gz: 23b391b788751df545aca8323a0457fbe6c419d0
5
5
  SHA512:
6
- metadata.gz: 90596c989cefb35c40b4813df2120c620280c6009a06282b1d976648cf7f693d2501f6966ea2634a8f5f342904b5eee4204bd5124e94ceea190e0034c09de05d
7
- data.tar.gz: 70fa965ce91e91ee5a870daed1834071b438f1eadfcb6b6895172cc3b10b2a920be92512fdb0e2dff8d1004fdf8025389f5e6bda806152dbeee0f72e66a181fa
6
+ metadata.gz: f211fb83264075296d926af383bd9562bc73886a34006d677932791d2443bcf0066b5f35ea6a8c33d8157d5dec8aaf859d0659ac349c82e05e9aa91e5aa4fc6e
7
+ data.tar.gz: 9b74d1daf009ba0c852923e3ba8bf96d5ff1a125534894ebd44ca7ac7fff0742a4bcae3385437f8883a82ce473f051ff8f016e74db5207a6c0ef93571c93fd4b
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.1
4
+ - 2.4.1
5
5
  before_install: gem install bundler -v 1.12.5
6
+ script: bundle exec rake spec
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Firebase::Messaging
2
+ Firebase Cloud Messaging HTTP protocol client for Ruby.
3
+ This is unofficial library.
2
4
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/firebase/messaging`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
5
 
7
6
  ## Installation
8
7
 
@@ -21,7 +20,9 @@ Or install it yourself as:
21
20
  $ gem install firebase-messaging
22
21
 
23
22
  ## Usage
23
+ ### Settings
24
24
  ```ruby
25
+ # your initializer
25
26
  Firebase::Messaging.configure do |config|
26
27
  config.server_key = '***SERVER KEY***'
27
28
  config.logger = Rails.logger
@@ -29,18 +30,25 @@ Firebase::Messaging.configure do |config|
29
30
  end
30
31
  ```
31
32
 
33
+ ### Send Notification
34
+ ```ruby
35
+ Firebase::Messaging::Client.new.send do |req|
36
+ req.body.notification = {title: "title", body: "body"}
37
+ req.body.data = {content: "abc"}
38
+ req.priority = :high # default: "high"
39
+ req.to = ['/topics/A', '/topics/B'] # or "/topics/A" or "fcm-token"
40
+ end
41
+ ```
42
+
32
43
  ## Development
33
44
 
34
45
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
46
 
36
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
-
38
47
  ## Contributing
39
48
 
40
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/firebase-messaging. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ntkm/firebase-messaging. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
41
50
 
42
51
 
43
52
  ## License
44
53
 
45
54
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
46
-
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = 'Firebase Messaging Client'
13
13
  spec.description = 'Remote Push Notification to iOS/Android via Firebase.'
14
- spec.homepage = 'https://github.com/ntkm'
14
+ spec.homepage = 'https://github.com/ntkm/firebase-messaging'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -43,8 +43,9 @@ module Firebase
43
43
  false
44
44
  end
45
45
 
46
- def bind(type, status: nil, body: nil, headers: nil)
47
- if json?(body)
46
+ def bind(type, status: nil, body: nil, headers: nil) # binding.pry
47
+ # TODO: use @parsed_body/success?, but here is class method scope...
48
+ if json?(body) && !JSON.parse(body, symbolize_names: true).blank? && JSON.parse(body, symbolize_names: true).class == Hash
48
49
  "Firebase::Messaging::Response::#{type.to_s.classify}".constantize.new(status: status, body: body, headers: headers)
49
50
  else
50
51
  Firebase::Messaging.logger.error("Unexpected response. status: #{status}, body: #{body}")
@@ -5,7 +5,7 @@ module Firebase
5
5
  class Response
6
6
  class DownStreamHttpMessage < Firebase::Messaging::Response
7
7
  def success?
8
- super && parsed_body[:success] > 0
8
+ super && !parsed_body.blank? && parsed_body[:success] > 0
9
9
  end
10
10
 
11
11
  def errors
@@ -1,5 +1,5 @@
1
1
  module Firebase
2
2
  module Messaging
3
- VERSION = '1.0.0'.freeze
3
+ VERSION = '1.0.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebase-messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ntkm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-12 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -187,7 +187,7 @@ files:
187
187
  - lib/instance_id/response/batch_operation.rb
188
188
  - lib/instance_id/response/delete.rb
189
189
  - lib/instance_id/response/get_info.rb
190
- homepage: https://github.com/ntkm
190
+ homepage: https://github.com/ntkm/firebase-messaging
191
191
  licenses:
192
192
  - MIT
193
193
  metadata: {}