pushesus 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.textile +18 -1
  2. data/Rakefile +1 -1
  3. data/lib/pushesus.rb +22 -11
  4. metadata +2 -2
@@ -1,3 +1,20 @@
1
1
  h1. PushesUs
2
2
 
3
- http://pushes.us
3
+ http://www.pushes.us
4
+
5
+ h2. Usage
6
+
7
+ Easy as pie:
8
+
9
+ <pre>
10
+ <code>
11
+ network_key = 'w7h3o4s3y5o4u7r3d4a4d6d7y'
12
+ # Your network key from pushes.us
13
+
14
+ device_identity = '2123zannzabar'
15
+ # iPhone identity from the PushesUs iPhone app.
16
+
17
+ PushesUs::Notification.send(network_key,device_identity,'Well hello iPhone!')
18
+ # away it goes! It's that easy!
19
+ </code>
20
+ </pre>
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'spec/rake/spectask'
6
6
 
7
7
  GEM = 'pushesus'
8
8
  GEM_NAME = 'pushesus'
9
- GEM_VERSION = '0.0.1'
9
+ GEM_VERSION = '0.0.2'
10
10
  AUTHORS = ['James Pozdena']
11
11
  EMAIL = "jpoz@jpoz.net"
12
12
  HOMEPAGE = "http://github.com/jpoz/pushesus"
@@ -11,24 +11,35 @@ class PushesUs
11
11
 
12
12
  class Notification
13
13
 
14
- attr_accessor :network, :identity, :alert, :sound
14
+ attr_accessor :network_key, :device_identity, :alert, :sound
15
+ attr_reader :errors
15
16
 
16
- def initialize(network, identity, alert, sound='default')
17
- @network, @identity, @alert, @sound = network, identity, alert, sound
17
+ class << self
18
+ def send(network_key, device_identity, alert, sound='default')
19
+ p = self.new(network_key, device_identity, alert, sound)
20
+ p.send
21
+ return p
22
+ end
23
+ end
24
+
25
+ def initialize(network_key, device_identity, alert, sound='default')
26
+ @network_key, @device_identity, @alert, @sound = network_key, device_identity, alert, sound
18
27
  end
19
28
 
20
29
  def send
21
- PushesUs.post('/notifications.json', :query => { :notification => {
22
- :identity => identity,
23
- :network => network,
30
+ result = PushesUs.post('/notifications.json', :query => { :notification => {
31
+ :device_identity => device_identity,
32
+ :network_key => network_key,
24
33
  :alert => alert,
25
34
  :sound => sound
26
35
  }})
36
+ if result['success']
37
+ return true
38
+ else
39
+ @errors = result['errors']
40
+ return false
41
+ end
27
42
  end
28
43
 
29
44
  end
30
- end
31
- #
32
- # p = PushesUs::Notification.new('861odovei','241qijelya','Sweet bitches and junk')
33
- #
34
- # p.send
45
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushesus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pozdena
@@ -9,7 +9,7 @@ autorequire: pushesus
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-06 00:00:00 -08:00
12
+ date: 2009-11-08 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency