fcmpush 1.4.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5955f70af9ad3b06fbd33190d218cd115919476a8f3bd85b0f97d3d13ab94757
4
- data.tar.gz: 5f267e161537e51aaeb44428de5fe024556cf865b2fb3178a2b5286418250ef8
3
+ metadata.gz: a437176b9b06e22c8ccbfc7caed5603ff2fc331111c22dbfc585dceb782ab6f2
4
+ data.tar.gz: 250617403b4caa35cda5395fca5daef64649dd428e20c5f1e619561984bf8ef8
5
5
  SHA512:
6
- metadata.gz: 9577b9638e6d3968377e648fb407f7ec5624bf4446c6dc04b1831e4da9d82022d78c7e96fd8bd0729fdb955366fa53fbf88e641b11a2da4ac2f7931bad14d3d5
7
- data.tar.gz: b4a36fdfc16a8d9c85fc35373db504a1861c96b0f3cdbffd5feebcce7542d5d4bf969408f25854262317555e753ad2bedf0aa019012555364be6976869309b7f
6
+ metadata.gz: 5628699a3505d7dbc67c7b62fd90b15db6177f97dec2e1f979b4c6bb79b41496104af8325db819b3b83a354a3dec120d5e965b5eee7f5be5a945bba2da652923
7
+ data.tar.gz: 4cdbbde0ea2649e681756c9b66671cc60dfff34b062886dd22a01af8b39284a4ce202916f393aa3c92e64939f1302c31fd3ec002aa5c967fd7963e99b181f189
data/fcmpush.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.required_ruby_version = '>= 2.6', '< 3.4'
25
+ spec.required_ruby_version = '>= 2.6', '< 3.5'
26
26
 
27
27
  spec.add_dependency 'google-apis-identitytoolkit_v3'
28
28
  spec.add_dependency 'net-http-persistent', '~> 4.0.1'
@@ -26,6 +26,9 @@ module Fcmpush
26
26
  # @server_key = configuration.server_key
27
27
  @connection = Net::HTTP::Persistent.new
28
28
 
29
+ @connection.open_timeout = configuration.open_timeout if configuration.open_timeout
30
+ @connection.read_timeout = configuration.read_timeout if configuration.read_timeout
31
+
29
32
  if !configuration.proxy
30
33
  # do nothing
31
34
  elsif configuration.proxy == :ENV
@@ -84,12 +87,15 @@ module Fcmpush
84
87
  raise NetworkError, "A network error occurred: #{e.class} (#{e.message})"
85
88
  end
86
89
 
90
+ #-------------------------------------------------------------------------------
91
+ # BATCH REQUESTS DEPRECATED BY GOOGLE ON June 20,2023 AND SHUTDOWN ON June 21, 2024
92
+ # https://firebase.google.com/support/faq/#fcm-depr-features
93
+ #
94
+ # Until upgrading to use HTTP/2, warning and throwing error
95
+ #-------------------------------------------------------------------------------
87
96
  def batch_push(messages, query: {}, headers: {})
88
- uri, request = make_batch_request(messages, query, headers)
89
- response = exception_handler(connection.request(uri, request))
90
- BatchResponse.new(response)
91
- rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
92
- raise NetworkError, "A network error occurred: #{e.class} (#{e.message})"
97
+ warn '[DEPRECATION] `batch_push` is deprecated. Please use `push` for each message instead.'
98
+ raise DeprecatedApiError, 'BATCH REQUESTS DEPRECATED BY GOOGLE ON June 20,2023 AND SHUTDOWN ON June 21, 2024 (https://firebase.google.com/support/faq/#fcm-depr-features)'
93
99
  end
94
100
 
95
101
  private
@@ -1,6 +1,6 @@
1
1
  module Fcmpush
2
2
  class Configuration
3
- attr_accessor :scope, :json_key_io, :server_key, :proxy
3
+ attr_accessor :scope, :json_key_io, :server_key, :proxy, :open_timeout, :read_timeout
4
4
 
5
5
  def initialize
6
6
  @scope = ['https://www.googleapis.com/auth/firebase.messaging']
@@ -26,6 +26,10 @@ module Fcmpush
26
26
  # cf. https://github.com/miyataka/fcmpush/pull/39#issuecomment-1722533622
27
27
  # proxy
28
28
  @proxy = :ENV
29
+
30
+ # connection timeouts
31
+ @open_timeout = nil
32
+ @read_timeout = nil
29
33
  end
30
34
  end
31
35
  end
@@ -1,5 +1,6 @@
1
1
  module Fcmpush
2
2
  class APIError < StandardError; end
3
+ class DeprecatedApiError < StandardError; end
3
4
  class NetworkError < APIError; end
4
5
 
5
6
  class HttpError < APIError
@@ -1,3 +1,3 @@
1
1
  module Fcmpush
2
- VERSION = '1.4.3'.freeze
2
+ VERSION = '1.5.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcmpush
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - miyataka
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-01-15 00:00:00.000000000 Z
10
+ date: 2025-01-05 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: google-apis-identitytoolkit_v3
@@ -80,7 +79,6 @@ dependencies:
80
79
  - - "~>"
81
80
  - !ruby/object:Gem::Version
82
81
  version: '3.0'
83
- description:
84
82
  email:
85
83
  - voyager.3taka28@gmail.com
86
84
  executables: []
@@ -102,7 +100,6 @@ licenses:
102
100
  metadata:
103
101
  homepage_uri: https://github.com/miyataka/fcmpush
104
102
  source_code_uri: https://github.com/miyataka/fcmpush
105
- post_install_message:
106
103
  rdoc_options: []
107
104
  require_paths:
108
105
  - lib
@@ -113,15 +110,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
110
  version: '2.6'
114
111
  - - "<"
115
112
  - !ruby/object:Gem::Version
116
- version: '3.4'
113
+ version: '3.5'
117
114
  required_rubygems_version: !ruby/object:Gem::Requirement
118
115
  requirements:
119
116
  - - ">="
120
117
  - !ruby/object:Gem::Version
121
118
  version: '0'
122
119
  requirements: []
123
- rubygems_version: 3.4.1
124
- signing_key:
120
+ rubygems_version: 3.6.2
125
121
  specification_version: 4
126
122
  summary: Firebase Cloud Messaging API wrapper for ruby, supports HTTP v1. And including
127
123
  access_token Auto Refresh feature!