bmo 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bmo/configuration.rb +5 -7
- data/lib/bmo/utils.rb +1 -3
- data/lib/bmo/version.rb +1 -1
- data/lib/bmo.rb +6 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d609b4d26395f9bfda12fb143c998bab3488ca0b
|
4
|
+
data.tar.gz: 5d9c2545c5437cded63ebe1649f665561fd46549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1abfaa97370cdfc108360ed3084743c53296198bf2d584a46ba16747b427a95187a81decd198ba8c2d52a10b0f6c6d50233eb1e79f39355b1d989b4c03901dc0
|
7
|
+
data.tar.gz: d43b396920e000f54ffce756fae5e68ab8a4c0bfc98cd7f3843a13d66581f898e547cd1a5111766300e7eec0f4329ae345cebe0f82fef02dd9a6fc23ef54d2b5
|
data/Gemfile.lock
CHANGED
data/lib/bmo/configuration.rb
CHANGED
@@ -43,25 +43,23 @@ module BMO
|
|
43
43
|
end
|
44
44
|
end # class Configuration
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
def configure
|
46
|
+
def self.configure
|
49
47
|
yield(configuration) if block_given?
|
50
48
|
configuration
|
51
49
|
end
|
52
50
|
|
53
|
-
def configuration
|
51
|
+
def self.configuration
|
54
52
|
@configuration ||= Configuration.new
|
55
53
|
end
|
56
54
|
|
57
|
-
#
|
55
|
+
# Help ?
|
58
56
|
# rubocop:disable TrivialAccessors
|
59
|
-
def configuration=(configuration)
|
57
|
+
def self.configuration=(configuration)
|
60
58
|
@configuration = configuration
|
61
59
|
end
|
62
60
|
# rubocop:enable
|
63
61
|
|
64
|
-
def reset_configuration
|
62
|
+
def self.reset_configuration
|
65
63
|
@configuration = Configuration.new
|
66
64
|
end
|
67
65
|
end # BMO
|
data/lib/bmo/utils.rb
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
module BMO
|
3
3
|
# Utility module
|
4
4
|
module Utils
|
5
|
-
module_function
|
6
|
-
|
7
5
|
# Coerce string hash keys to symbols
|
8
|
-
def coerce_to_symbols(hash)
|
6
|
+
def self.coerce_to_symbols(hash)
|
9
7
|
hash_symbolized = {}
|
10
8
|
hash.each_pair do |key, value|
|
11
9
|
key = key.to_sym if key.respond_to?(:to_sym)
|
data/lib/bmo/version.rb
CHANGED
data/lib/bmo.rb
CHANGED
@@ -20,9 +20,6 @@ require 'bmo/gcm/client'
|
|
20
20
|
|
21
21
|
# Main BMO namespace
|
22
22
|
module BMO
|
23
|
-
# All the methods will be Class Methods
|
24
|
-
module_function
|
25
|
-
|
26
23
|
# Send ios notification with the configuration of BMO
|
27
24
|
# (see #BMO::Configuration)
|
28
25
|
#
|
@@ -34,7 +31,7 @@ module BMO
|
|
34
31
|
# @see https://developer.apple.com/library/ios/documentation/
|
35
32
|
# NetworkingInternet/Conceptual/RemoteNotificationsPG/
|
36
33
|
# Chapters/ApplePushService.html
|
37
|
-
def send_ios_notification(device_token, data)
|
34
|
+
def self.send_ios_notification(device_token, data)
|
38
35
|
notification = APNS::Notification.new(device_token, data)
|
39
36
|
apns_client.send_notification(notification)
|
40
37
|
end
|
@@ -43,7 +40,7 @@ module BMO
|
|
43
40
|
#
|
44
41
|
# @return [Array<FeedbackTuple>] Feedback Object containing
|
45
42
|
# a time and a token
|
46
|
-
def get_ios_feedback
|
43
|
+
def self.get_ios_feedback
|
47
44
|
apns_client.get_feedback
|
48
45
|
end
|
49
46
|
|
@@ -56,14 +53,14 @@ module BMO
|
|
56
53
|
# @return [Faraday::Response] The HTTP Response
|
57
54
|
#
|
58
55
|
# @see http://developer.android.com/google/gcm/server.html]
|
59
|
-
def send_android_notification(device_token, data)
|
56
|
+
def self.send_android_notification(device_token, data)
|
60
57
|
notification = GCM::Notification.new(device_token, data)
|
61
|
-
|
58
|
+
gcm_client.send_notification(notification)
|
62
59
|
end
|
63
60
|
|
64
61
|
private
|
65
62
|
|
66
|
-
def apns_client
|
63
|
+
def self.apns_client
|
67
64
|
conf = BMO.configuration.apns
|
68
65
|
APNS::Client.new(conf.gateway_host,
|
69
66
|
conf.gateway_port,
|
@@ -73,7 +70,7 @@ module BMO
|
|
73
70
|
cert_pass: conf.cert_pass)
|
74
71
|
end
|
75
72
|
|
76
|
-
def gcm_client
|
73
|
+
def self.gcm_client
|
77
74
|
conf = BMO.configuration.gcm
|
78
75
|
GCM::Client.new(conf.gateway_url,
|
79
76
|
conf.api_key)
|