Skip to content

Commit

Permalink
feat: add deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
miyataka committed Jan 15, 2024
1 parent cec9c8d commit 6270b64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/fcmpush/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize(domain, project_id, configuration, **options)
access_token_response = v1_authorize
@access_token = access_token_response['access_token']
@access_token_expiry = Time.now.utc + access_token_response['expires_in']
@server_key = configuration.server_key
# @server_key = configuration.server_key
@connection = Net::HTTP::Persistent.new

if !configuration.proxy
Expand Down Expand Up @@ -136,7 +136,9 @@ def v1_authorized_header(headers)
'Authorization' => "Bearer #{access_token}")
end

# @deprecated TODO: remove this method next version
def legacy_authorized_header(headers)
warn "[DEPRECATION] `legacy_authorized_header` is deprecated. Please use `v1_authorized_header` instead."
headers.merge('Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => "Bearer #{server_key}")
Expand Down
4 changes: 4 additions & 0 deletions lib/fcmpush/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def initialize
# ENV['GOOGLE_PRIVATE_KEY'] = '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n'

# regacy auth
# @deprecated TODO: remove this next version
@server_key = ENV['FCM_SERVER_KEY']
if @server_key
warn '[DEPRECATION] `FCM_SERVER_KEY` environment variable, also @server_key is deprecated. This attribute will be removed next version.'
end

# THIS IS EXPERIMENTAL
# NOT support `HTTPS_PROXY` environment variable. This feature not tested well on CI.
Expand Down

0 comments on commit 6270b64

Please sign in to comment.