pushbullet_ruby 1.0.3 → 1.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a0e06cea76b41d45aa865be349cf82153c535f3
4
- data.tar.gz: 5841c789ef3925c3baeacd399d91d0f1bf9ede5a
3
+ metadata.gz: 624004802f80deba5d371098d3300b1c5678a3f2
4
+ data.tar.gz: 826834858bdcd27ed636b3f0a0fa26df4e9c26f1
5
5
  SHA512:
6
- metadata.gz: 364433330836d920dbd7edc6f6e2ea37c9050fcbae37251d88729e1e3f222c81470c21e0eb54482714610d90b519b6bc938a29cb29b31ca7861b70998fe7d0ad
7
- data.tar.gz: c315781d3a2a1cae08cbc6552cfb0a8edebd33416fcb3b765d3da10dd17241501869358a77e51c03158da4591e2f829c24e5ed0a31cb46fc2749274ef5d2776f
6
+ metadata.gz: 8e2fbbffeed8809c3a120f86c028e867d18c64502f178f7d3215624ec36901ddd7fa7320c41da4703c2bdd0925edb9448ccd9416a6be51228a608f28b1cfcf3c
7
+ data.tar.gz: 8c01950e272d9a447f0d1855161b9b11fd3eb13a0f4f9ca56b16c98ea8a537e135c13f0abf0a15fe63e82f7fc0a83e48c5408efc728a5410f695da32c32a5544
data/README.md CHANGED
@@ -64,6 +64,17 @@ client.push_note(
64
64
  }
65
65
  )
66
66
  ```
67
+ ### Sms
68
+ ```ruby
69
+ client.sens_sms(
70
+ user_identifier: 'user id',
71
+ device_identifier: 'device id',
72
+ params: {
73
+ conversation_iden: 'target phone number',
74
+ message: 'Content'
75
+ }
76
+ )
77
+ ```
67
78
  ## Contributing
68
79
 
69
80
  Bug reports and pull requests are welcome on GitHub at https://github.com/creends/pushbullet_ruby.
@@ -0,0 +1,17 @@
1
+ module PushbulletRuby
2
+ module API
3
+ module Chats
4
+ def chats
5
+ PushbulletRuby::Chat.from_response(get('/v2/chats'))
6
+ end
7
+
8
+ def create_chat(params: {})
9
+ PushbulletRuby::Chat.new(post('/v2/chats', params).body)
10
+ end
11
+
12
+ def delete_chat(chat_id: nil)
13
+ delete("/v2/chats/#{chat_id}").body
14
+ end
15
+ end
16
+ end
17
+ end
@@ -5,12 +5,12 @@ require 'pushbullet_ruby/ephemerable/notifitation'
5
5
  module PushbulletRuby
6
6
  module API
7
7
  module Ephemerals
8
- def send_sms(user_identifier: nil, device_identifier: nil, params: {})
9
- PushbulletRuby::Ephemerable::Sms.push(self, user_identifier, device_identifier, params)
8
+ def send_sms(user_id: nil, device_id: nil, params: {})
9
+ PushbulletRuby::Ephemerable::Sms.push(self, user_id, device_id, params)
10
10
  end
11
11
 
12
- def push_notification(user_identifier: nil, device_identifier: nil, params: {})
13
- PushbulletRuby::Ephemerable::Notification.push(self, user_identifier, device_identifier, params)
12
+ def push_notification(user_id: nil, device_id: nil, params: {})
13
+ PushbulletRuby::Ephemerable::Notification.push(self, user_id, device_id, params)
14
14
  end
15
15
  end
16
16
  end
@@ -6,16 +6,16 @@ require 'pushbullet_ruby/pushable/file'
6
6
  module PushbulletRuby
7
7
  module API
8
8
  module Pushes
9
- def push_note(receiver: nil, device_identifier: nil, params: {})
10
- PushbulletRuby::Pushable::Note.push(self, receiver, device_identifier, params)
9
+ def push_note(receiver: nil, device_id: nil, params: {})
10
+ PushbulletRuby::Pushable::Note.push(self, receiver, device_id, params)
11
11
  end
12
12
 
13
- def push_link(receiver: nil, device_identifier: nil, params: {})
14
- PushbulletRuby::Pushable::Link.push(self, receiver, device_identifier, params)
13
+ def push_link(receiver: nil, device_id: nil, params: {})
14
+ PushbulletRuby::Pushable::Link.push(self, receiver, device_id, params)
15
15
  end
16
16
 
17
- def push_file(receiver: nil, device_identifier: nil, params: {})
18
- PushbulletRuby::Pushable::File.push(self, receiver, device_identifier, params)
17
+ def push_file(receiver: nil, device_id: nil, params: {})
18
+ PushbulletRuby::Pushable::File.push(self, receiver, device_id, params)
19
19
  end
20
20
 
21
21
  def pushes
@@ -4,6 +4,7 @@ require 'pushbullet_ruby/api/pushes'
4
4
  require 'pushbullet_ruby/api/ephemerals'
5
5
  require 'pushbullet_ruby/api/contacts'
6
6
  require 'pushbullet_ruby/api/subscriptions'
7
+ require 'pushbullet_ruby/api/chats'
7
8
 
8
9
  module PushbulletRuby
9
10
  module API
@@ -13,5 +14,6 @@ module PushbulletRuby
13
14
  include Ephemerals
14
15
  include Contacts
15
16
  include Subscriptions
17
+ include Chats
16
18
  end
17
19
  end
@@ -5,9 +5,9 @@ module PushbulletRuby
5
5
  attr_reader :body
6
6
 
7
7
  def self.from_response(response)
8
- response.body['subscriptions'].map do |attributes|
8
+ response.body['subscriptions'].each_with_object([]) do |attributes, memo|
9
9
  next unless attributes['active']
10
- new(attributes['channel'])
10
+ memo << new(attributes['channel'])
11
11
  end
12
12
  end
13
13
 
@@ -0,0 +1,16 @@
1
+ require 'pushbullet_ruby/entity'
2
+
3
+ module PushbulletRuby
4
+ class Chat < Entity
5
+ def self.from_response(response)
6
+ response.body['chats'].each_with_object([]) do |attributes, memo|
7
+ next unless attributes['active']
8
+ memo << new(attributes)
9
+ end
10
+ end
11
+
12
+ def id
13
+ body['iden']
14
+ end
15
+ end
16
+ end
@@ -1,11 +1,11 @@
1
- require 'pushbullet_ruby/entity'
1
+ require 'pushbullet_ruby/user'
2
2
 
3
3
  module PushbulletRuby
4
- class Contact < Entity
4
+ class Contact < User
5
5
  def self.from_response(response)
6
- response.body['contacts'].map do |attributes|
6
+ response.body['contacts'].each_with_object([]) do |attributes, memo|
7
7
  next unless attributes['active']
8
- new(attributes)
8
+ memo << new(attributes)
9
9
  end
10
10
  end
11
11
 
@@ -3,9 +3,9 @@ require 'pushbullet_ruby/entity'
3
3
  module PushbulletRuby
4
4
  class Device < Entity
5
5
  def self.from_responce(response)
6
- response.body['devices'].map do |attributes|
6
+ response.body['devices'].each_with_object([]) do |attributes, memo|
7
7
  next unless attributes['active']
8
- new(attributes)
8
+ memo << new(attributes)
9
9
  end
10
10
  end
11
11
 
@@ -3,9 +3,9 @@ require 'pushbullet_ruby/entity'
3
3
  module PushbulletRuby
4
4
  class Push < Entity
5
5
  def self.from_response(response)
6
- response.body['pushes'].map do |attributes|
6
+ response.body['pushes'].each_with_object([]) do |attributes, memo|
7
7
  next unless attributes['active']
8
- new(attributes)
8
+ memo << new(attributes)
9
9
  end
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module PushbulletRuby
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -1,11 +1,12 @@
1
- require 'pushbullet_ruby/client'
2
- require 'pushbullet_ruby/user'
3
- require 'pushbullet_ruby/device'
4
- require 'pushbullet_ruby/pushable'
5
- require 'pushbullet_ruby/ephemerable'
6
- require 'pushbullet_ruby/contact'
7
- require 'pushbullet_ruby/channel'
8
- require 'pushbullet_ruby/token'
9
-
10
- module PushbulletRuby
11
- end
1
+ require 'pushbullet_ruby/client'
2
+ require 'pushbullet_ruby/user'
3
+ require 'pushbullet_ruby/device'
4
+ require 'pushbullet_ruby/pushable'
5
+ require 'pushbullet_ruby/ephemerable'
6
+ require 'pushbullet_ruby/contact'
7
+ require 'pushbullet_ruby/channel'
8
+ require 'pushbullet_ruby/token'
9
+ require 'pushbullet_ruby/chat'
10
+
11
+ module PushbulletRuby
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushbullet_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - creends
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-19 00:00:00.000000000 Z
11
+ date: 2016-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,6 +79,7 @@ files:
79
79
  - Rakefile
80
80
  - lib/pushbullet_ruby.rb
81
81
  - lib/pushbullet_ruby/api.rb
82
+ - lib/pushbullet_ruby/api/chats.rb
82
83
  - lib/pushbullet_ruby/api/contacts.rb
83
84
  - lib/pushbullet_ruby/api/devices.rb
84
85
  - lib/pushbullet_ruby/api/ephemerals.rb
@@ -87,6 +88,7 @@ files:
87
88
  - lib/pushbullet_ruby/api/subscriptions.rb
88
89
  - lib/pushbullet_ruby/authorization.rb
89
90
  - lib/pushbullet_ruby/channel.rb
91
+ - lib/pushbullet_ruby/chat.rb
90
92
  - lib/pushbullet_ruby/client.rb
91
93
  - lib/pushbullet_ruby/contact.rb
92
94
  - lib/pushbullet_ruby/device.rb