rapnd 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -1,9 +1,9 @@
1
1
  module Rapnd
2
2
  class Notification
3
- attr_accessor :badge, :alert, :sound, :'content-available', :custom_properties, :device_token
3
+ attr_accessor :badge, :alert, :sound, :content_available, :custom_properties, :device_token
4
4
 
5
5
  def initialize(hash)
6
- [:badge, :alert, :sound, :device_token, :custom_properties].each do |k|
6
+ [:badge, :alert, :sound, :device_token, :content_available, :custom_properties].each do |k|
7
7
  self.instance_variable_set("@#{k}".to_sym, hash[k]) if hash[k]
8
8
  end
9
9
  raise "Must provide device token: #{hash}" if self.device_token.nil?
@@ -12,8 +12,8 @@ module Rapnd
12
12
 
13
13
  def payload
14
14
  p = Hash.new
15
- [:badge, :alert, :sound, :'content-available'].each do |k|
16
- p[k] = send(k) if send(k)
15
+ [:badge, :alert, :sound, :content_available].each do |k|
16
+ p[k.to_s.gsub('_','-').to_sym] = send(k) if send(k)
17
17
  end
18
18
  aps = {:aps => p}
19
19
  aps.merge!(custom_properties) if custom_properties
data/rapnd.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rapnd"
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh Symonds"]
@@ -9,6 +9,12 @@ describe "Rapnd::Notification" do
9
9
  @notification.device_token.should == '12345'
10
10
  end
11
11
 
12
+ it 'sets a content-available' do
13
+ @notification = Rapnd::Notification.new(:alert => 'Big test time', :content_available => "Yes!", :custom_properties => {:key => 'This is a test!', :spid => 1234}, :device_token => '1234 5')
14
+
15
+ @notification.payload.should == {:aps => {:alert => "Big test time", :'content-available' => "Yes!"}, :key => "This is a test!", :spid => 1234}
16
+ end
17
+
12
18
  it 'does not set the body key if only an alert is passed' do
13
19
  @notification = Rapnd::Notification.new(:alert => 'Big test time', :custom_properties => {:key => 'This is a test!', :spid => 1234}, :device_token => '1234 5')
14
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapnd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -231,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  segments:
233
233
  - 0
234
- hash: -614033134432213086
234
+ hash: -3943854128204889530
235
235
  required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  none: false
237
237
  requirements: