speedy_c2dm 1.0.0 → 1.0.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.
data/README.markdown CHANGED
@@ -22,6 +22,10 @@ An Android device running 2.2 or newer, its registration token, and a Google acc
22
22
 
23
23
  Speedy_C2DM will work with Rails 3.x & Ruby 1.9x. It has not been tested on previous versions or Rails or Ruby, and may or may not work with those versions.
24
24
 
25
+ ##Backwards Compatibility
26
+
27
+ v1.0.0 is not backwards compatible with previous version. If you are migrating from a version prior to v1.0.0 please see the new usage instructions below.
28
+
25
29
  ##Usage
26
30
 
27
31
  For a Rails app, a good place to put the following would be in config/initializers/speedy_c2dm.rb :
@@ -36,13 +40,13 @@ Then, where you want to make a C2DM call in your code, create an options hash an
36
40
  options = {
37
41
  :registration_id => SOME_REGISTRATION_ID,
38
42
  :message => "Hi!",
39
- :extra_data => 42,
43
+ :extra_data => nil,
40
44
  :collapse_key => "some-collapse-key"
41
45
  }
42
46
 
43
47
  response = SpeedyC2DM::API.send_notification(options)
44
48
 
45
- Note: there are blocking calls in both .new() and .send_notification(). You should use an async queue like [Resque](https://github.com/defunkt/resque) to ensure a non-blocking code path in your application code, particularly for the .send_notification() call.
49
+ Note: there are blocking calls in both .set_account() and .send_notification(). You should use an async queue like [Resque](https://github.com/defunkt/resque) to ensure a non-blocking code path in your application code, particularly for the .send_notification() call.
46
50
 
47
51
 
48
52
  ##Testing
@@ -1,3 +1,3 @@
1
1
  module SpeedyC2dm
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/speedy_c2dm.rb CHANGED
@@ -82,7 +82,7 @@ module SpeedyC2DM
82
82
  def notificationRequest(options)
83
83
  data = {}
84
84
  options.each do |key, value|
85
- if [:registration_id, :collapse_key].include? key
85
+ if [:registration_id, "registration_id", :collapse_key, "collapse_key"].include? key
86
86
  data[key] = value
87
87
  else
88
88
  data["data.#{key}"] = value
@@ -91,6 +91,7 @@ module SpeedyC2DM
91
91
 
92
92
  data = data.map{|k, v| "&#{k}=#{URI.escape(v.to_s)}"}.reduce{|k, v| k + v}
93
93
  headers = { "Authorization" => "GoogleLogin auth=#{@auth_token}",
94
+ "Content-type" => "application/x-www-form-urlencoded",
94
95
  "Content-length" => "#{data.length}" }
95
96
  uri = URI.parse(PUSH_URL)
96
97
  http = Net::HTTP.new(uri.host, uri.port)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speedy_c2dm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.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: 2011-11-03 00:00:00.000000000 -04:00
12
+ date: 2011-11-04 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
  description: Speedy C2DM efficiently sends push notifications to Android devices via