Module: Fbwish

Defined in:
lib/fbwish.rb,
lib/fbwish/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Instance Method Summary collapse

Instance Method Details

#initialize(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fbwish.rb', line 5

def initialize(options={})
  required_options = [:access_token, :matcher, :replies]
  unspecified_options = options.keys.reject{ |key| options[key] }

  unless unspecified_options.empty?
    raise ArgumentError("Following options are required: #{unspecified_options.join(', ')}")
  end

  self.graph = Koala::Facebook::API.new(options[:access_token])
  self.matcher = options[:matcher]
  self.replies = options[:replies]
end

#wish_em_all!Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fbwish.rb', line 18

def wish_em_all!
  wishes = nil

  1.upto(13) do |idx|
    wishes = wishes.next_page rescue graph.get_connections('me', 'feed')

    wishes.each do |wish|
      like_and_comment(wish)
    end
  end
end