c2dm_batch 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -12,6 +12,13 @@ Requirements
12
12
  gem install typhoeus
13
13
  </pre>
14
14
 
15
+ Configuration
16
+ -------------
17
+ C2dmBatch.email = 'your_c2dm_sender@gmail.com'
18
+ C2dmBatch.password = 'password'
19
+ C2dmBatch.source = 'your app name'
20
+ C2dmBatch.logger = Logger.new(STDOUT) # default logger
21
+
15
22
  Send a single notification
16
23
  --------------------------
17
24
  <pre>
data/c2dm_batch.gemspec CHANGED
@@ -6,7 +6,7 @@ $:.unshift lib unless $:.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "c2dm_batch"
9
- s.version = '0.1.1'
9
+ s.version = '0.1.2'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = ["Alex Rockwell"]
12
12
  s.email = ["arockwell@gmail.com"]
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_development_dependency "rspec", "~> 1.0"
23
23
  s.add_dependency "typhoeus", "= 0.2.4"
24
+ s.add_dependency "json", "= 1.6.1"
24
25
  end
data/lib/c2dm_batch.rb CHANGED
@@ -4,6 +4,7 @@ require "cgi"
4
4
  gem 'typhoeus', '= 0.2.4'
5
5
  require "typhoeus"
6
6
  require 'logger'
7
+ require 'json'
7
8
 
8
9
  $:.unshift File.dirname(__FILE__)
9
10
 
@@ -65,9 +65,9 @@ module C2dmBatch
65
65
  if response.success?
66
66
  if response.body =~ /Error=(\w+)/
67
67
  errors << { :registration_id => notification[:registration_id], :error => $1 }
68
- @logger.info("Error sending: #{pp notification}")
68
+ @logger.info("Error sending: #{notification.to_json}")
69
69
  else
70
- @logger.info("Sent notification: #{pp notification}")
70
+ @logger.info("Sent notification: #{notification.to_json}")
71
71
  requests.delete(request)
72
72
  end
73
73
  elsif response.code == 503
@@ -103,6 +103,7 @@ module C2dmBatch
103
103
  options.each_pair do |k,v|
104
104
  post_body << "#{k}=#{CGI::escape(v.to_s)}"
105
105
  end
106
+ options.merge! data_attributes if data_attributes
106
107
 
107
108
  post_body.join('&')
108
109
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c2dm_batch
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Rockwell
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-13 00:00:00 -07:00
18
+ date: 2011-10-17 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -49,6 +49,22 @@ dependencies:
49
49
  version: 0.2.4
50
50
  type: :runtime
51
51
  version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: json
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - "="
59
+ - !ruby/object:Gem::Version
60
+ hash: 13
61
+ segments:
62
+ - 1
63
+ - 6
64
+ - 1
65
+ version: 1.6.1
66
+ type: :runtime
67
+ version_requirements: *id003
52
68
  description: Gem to send android c2dm notifications in batch
53
69
  email:
54
70
  - arockwell@gmail.com