bmo 0.8.7 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/Gemfile.lock +1 -1
- data/README.md +6 -6
- data/lib/bmo/apns/client.rb +0 -2
- data/lib/bmo/apns/connection.rb +1 -1
- data/lib/bmo/apns/notification.rb +4 -7
- data/lib/bmo/gcm/connection.rb +1 -1
- data/lib/bmo/gcm/notification.rb +1 -3
- data/lib/bmo/version.rb +1 -1
- data/spec/bmo/apns/notification_spec.rb +14 -35
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NmM2NWMzOTM5MDFkZmZkNzVjODQ2NWM0NWQ2ODE5NWZhMTI0OGZkYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTE0Y2NmMzMyOGU5NDE4ZThhN2M1Zjk5YThkNTY4OWI0YTI2NWFjMA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjZkN2I2NzI4YzIyZjkyNjFlZmNlOTMwNjhkNjkzNmVhNDY5OWI5Y2YxNTBh
|
10
|
+
MTRkN2M2MWNlMDM5ODQyZDVmNmU1N2NjMWM3MmUwNGZjYTAyOWJkN2Q4NzE3
|
11
|
+
NmQxNjUyOTA5OWYwMDRjZmIyZDI2NjY3OTRkM2E4Y2Q2YjY0MjQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGE1NDQ4ZjdmZDNjMDBkNjNmMjM0NDU4OWY3ZTIxNGE5MzMwZTA1YmM3YWRh
|
14
|
+
YjllMGEzODkyNWViYTkwMmY4MWJjMGQ3OWRkNmRkYjc3ZDg1NTgwNTc5MGU2
|
15
|
+
NjkyOTk1ODRjNjQwMTY1YWY5ODMxMjRhNmM1NmRjMGFlYTBjNTU=
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -56,11 +56,11 @@ Default Params :
|
|
56
56
|
```ruby
|
57
57
|
BMO.configuration do |config|
|
58
58
|
config.apns.gateway_host = 'gateway.push.apple.com'
|
59
|
-
config.apns.gateway_port =
|
60
|
-
config.apns.feedback_host =
|
61
|
-
config.apns.feedback_port =
|
62
|
-
config.apns.cert_path =
|
63
|
-
config.apns.cert_pass =
|
59
|
+
config.apns.gateway_port = 2195
|
60
|
+
config.apns.feedback_host = 'feedback.push.apple.com'
|
61
|
+
config.apns.feedback_port = 2196
|
62
|
+
config.apns.cert_path = nil
|
63
|
+
config.apns.cert_pass = nil
|
64
64
|
end
|
65
65
|
```
|
66
66
|
|
@@ -92,7 +92,7 @@ BMO.configuration do |config|
|
|
92
92
|
end
|
93
93
|
```
|
94
94
|
|
95
|
-
You should set the api_key.
|
95
|
+
You should set the api_key. It uses Faraday internally, so just set your regular http_proxy environment variable if need to configure a proxy.
|
96
96
|
|
97
97
|
## License
|
98
98
|
|
data/lib/bmo/apns/client.rb
CHANGED
data/lib/bmo/apns/connection.rb
CHANGED
@@ -31,8 +31,6 @@ module BMO
|
|
31
31
|
payload.validate!
|
32
32
|
end
|
33
33
|
|
34
|
-
private
|
35
|
-
|
36
34
|
# The Payload contains the data sent to Apple
|
37
35
|
class Payload
|
38
36
|
class PayloadTooLarge < Exception; end
|
@@ -53,10 +51,9 @@ module BMO
|
|
53
51
|
end
|
54
52
|
|
55
53
|
def validate!
|
56
|
-
if to_package.
|
57
|
-
str =
|
58
|
-
|
59
|
-
EOS
|
54
|
+
if to_package.bytesize > MAX_BYTE_SIZE
|
55
|
+
str = "Payload byte size (#{to_package.bytesize})" \
|
56
|
+
" should be less than #{Payload::MAX_BYTE_SIZE} bytes"
|
60
57
|
fail PayloadTooLarge, str
|
61
58
|
end
|
62
59
|
true
|
@@ -82,7 +79,7 @@ module BMO
|
|
82
79
|
|
83
80
|
def validate!
|
84
81
|
unless token =~ /^[a-z0-9]{64}$/i
|
85
|
-
fail(MalformedDeviceToken,
|
82
|
+
fail(MalformedDeviceToken, "Malformed Device Token : #{token}")
|
86
83
|
end
|
87
84
|
true
|
88
85
|
end
|
data/lib/bmo/gcm/connection.rb
CHANGED
data/lib/bmo/gcm/notification.rb
CHANGED
@@ -24,8 +24,6 @@ module BMO
|
|
24
24
|
payload.validate!
|
25
25
|
end
|
26
26
|
|
27
|
-
private
|
28
|
-
|
29
27
|
# The Payload contains the data sent to Apple
|
30
28
|
class Payload
|
31
29
|
# Error Raised when the payload packaged > MAX_BYTE_SIZE
|
@@ -47,7 +45,7 @@ module BMO
|
|
47
45
|
end
|
48
46
|
|
49
47
|
def validate!
|
50
|
-
if to_package.
|
48
|
+
if to_package.bytesize > MAX_BYTE_SIZE
|
51
49
|
str = <<-EOS
|
52
50
|
Payload size should be less than #{Payload::MAX_BYTE_SIZE} bytes
|
53
51
|
EOS
|
data/lib/bmo/version.rb
CHANGED
@@ -3,52 +3,19 @@
|
|
3
3
|
require File.dirname(__FILE__) + '../../../spec_helper'
|
4
4
|
|
5
5
|
describe BMO::APNS::Notification::DeviceToken do
|
6
|
-
describe '#token' do
|
7
|
-
it 'returns the token' do
|
8
|
-
device_token = described_class.new('abc')
|
9
|
-
expect(device_token.token).to eq('abc')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#==' do
|
14
|
-
it 'returns true for equal device token' do
|
15
|
-
device_token = described_class.new('abc')
|
16
|
-
device_token_bis = described_class.new('abc')
|
17
|
-
expect(device_token == device_token_bis).to be_true
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'returns true for equal device token' do
|
21
|
-
device_token = described_class.new('abc')
|
22
|
-
device_token_bis = described_class.new('abc')
|
23
|
-
expect(device_token).to eq(device_token_bis)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'returns false for equal device token' do
|
27
|
-
device_token = described_class.new('abc')
|
28
|
-
device_token_bis = described_class.new('def')
|
29
|
-
expect(device_token).to_not eq(device_token_bis)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns true for equal device token' do
|
33
|
-
device_token = described_class.new('abc')
|
34
|
-
device_token_bis = described_class.new('def')
|
35
|
-
expect(device_token == device_token_bis).to be_false
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
6
|
describe '#validate!' do
|
40
7
|
it 'returns true if the token is 64 chars' do
|
41
8
|
device_token = described_class.new('a' * 64)
|
42
9
|
expect(device_token.validate!).to be_true
|
43
10
|
end
|
44
11
|
|
45
|
-
it '
|
12
|
+
it 'raises an error if the token is not 64 chars' do
|
46
13
|
device_token = described_class.new('a' * 63)
|
47
14
|
expect { device_token.validate! }.to raise_error(
|
48
15
|
BMO::APNS::Notification::DeviceToken::MalformedDeviceToken)
|
49
16
|
end
|
50
17
|
|
51
|
-
it '
|
18
|
+
it 'raises an error if the token contains a special char' do
|
52
19
|
device_token = described_class.new(('a' * 63) + '"')
|
53
20
|
expect { device_token.validate! }.to raise_error(
|
54
21
|
BMO::APNS::Notification::DeviceToken::MalformedDeviceToken)
|
@@ -78,4 +45,16 @@ describe BMO::APNS::Notification::Payload do
|
|
78
45
|
payload = described_class.new('Jake' => 'The Dog')
|
79
46
|
expect(payload).to eq(described_class.new(Jake: 'The Dog'))
|
80
47
|
end
|
48
|
+
|
49
|
+
describe '#validate!' do
|
50
|
+
it 'returns true if the payload is valid' do
|
51
|
+
payload = described_class.new(apns: 'a' * 200)
|
52
|
+
expect(payload.validate!).to be_true
|
53
|
+
end
|
54
|
+
it 'raises an error if the payload is too large' do
|
55
|
+
payload = described_class.new(apns: 'a' * 256)
|
56
|
+
expect { payload.validate! }.to raise_error(
|
57
|
+
BMO::APNS::Notification::Payload::PayloadTooLarge)
|
58
|
+
end
|
59
|
+
end
|
81
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Lyset
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equalizer
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '>'
|
31
|
+
- - ! '>'
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.8.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '>'
|
38
|
+
- - ! '>'
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.8.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '>='
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '>='
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Push notifications to iOS and Android devices
|
@@ -106,17 +106,17 @@ require_paths:
|
|
106
106
|
- lib
|
107
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - '>='
|
109
|
+
- - ! '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- - '>='
|
114
|
+
- - ! '>='
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
118
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
119
|
+
rubygems_version: 2.2.2
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
122
|
summary: Push notifications to iOS and Android devices
|