hey-you-fcm-push 0.2.0 → 0.2.1

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: 8c286e9339b6ef0cc781b92c78cb47bd1850cedf08dc210798cead1d711d1002
4
- data.tar.gz: 19e09925db997861cbf98f374fd1edb6bcbbdab5f26e981bfa87d6e57adc6649
3
+ metadata.gz: e31e4c64c9bdac1a34234993d21733b380be4aed9555166bddb3a36d2634962f
4
+ data.tar.gz: 19e6c4381c0b31ed48d0554a3057595a5a93e4108aff88bd7ea4601b9caae4ee
5
5
  SHA512:
6
- metadata.gz: d0af3921010cbce6a05c327bdeaf61646c039c97a022bc39cf00ac2bfd4935eb9743bc425d3afb4be9c35cca3bafe5f3fe2aaa374c55ef5473764114d409c135
7
- data.tar.gz: b7e5220ee1e99beaf54f3f90367bf634abf6ba134a7ec2b00c1c224aace2adec8abf6aa60c53a9a4e3f3243cc2f572214c22a3ecf05b5da3c23b6a1ff6f3cc6a
6
+ metadata.gz: 489ea3404ab4957030f8425e2fcd88c3604ffdade3c04dc64f39c24c5d97cd21c90894f281036f35fb2bfa23494bd45256f0329fa0e72fa18b1e3ddf4c691029
7
+ data.tar.gz: 91bf728b3b25b50119965a251e96754ef6812d23379a656e443e061ff0686e5805bf5fb020d4982bc5c27ff209c7f0459017456f75a23e3a59188381328bce58
@@ -33,7 +33,10 @@ module HeyYou
33
33
  messages ||= [build_message(builder, **options)]
34
34
 
35
35
  messages.map do |message|
36
- HeyYouFcmPush::Connection.instance.send_notification(message, validate_only: options[:validate_only])
36
+ {
37
+ receiver: message.receiver_hash,
38
+ response: HeyYouFcmPush::Connection.instance.send_notification(message.to_h, validate_only: options[:validate_only])
39
+ }
37
40
  end
38
41
  end
39
42
 
@@ -51,7 +54,7 @@ module HeyYou
51
54
  apns: options[:apns] || builder.fcm_push.apns,
52
55
  fcm_options: options[:fcm_options]|| builder.fcm_push.fcm_options,
53
56
  data: options[:push_data] || builder.fcm_push.push_data
54
- ).to_h
57
+ )
55
58
  end
56
59
  end
57
60
  end
@@ -10,7 +10,7 @@ module HeyYouFcmPush
10
10
  RETRY_COUNT = 1
11
11
  HTTP_CODES = {
12
12
  not_auth: 401,
13
- success: 200
13
+ server_error: 500
14
14
  }
15
15
 
16
16
  attr_reader :authorization, :options, :project_id, :uri
@@ -44,13 +44,15 @@ module HeyYouFcmPush
44
44
  private
45
45
 
46
46
  def make_request(request_options)
47
+ HeyYou::Config.instance.logger&.debug("Send request to #{uri} with options #{request_options}")
47
48
  response = HTTParty.post(uri, request_options)
49
+ HeyYou::Config.instance.logger&.debug("Response: #{response}")
48
50
  process_response(response)
49
51
  end
50
52
 
51
53
  def process_response(response)
52
54
  raise AuthError if response.code == HTTP_CODES[:not_auth]
53
- return response.to_hash if response.code == HTTP_CODES[:success]
55
+ return response.to_hash if response.code <= HTTP_CODES[:server_error]
54
56
 
55
57
  raise ResponseError, "response code: #{response.code}"
56
58
  end
@@ -1,3 +1,3 @@
1
1
  module HeyYouFcmPush
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hey-you-fcm-push
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Nesterov