Class: Fbwish::Wisher
- Inherits:
-
Object
- Object
- Fbwish::Wisher
- Defined in:
- lib/fbwish.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
Returns the value of attribute graph.
-
#matcher ⇒ Object
Returns the value of attribute matcher.
-
#replies ⇒ Object
Returns the value of attribute replies.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
-
#wish_count ⇒ Object
Returns the value of attribute wish_count.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Wisher
constructor
A new instance of Wisher.
- #should_log? ⇒ Boolean
- #wish_em_all! ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Wisher
Returns a new instance of Wisher.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fbwish.rb', line 9 def initialize(={}) = [:access_token, :matcher, :replies, :wish_count] = .reject{ |key| [key] } unless .empty? raise ArgumentError, "Following options are required: #{.join(', ')}" end self.graph = Koala::Facebook::API.new([:access_token]) self.matcher = [:matcher] self.replies = [:replies] self.wish_count = [:wish_count] self.verbose = [:verbose] || false end |
Instance Attribute Details
#graph ⇒ Object
Returns the value of attribute graph.
7 8 9 |
# File 'lib/fbwish.rb', line 7 def graph @graph end |
#matcher ⇒ Object
Returns the value of attribute matcher.
7 8 9 |
# File 'lib/fbwish.rb', line 7 def matcher @matcher end |
#replies ⇒ Object
Returns the value of attribute replies.
7 8 9 |
# File 'lib/fbwish.rb', line 7 def replies @replies end |
#verbose ⇒ Object
Returns the value of attribute verbose.
7 8 9 |
# File 'lib/fbwish.rb', line 7 def verbose @verbose end |
#wish_count ⇒ Object
Returns the value of attribute wish_count.
7 8 9 |
# File 'lib/fbwish.rb', line 7 def wish_count @wish_count end |
Instance Method Details
#should_log? ⇒ Boolean
37 38 39 |
# File 'lib/fbwish.rb', line 37 def should_log? verbose end |
#wish_em_all! ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fbwish.rb', line 24 def wish_em_all! wishes = nil iteration_count = (wish_count.to_f / 25).ceil 1.upto(iteration_count) do |idx| wishes = wishes.next_page rescue graph.get_connections('me', 'feed') wishes.each do |wish| like_and_comment(wish) end end end |