actionpusher 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ Action Pusher
2
+ ============
3
+
4
+ ActionPusher is an ActionMailer inspired gem to make sending push notifications from Rails as easy as sending emails.
5
+
6
+ To use, require the gem inside your `Gemfile`:
7
+
8
+ ```
9
+ gem 'actionpusher', require: 'action_pusher'
10
+ ```
11
+
12
+ Make sure your `.pem` files are under `config/certificates` with the following format:
13
+
14
+ * `config/certificates/push-notification-prod.pem`
15
+ * `config/certificates/push-notification-dev.pem`
16
+
17
+ Then you can define a push sender. We define our pushers inside of `app/pushers` like so:
18
+
19
+ ```
20
+ # app/pushers/my_pusher.rb
21
+
22
+ class MyPusher < ActionPusher::Base
23
+ def send_a_push_notification
24
+ push(tokens: ['an', 'array', 'of', 'device', 'tokens'],
25
+ message: 'message being sent',
26
+ data: 'extra data sent with the push notification')
27
+ end
28
+ end
29
+ ```
30
+
31
+ Your push notifications can then be called like a standard Rails mailer:
32
+
33
+ ```
34
+ MyPusher.send_a_push_notification.deliver
35
+ ```
36
+
37
+ ## TODO
38
+
39
+ * YAML based configuration for pem files
40
+ * Get working with DelayedJob: `MyPusher.delay.send_a_push_notification`
41
+
42
+ ## Copyright
43
+
44
+ Copyright (c) 2014 PetroFeed. See [LICENSE](https://github.com/PetroFeed/actionpusher/blob/master/LICENSE) for further details.
45
+
46
+ ---
47
+
48
+ Proudly brought to you by [PetroFeed](http://PetroFeed.com).
49
+
50
+ ![Pedro](https://www.petrofeed.com/img/company/pedro.png)
51
+
@@ -3,10 +3,10 @@ require 'houston'
3
3
  module ActionPusher
4
4
  class APNCertificate
5
5
  def self.instance
6
- APNCertificate.apn.tap do |apn|
6
+ apn.tap do |apn|
7
7
  # Load required certificate
8
8
  apn.certificate = File.read(
9
- File.join(Rails.root, 'config', 'certificates', "push-notification-#{APNCertificate.environment_string}.pem"))
9
+ File.join(::Rails.root, 'config', 'certificates', "push-notification-#{APNCertificate.environment_string}.pem"))
10
10
  end
11
11
  end
12
12
 
@@ -15,7 +15,7 @@ module ActionPusher
15
15
  #######
16
16
 
17
17
  def self.environment_string
18
- if Rails.env.production?
18
+ if ::Rails.env.production?
19
19
  'prod'
20
20
  else
21
21
  'dev'
@@ -25,7 +25,7 @@ module ActionPusher
25
25
  def self.apn
26
26
  # Use the correct APN gateway
27
27
  # See: https://github.com/nomad/houston/blob/master/lib/houston/client.rb#L2-L6
28
- if Rails.env.production?
28
+ if ::Rails.env.production?
29
29
  Houston::Client.production
30
30
  else
31
31
  Houston::Client.development
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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: 2014-04-23 00:00:00.000000000 Z
12
+ date: 2014-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 2.14.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: pry
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: houston
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -66,10 +82,11 @@ executables: []
66
82
  extensions: []
67
83
  extra_rdoc_files: []
68
84
  files:
85
+ - README.md
69
86
  - lib/action_pusher/apn_certificate.rb
70
87
  - lib/action_pusher/base.rb
71
88
  - lib/action_pusher.rb
72
- homepage:
89
+ homepage: https://github.com/PetroFeed/actionpusher
73
90
  licenses:
74
91
  - MIT
75
92
  post_install_message:
@@ -96,3 +113,4 @@ signing_key:
96
113
  specification_version: 3
97
114
  summary: Push notification composition and delivery framework (based on ActionMailer.)
98
115
  test_files: []
116
+ has_rdoc: