Class: Opium::Push
- Includes:
- Model::Connectable
- Defined in:
- lib/opium/push.rb
Instance Attribute Summary collapse
-
#channels ⇒ Object
Returns the value of attribute channels.
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #alert ⇒ Object
- #alert=(value) ⇒ Object
- #create ⇒ Object
-
#initialize(attributes = {}) ⇒ Push
constructor
A new instance of Push.
Constructor Details
#initialize(attributes = {}) ⇒ Push
Returns a new instance of Push.
7 8 9 10 |
# File 'lib/opium/push.rb', line 7 def initialize( attributes = {} ) self.channels = [] self.data = {}.with_indifferent_access end |
Instance Attribute Details
#channels ⇒ Object
Returns the value of attribute channels.
12 13 14 |
# File 'lib/opium/push.rb', line 12 def channels @channels end |
#data ⇒ Object
Returns the value of attribute data.
12 13 14 |
# File 'lib/opium/push.rb', line 12 def data @data end |
Instance Method Details
#alert ⇒ Object
14 15 16 |
# File 'lib/opium/push.rb', line 14 def alert data[:alert] end |
#alert=(value) ⇒ Object
18 19 20 |
# File 'lib/opium/push.rb', line 18 def alert=( value ) self.data[:alert] = value end |
#create ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/opium/push.rb', line 22 def create fail ArgumentError, 'No channels were specified!' if channels.empty? self.class.as_resource(:push) do result = self.class.http_post post_data result[:result] end end |