ruby-pushbullet 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6a02b2f222504da04a87dcb0e26f2b3cdb584c7
4
- data.tar.gz: 4610a8f50ba0ee77cd7f8f3692aa296a283cadbe
3
+ metadata.gz: 24ea52ae23543f776f27e23032a60b5009f74eb4
4
+ data.tar.gz: ff625189e17d3e6c2c60dfa1ceee179bedc505b6
5
5
  SHA512:
6
- metadata.gz: 6f3510d3b8eec8491db05af3117a9877fe40f56ce317f4f90c88bb0bf4289114d54de9a762c99c5374ba937faa971cccb87bedbe252f99f4063f78eeb4488ccc
7
- data.tar.gz: 3e75f31d44050bc2e62f3470b512d8439295e9ca5cbabf7a8e5f3bb2a07648d96bb9f720f3bd1f1a54b764b6109ee77c7c70432b813ac4c6a69c5396a22cf517
6
+ metadata.gz: 17e97ccc4e0fa09785bd82215ab70b98c8308b2595cba1fff7a7c773369f0f6ae1df2489327b295adebe04a610b16cca0bdfe33febf59d876efa17d06b1faa90
7
+ data.tar.gz: 8faa04548d1bc4f5aab466fa3871d8f4787a967e3468a211c0ec1f5fa4b93d3260531ef7e93278a63b0339e5f035d523ad4e8f6bb296f14577abfc7a380dc92e
data/README.md CHANGED
@@ -9,6 +9,14 @@ This library is an implementation of [Pushbullet API](https://docs.pushbullet.co
9
9
 
10
10
  Feel free to contribute :smile:
11
11
 
12
+ **NOTE: This is not production ready (yet).**
13
+
14
+ ## Installation
15
+
16
+ ```
17
+ gem install ruby-pushbullet
18
+ ```
19
+
12
20
  ## Configuration
13
21
 
14
22
  You can get your api token from [Account Settings](https://www.pushbullet.com/account)
@@ -1,5 +1,13 @@
1
1
  module Pushbullet
2
2
  class Push < Resource
3
- PATH = 'pushes'
3
+
4
+ def self.create(type, iden, payload)
5
+ id = iden[/.@.?/].nil? ? :device_iden : :email
6
+ super(payload.merge(type: type, id => iden))
7
+ end
8
+
9
+ def self.path
10
+ 'pushes'
11
+ end
4
12
  end
5
13
  end
@@ -2,26 +2,19 @@ module Pushbullet
2
2
  module Pushable
3
3
 
4
4
  def push_note(title, body)
5
- push :note, target_id, title: title, body: body
5
+ Push.create :note, target_id, title: title, body: body
6
6
  end
7
7
 
8
8
  def push_link(title, url, body)
9
- push :link, target_id, title: title, url: url, body: body
9
+ Push.create :link, target_id, title: title, url: url, body: body
10
10
  end
11
11
 
12
12
  def push_address(name, address)
13
- push :address, target_id, name: name, address: address
13
+ Push.create :address, target_id, name: name, address: address
14
14
  end
15
15
 
16
16
  def push_list(title, items)
17
- push :list, target_id, title: title, items: items
18
- end
19
-
20
- private
21
-
22
- def push(type, iden, payload)
23
- id = iden[/.@.?/].nil? ? :device_iden : :email
24
- Push.create(payload.merge(type: type, id => iden))
17
+ Push.create :list, target_id, title: title, items: items
25
18
  end
26
19
  end
27
20
  end
@@ -1,10 +1,5 @@
1
1
  module Pushbullet
2
2
  class Resource < OpenStruct
3
- def self.path
4
- klass = self.is_a?(Class) ? self : self.class
5
- @path ||= "#{klass.to_s.demodulize.downcase}s"
6
- end
7
-
8
3
  def self.create(params)
9
4
  new Pushbullet.client.post(path, params)
10
5
  end
@@ -24,5 +19,10 @@ module Pushbullet
24
19
  Pushbullet.client.delete "#{self.class.path}/#{iden}"
25
20
  true
26
21
  end
22
+
23
+ def self.path
24
+ klass = self.is_a?(Class) ? self : self.class
25
+ @path ||= "#{klass.to_s.demodulize.downcase}s"
26
+ end
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-pushbullet
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Leitao