Class: PushbulletRuby::Ephemerable
- Inherits:
-
Object
- Object
- PushbulletRuby::Ephemerable
- Defined in:
- lib/pushbullet_ruby/ephemerable.rb,
lib/pushbullet_ruby/ephemerable/sms.rb,
lib/pushbullet_ruby/ephemerable/notifitation.rb
Direct Known Subclasses
Defined Under Namespace
Classes: MissingParameter, Notification, Sms
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#device_identifier ⇒ Object
readonly
Returns the value of attribute device_identifier.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#user_identifier ⇒ Object
readonly
Returns the value of attribute user_identifier.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(client, user_identifier, device_identifier, params) ⇒ Ephemerable
constructor
A new instance of Ephemerable.
- #push ⇒ Object
Constructor Details
#initialize(client, user_identifier, device_identifier, params) ⇒ Ephemerable
Returns a new instance of Ephemerable.
13 14 15 16 17 18 |
# File 'lib/pushbullet_ruby/ephemerable.rb', line 13 def initialize(client, user_identifier, device_identifier, params) @client = client @user_identifier = user_identifier @device_identifier = device_identifier @params = params end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/pushbullet_ruby/ephemerable.rb', line 7 def client @client end |
#device_identifier ⇒ Object (readonly)
Returns the value of attribute device_identifier.
7 8 9 |
# File 'lib/pushbullet_ruby/ephemerable.rb', line 7 def device_identifier @device_identifier end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
7 8 9 |
# File 'lib/pushbullet_ruby/ephemerable.rb', line 7 def params @params end |
#user_identifier ⇒ Object (readonly)
Returns the value of attribute user_identifier.
7 8 9 |
# File 'lib/pushbullet_ruby/ephemerable.rb', line 7 def user_identifier @user_identifier end |
Class Method Details
Instance Method Details
#push ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/pushbullet_ruby/ephemerable.rb', line 20 def push raise MissingParameter unless required_parameters.all? { |e| params.keys.include?(e) } payload = { type: type, push: params.merge(construct_payload(user_identifier, device_identifier)) } client.post('/v2/ephemerals', payload.to_json) end |