apn_on_rails 0.3.0 → 0.3.1
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.
| 
         @@ -17,6 +17,7 @@ 
     | 
|
| 
       17 
17 
     | 
    
         
             
            class APN::Notification < APN::Base
         
     | 
| 
       18 
18 
     | 
    
         
             
              include ::ActionView::Helpers::TextHelper
         
     | 
| 
       19 
19 
     | 
    
         
             
              extend ::ActionView::Helpers::TextHelper
         
     | 
| 
      
 20 
     | 
    
         
            +
              serialize :custom_properties
         
     | 
| 
       20 
21 
     | 
    
         | 
| 
       21 
22 
     | 
    
         
             
              belongs_to :device, :class_name => 'APN::Device'
         
     | 
| 
       22 
23 
     | 
    
         | 
| 
         @@ -39,6 +40,13 @@ class APN::Notification < APN::Base 
     | 
|
| 
       39 
40 
     | 
    
         
             
              #   apn.sound = 'my_sound.aiff'
         
     | 
| 
       40 
41 
     | 
    
         
             
              #   apn.alert = 'Hello!'
         
     | 
| 
       41 
42 
     | 
    
         
             
              #   apn.apple_hash # => {"aps" => {"badge" => 5, "sound" => "my_sound.aiff", "alert" => "Hello!"}}
         
     | 
| 
      
 43 
     | 
    
         
            +
              #
         
     | 
| 
      
 44 
     | 
    
         
            +
              # Example 2: 
         
     | 
| 
      
 45 
     | 
    
         
            +
              #   apn = APN::Notification.new
         
     | 
| 
      
 46 
     | 
    
         
            +
              #   apn.badge = 0
         
     | 
| 
      
 47 
     | 
    
         
            +
              #   apn.sound = true
         
     | 
| 
      
 48 
     | 
    
         
            +
              #   apn.custom_properties = {"typ" => 1}
         
     | 
| 
      
 49 
     | 
    
         
            +
              #   apn.apple_hast # => {"aps" => {"badge" => 0}}
         
     | 
| 
       42 
50 
     | 
    
         
             
              def apple_hash
         
     | 
| 
       43 
51 
     | 
    
         
             
                result = {}
         
     | 
| 
       44 
52 
     | 
    
         
             
                result['aps'] = {}
         
     | 
| 
         @@ -48,6 +56,11 @@ class APN::Notification < APN::Base 
     | 
|
| 
       48 
56 
     | 
    
         
             
                  result['aps']['sound'] = self.sound if self.sound.is_a? String
         
     | 
| 
       49 
57 
     | 
    
         
             
                  result['aps']['sound'] = "1.aiff" if self.sound.is_a?(TrueClass)
         
     | 
| 
       50 
58 
     | 
    
         
             
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
                if self.custom_properties
         
     | 
| 
      
 60 
     | 
    
         
            +
                  self.custom_properties.each do |key,value|
         
     | 
| 
      
 61 
     | 
    
         
            +
                    result["#{key}"] = "#{value}"
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
       51 
64 
     | 
    
         
             
                result
         
     | 
| 
       52 
65 
     | 
    
         
             
              end
         
     | 
| 
       53 
66 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: apn_on_rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - markbates
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2010-01-26 00:00:00 -05:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       72 
72 
     | 
    
         
             
            requirements: []
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
74 
     | 
    
         
             
            rubyforge_project: magrathea
         
     | 
| 
       75 
     | 
    
         
            -
            rubygems_version: 1.3. 
     | 
| 
      
 75 
     | 
    
         
            +
            rubygems_version: 1.3.5
         
     | 
| 
       76 
76 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       77 
77 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       78 
78 
     | 
    
         
             
            summary: apn_on_rails
         
     |