Class: Invity::Facebook::Message
- Inherits:
-
Object
- Object
- Invity::Facebook::Message
- Defined in:
- lib/invity/message.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#body ⇒ Object
Returns the value of attribute body.
-
#reciever ⇒ Object
Returns the value of attribute reciever.
-
#recievers ⇒ Object
Returns the value of attribute recievers.
-
#sender ⇒ Object
Returns the value of attribute sender.
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
- #deliver(opt = nil) ⇒ Object
- #deliver_all ⇒ Object
- #deliver_all_as_delayed ⇒ Object
- #deliver_as_delayed ⇒ Object
- #deliver_each ⇒ Object
-
#initialize(options = {}) ⇒ Message
constructor
A new instance of Message.
-
#perform ⇒ Object
SPECIAL METHOD USED BY DELAYED-JOBS.
Constructor Details
#initialize(options = {}) ⇒ Message
Returns a new instance of Message.
6 7 8 9 10 |
# File 'lib/invity/message.rb', line 6 def initialize( = {}) [:sender, :recievers, :subject, :body, :access_token].each { |w| send("#{w}=", [w]) } end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/invity/message.rb', line 4 def access_token @access_token end |
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/invity/message.rb', line 4 def body @body end |
#reciever ⇒ Object
Returns the value of attribute reciever.
4 5 6 |
# File 'lib/invity/message.rb', line 4 def reciever @reciever end |
#recievers ⇒ Object
Returns the value of attribute recievers.
4 5 6 |
# File 'lib/invity/message.rb', line 4 def recievers @recievers end |
#sender ⇒ Object
Returns the value of attribute sender.
4 5 6 |
# File 'lib/invity/message.rb', line 4 def sender @sender end |
#subject ⇒ Object
Returns the value of attribute subject.
4 5 6 |
# File 'lib/invity/message.rb', line 4 def subject @subject end |
Instance Method Details
#deliver(opt = nil) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/invity/message.rb', line 16 def deliver(opt = nil) case opt when :all then deliver_all when :all_delayed then deliver_all_as_delayed when :delayed then deliver_as_delayed else; deliver_each end end |
#deliver_all ⇒ Object
25 26 27 28 29 |
# File 'lib/invity/message.rb', line 25 def deliver_all friends.each { |f| self.reciever = f; chat } end |
#deliver_all_as_delayed ⇒ Object
31 32 33 34 35 36 |
# File 'lib/invity/message.rb', line 31 def deliver_all_as_delayed friends.each { |f| self.reciever = f Delayed::Job.enqueue self } end |
#deliver_as_delayed ⇒ Object
38 39 40 41 42 43 |
# File 'lib/invity/message.rb', line 38 def deliver_as_delayed recievers.each { |f| self.reciever = f Delayed::Job.enqueue self } end |
#deliver_each ⇒ Object
45 46 47 48 49 |
# File 'lib/invity/message.rb', line 45 def deliver_each recievers.each { |f| self.reciever = f; chat } end |
#perform ⇒ Object
SPECIAL METHOD USED BY DELAYED-JOBS
12 13 14 |
# File 'lib/invity/message.rb', line 12 def perform # SPECIAL METHOD USED BY DELAYED-JOBS chat end |