bmo 0.8.12 → 0.8.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4afb517d4a0f17d1f500b8e4c772ade57da567f8
4
- data.tar.gz: 33b0ac10f237ba31ab11994cfc521f423262743d
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YWZjZWQ3MDZmOGI1NWNlMjVkMzNjOTk0NjA0MWY3NWI2MmQ1MzNjYg==
5
+ data.tar.gz: !binary |-
6
+ OTM2NWY1YWU0MDRkZDgyZWRlNjA5NDI1ODg0MjM2MDA0Mjg2ZWI2MQ==
5
7
  SHA512:
6
- metadata.gz: edb53ab8eab28af0957cbd6e5935172aae1038bd23fec48798954f2e7d5147cea365d120c8fbb28ccf1f613840a6d05ed8beda956ccc88c837228b33a3454ee3
7
- data.tar.gz: 21d78c12ed0f98099ad1dd143ee39e9a6a7a8ee936c01c7f84ed617ef241f734c9ab21867b16f14841aae3075a7c8b4cca77e12495fdcbed57530e8781673c56
8
+ metadata.gz: !binary |-
9
+ NTM1MjMyY2ZjOTAyNzJlNTY2YjQ0NGVlOTcyMDIxNWVlNzVmNjdjY2UwMDcy
10
+ ZTJiMWYwYjlmODIyYmRhODgyM2E5Y2I4NWU2NTAzMDJmNmIxZTkyNmJkMjMx
11
+ YjBjN2YyNzlhOTM1NGVkMWU1MmFlZmRkM2U3ZWNkOTA0NjQ4Mzk=
12
+ data.tar.gz: !binary |-
13
+ MmZmMjYwMTM1M2JmYzc4ZTZhMzZlZDI1YjcwOThkZTJkZmZjMjEzNTkwM2U2
14
+ N2ExNTkyZjg3NjFjM2E4NWMwZTRkYTI5ZjViNjZmOWRiMmJlNjA0NzI3MTU4
15
+ NjA2ZTlhM2EzOWQ4ZTU1YWU0ODlkNmI5NWJiZWNiNTkxODNiMDU=
data/Gemfile.lock CHANGED
@@ -26,7 +26,7 @@ GIT
26
26
  PATH
27
27
  remote: .
28
28
  specs:
29
- bmo (0.8.11)
29
+ bmo (0.8.12)
30
30
  equalizer (~> 0.0.0)
31
31
  faraday (> 0.8.0)
32
32
 
@@ -66,11 +66,11 @@ module BMO
66
66
  end
67
67
 
68
68
  def truncate_field!
69
- return unless data[:apns] && data[:apns][truncable_field]
70
- string = data[:apns][truncable_field]
69
+ return unless data[:aps] && data[:aps][truncable_field]
70
+ string = data[:aps][truncable_field]
71
71
  diff_bytesize = package.bytesize - MAX_BYTE_SIZE
72
72
  desirable_bytesize = (string.bytesize - diff_bytesize) - 1
73
- data[:apns][truncable_field] = Utils
73
+ data[:aps][truncable_field] = Utils
74
74
  .bytesize_force_truncate(string, desirable_bytesize, options)
75
75
  end
76
76
 
data/lib/bmo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # Main BMO module, version get right here
3
3
  module BMO
4
- VERSION = '0.8.12'.freeze
4
+ VERSION = '0.8.13'.freeze
5
5
  end
data/lib/bmo.rb CHANGED
@@ -26,7 +26,7 @@ module BMO
26
26
  # @param device_token [String]
27
27
  # @param data [Hash] The data you want to send
28
28
  # @option options :truncable_field If the payload is too large
29
- # this field will be truncated, it must be in a apns hash
29
+ # this field will be truncated, it must be in an aps hash
30
30
  # @option options :omission ('...') The omission in truncate
31
31
  # @option options :separator The separator use in truncation
32
32
  #
@@ -33,11 +33,11 @@ end
33
33
  describe BMO::APNS::Notification::Payload do
34
34
  describe '#validate!' do
35
35
  it 'returns true if the payload is valid' do
36
- payload = described_class.new(apns: 'a' * 200)
36
+ payload = described_class.new(aps: 'a' * 200)
37
37
  expect(payload.validate!).to be_true
38
38
  end
39
39
  it 'raises an error if the payload is too large' do
40
- payload = described_class.new(apns: 'a' * 256)
40
+ payload = described_class.new(aps: 'a' * 256)
41
41
  expect { payload.validate! }.to raise_error(
42
42
  BMO::APNS::Notification::Payload::PayloadTooLarge)
43
43
  end
@@ -46,37 +46,37 @@ describe BMO::APNS::Notification::Payload do
46
46
  describe '#to_package' do
47
47
  it 'truncates if there is a truncable field and this is not valid' do
48
48
  options = { truncable_field: :message }
49
- payload = described_class.new({ apns: { message: 'a' * 256 } }, options)
50
- expect(payload.to_package).to eq("{\"apns\":{\"message\":\"#{'a' * 229}...\"}}")
49
+ payload = described_class.new({ aps: { message: 'a' * 256 } }, options)
50
+ expect(payload.to_package).to eq("{\"aps\":{\"message\":\"#{'a' * 230}...\"}}")
51
51
  end
52
52
 
53
53
  it 'truncates to respect the MAX_BYTE_SIZE' do
54
54
  options = { truncable_field: :message }
55
- payload = described_class.new({ apns: { message: 'a' * 256 } }, options)
55
+ payload = described_class.new({ aps: { message: 'a' * 256 } }, options)
56
56
  expect(payload.to_package.bytesize).to be < BMO::APNS::Notification::Payload::MAX_BYTE_SIZE
57
57
  end
58
58
  end
59
59
 
60
60
  describe '#truncable_field!' do
61
- it 'truncates the corresponding field in apns' do
61
+ it 'truncates the corresponding field in aps' do
62
62
  options = { truncable_field: :message }
63
- payload = described_class.new({ apns: { message: 'a' * 256 } }, options)
63
+ payload = described_class.new({ aps: { message: 'a' * 256 } }, options)
64
64
  payload.truncate_field!
65
- expect(payload.data[:apns][:message]).to eq(('a' * 229) + '...')
65
+ expect(payload.data[:aps][:message]).to eq(('a' * 230) + '...')
66
66
  end
67
67
 
68
68
  it 'truncates with omission' do
69
69
  options = { truncable_field: :message, omission: '[more]' }
70
- payload = described_class.new({ apns: { message: 'a' * 256 } }, options)
70
+ payload = described_class.new({ aps: { message: 'a' * 256 } }, options)
71
71
  payload.truncate_field!
72
- expect(payload.data[:apns][:message]).to eq(('a' * 226) + '[more]')
72
+ expect(payload.data[:aps][:message]).to eq(('a' * 227) + '[more]')
73
73
  end
74
74
 
75
75
  it 'truncates with separator' do
76
76
  options = { truncable_field: :message, separator: ' ' }
77
- payload = described_class.new({ apns: { message: 'test ' + ('a' * 255) } }, options)
77
+ payload = described_class.new({ aps: { message: 'test ' + ('a' * 255) } }, options)
78
78
  payload.truncate_field!
79
- expect(payload.data[:apns][:message]).to eq('test...')
79
+ expect(payload.data[:aps][:message]).to eq('test...')
80
80
  end
81
81
  end
82
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.12
4
+ version: 0.8.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antoine Lyset
@@ -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
@@ -107,17 +107,17 @@ require_paths:
107
107
  - lib
108
108
  required_ruby_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ! '>='
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.1.11
120
+ rubygems_version: 2.2.2
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Push notifications to iOS and Android devices