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 +4 -4
- data/lib/hey_you/channels/fcm_push.rb +5 -2
- data/lib/hey_you_fcm_push/connection.rb +4 -2
- data/lib/hey_you_fcm_push/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e31e4c64c9bdac1a34234993d21733b380be4aed9555166bddb3a36d2634962f
|
4
|
+
data.tar.gz: 19e6c4381c0b31ed48d0554a3057595a5a93e4108aff88bd7ea4601b9caae4ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
)
|
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
|
-
|
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
|
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
|