ruby-mpns 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Release 1.2.1
4
+
5
+ * FIX: fix tile notification, Microsoft did update their specs (thanks to [Dombi Attila](https://github.com/dombesz)'s [pull request #4](https://github.com/nverinaud/ruby-mpns/pull/4))
6
+
3
7
  ## Release 1.2.0
4
8
 
5
9
  * NEW: unit tests has been added
data/README.md CHANGED
@@ -49,10 +49,11 @@ You can pass whatever hash you want and an XML will be generated, like the follo
49
49
  <root>
50
50
  <key1>value1</key1>
51
51
  <key2>value2</key2>
52
+ <subtree>
53
+ <subkey>value</subkey>
54
+ </subtree>
52
55
  </root>
53
56
 
54
- **Warning** Currently limited to one level, the hash must not contain another hash.
55
-
56
57
  ### Tile notification
57
58
 
58
59
  The following notification parameters can be defined in the options hash for `:tile`:
@@ -73,6 +74,8 @@ For general information about Push Notification on Windows Phone check the [MSDN
73
74
 
74
75
  ### Missing features
75
76
 
77
+ * Support HTTPS
78
+ * Support sending raw notification data in other formats like text, bytes or JSON
76
79
  * Add an ActiveRecord extension (acts_as_microsoft_pushable)
77
80
 
78
81
  ### Contributors
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -26,7 +26,7 @@ module MicrosoftPushNotificationService
26
26
 
27
27
  request = Net::HTTP::Post.new(uri.request_uri)
28
28
  request.content_type = 'text/xml'
29
- request['X-WindowsPhone-Target'] = type.to_s if type.to_sym != :raw
29
+ request['X-WindowsPhone-Target'] = windowsphone_target_header_for_type(type)
30
30
  request['X-NotificationClass'] = notification_class
31
31
  request.body = notification
32
32
  request.content_length = notification.length
@@ -43,6 +43,14 @@ protected
43
43
  sym
44
44
  end
45
45
 
46
+ def windowsphone_target_header_for_type(type)
47
+ if (type == :tile)
48
+ type = :token
49
+ end
50
+
51
+ type.to_s if [:token, :toast].include?(type.to_sym)
52
+ end
53
+
46
54
  def notification_builder_for_type(type)
47
55
  case type
48
56
  when :tile
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ruby-mpns"
8
- s.version = "1.2.0"
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nicolas VERINAUD"]
12
- s.date = "2013-01-12"
12
+ s.date = "2013-11-24"
13
13
  s.description = "This gem provides an easy way to send push notifications to Windows Phone devices using Microsoft Push Notification Service."
14
14
  s.email = "n.verinaud@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -1,10 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
- require File.dirname(__FILE__) + '/lib/ruby-mpns'
3
+ require_relative '../lib/ruby-mpns'
4
4
 
5
5
  puts "=== Sample Usage ==="
6
6
 
7
- uri = "<# Your Microsoft Push URI here #>"
7
+ uri = "http://mpns.org"
8
8
 
9
9
  #
10
10
  # => TOAST
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require_relative 'helper'
2
2
 
3
3
  class TestRubyMpns < Test::Unit::TestCase
4
4
  should 'safely convert type to symbol' do
@@ -31,6 +31,18 @@ class TestRubyMpns < Test::Unit::TestCase
31
31
  assert_equal cls, '3'
32
32
  end
33
33
 
34
+ should 'return the correct windows phone target header' do
35
+ mpns = Object.new.extend MicrosoftPushNotificationService
36
+ header = mpns.send(:windowsphone_target_header_for_type, :toast)
37
+ assert_equal header, 'toast'
38
+ header = mpns.send(:windowsphone_target_header_for_type, :tile)
39
+ assert_equal header, 'token'
40
+ header = mpns.send(:windowsphone_target_header_for_type, :raw)
41
+ assert_equal header, nil
42
+ header = mpns.send(:windowsphone_target_header_for_type, :beer)
43
+ assert_equal header, nil
44
+ end
45
+
34
46
  should 'format params like a boss' do
35
47
  mpns = Object.new.extend MicrosoftPushNotificationService
36
48
  q = mpns.send(:format_params, { a: 1, b: 2 })
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mpns
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-12 00:00:00.000000000 Z
12
+ date: 2013-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder