Class: Esputnik::Channel
- Inherits:
-
Struct
- Object
- Struct
- Esputnik::Channel
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/esputnik/channel.rb
Instance Attribute Summary collapse
-
#device ⇒ Object
Returns the value of attribute device.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
-
#web_push_subscription ⇒ Object
Returns the value of attribute web_push_subscription.
Instance Method Summary collapse
Instance Attribute Details
#device ⇒ Object
Returns the value of attribute device
4 5 6 |
# File 'lib/esputnik/channel.rb', line 4 def device @device end |
#type ⇒ Object
Returns the value of attribute type
4 5 6 |
# File 'lib/esputnik/channel.rb', line 4 def type @type end |
#value ⇒ Object
Returns the value of attribute value
4 5 6 |
# File 'lib/esputnik/channel.rb', line 4 def value @value end |
#web_push_subscription ⇒ Object
Returns the value of attribute web_push_subscription
4 5 6 |
# File 'lib/esputnik/channel.rb', line 4 def web_push_subscription @web_push_subscription end |
Instance Method Details
#as_json ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/esputnik/channel.rb', line 13 def as_json self.class.members.each_with_object({}) do |method_name, h| value = public_send(method_name) value = value.as_json if value.respond_to? :as_json h[method_name.to_s.camelize(:lower)] = value if value.present? end end |