Class: Pling::Message
- Inherits:
-
Object
- Object
- Pling::Message
- Defined in:
- lib/pling/message.rb
Instance Attribute Summary (collapse)
-
- (Object) badge
The message badge - not supported by all gateways.
-
- (Object) body
The message body.
-
- (Object) payload
The message payload - not supported by all gateways.
-
- (Object) sound
The message sound - not supported by all gateways.
-
- (Object) subject
The message subject - not supported by all gateways.
Instance Method Summary (collapse)
-
- (Message) initialize(*args)
constructor
Creates a new Pling::Message instance with the given body.
-
- (Pling::Message) to_pling_message
Returns the object itself as it is already a Pling::Message.
-
- (Boolean) valid?
A message is valid if it has a body.
Constructor Details
- (Message) initialize(body) - (Message) initialize(attributes)
Creates a new Pling::Message instance with the given body
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/pling/message.rb', line 76 def initialize(*args) attributes = case param = args.shift when String (args.last || {}).merge(:body => param) when Hash param else {} end attributes.each_pair do |key, value| method = "#{key}=" send(method, value) if respond_to?(method) end end |
Instance Attribute Details
- (Object) badge - (Object) badge=(badge)
The message badge - not supported by all gateways
35 36 37 |
# File 'lib/pling/message.rb', line 35 def badge @badge end |
- (Object) body - (Object) body=(body)
The message body
9 10 11 |
# File 'lib/pling/message.rb', line 9 def body @body end |
- (Object) payload - (Object) payload=(sound)
The message payload - not supported by all gateways
61 62 63 |
# File 'lib/pling/message.rb', line 61 def payload @payload end |
- (Object) sound - (Object) sound=(sound)
The message sound - not supported by all gateways
48 49 50 |
# File 'lib/pling/message.rb', line 48 def sound @sound end |
- (Object) subject - (Object) subject=(subject)
The message subject - not supported by all gateways
22 23 24 |
# File 'lib/pling/message.rb', line 22 def subject @subject end |
Instance Method Details
- (Pling::Message) to_pling_message
Returns the object itself as it is already a Pling::Message.
104 105 106 |
# File 'lib/pling/message.rb', line 104 def self end |
- (Boolean) valid?
A message is valid if it has a body.
96 97 98 |
# File 'lib/pling/message.rb', line 96 def valid? !!body end |