Class: Pling::Message
- Inherits:
-
Object
- Object
- Pling::Message
- Defined in:
- lib/pling/message.rb
Instance Attribute Summary collapse
-
#badge ⇒ Object
The message badge - not supported by all gateways.
-
#body ⇒ Object
The message body.
-
#category ⇒ Object
The category property - not supported by all gateways.
-
#content_available ⇒ Object
The content_available property - not supported by all gateways.
-
#payload ⇒ Object
The message payload - not supported by all gateways.
-
#sound ⇒ Object
The message sound - not supported by all gateways.
-
#subject ⇒ Object
The message subject - not supported by all gateways.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Message
constructor
Creates a new Pling::Message instance with the given body.
-
#to_pling_message ⇒ Pling::Message
Returns the object itself as it is already a Pling::Message.
-
#valid? ⇒ Boolean
A message is valid if it has a body.
Constructor Details
#initialize(body) ⇒ Message #initialize(attributes) ⇒ Message
Creates a new Pling::Message instance with the given body
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/pling/message.rb', line 100 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
#badge ⇒ Object #badge=(badge) ⇒ Object
The message badge - not supported by all gateways
35 36 37 |
# File 'lib/pling/message.rb', line 35 def badge @badge end |
#body ⇒ Object #body=(body) ⇒ Object
The message body
9 10 11 |
# File 'lib/pling/message.rb', line 9 def body @body end |
#category ⇒ Object #category= ⇒ Object
The category property - not supported by all gateways
85 86 87 |
# File 'lib/pling/message.rb', line 85 def category @category end |
#content_available ⇒ Object #content_available= ⇒ Object
The content_available property - not supported by all gateways
73 74 75 |
# File 'lib/pling/message.rb', line 73 def content_available @content_available end |
#payload ⇒ Object #payload=(sound) ⇒ Object
The message payload - not supported by all gateways
61 62 63 |
# File 'lib/pling/message.rb', line 61 def payload @payload end |
#sound ⇒ Object #sound=(sound) ⇒ Object
The message sound - not supported by all gateways
48 49 50 |
# File 'lib/pling/message.rb', line 48 def sound @sound end |
#subject ⇒ Object #subject=(subject) ⇒ Object
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
#to_pling_message ⇒ Pling::Message
Returns the object itself as it is already a Pling::Message.
128 129 130 |
# File 'lib/pling/message.rb', line 128 def self end |
#valid? ⇒ Boolean
A message is valid if it has a body.
120 121 122 |
# File 'lib/pling/message.rb', line 120 def valid? !!body end |