Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added proof of concept that post to fb wall works

  • Loading branch information...
commit e540d7f0522747a2bf297adf385dcec394b1944e 1 parent cae188e
@marcinbunsch marcinbunsch authored
Showing with 22 additions and 1 deletion.
  1. +2 −1  .gitignore
  2. +1 −0  broadcast.gemspec
  3. +19 −0 facebook_test/fb_test.rb
View
3  .gitignore
@@ -6,4 +6,5 @@ sandbox
*.log
coverage
bin
-.rspec
+.rspec
+facebook_test/config.yml
View
1  broadcast.gemspec
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
s.add_dependency 'mail'
s.add_dependency 'broach'
s.add_dependency 'shout-bot'
+ s.add_dependency 'koala'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
View
19 facebook_test/fb_test.rb
@@ -0,0 +1,19 @@
+require 'rubygems'
+require 'bundler/setup'
+require 'koala'
+require 'yaml'
+
+config = YAML.load_file(File.join(File.dirname(__FILE__), 'config.yml'))
+
+def post_to_page_wall(message, token, page_name)
+ graph = Koala::Facebook::GraphAPI.new(token)
+ me = graph.get_object('me')
+ raise 'User not found' if !me
+ connections = graph.get_connections(me['id'], 'accounts')
+ page = connections.find { |connection| connection['name'] == page_name }
+ raise 'Page not found' if !page
+ page_graph = Koala::Facebook::GraphAPI.new(page['access_token'])
+ page_graph.put_wall_post(message)
+end
+
+post_to_page_wall("Foo oh yeah 1234", config['token'], config['page'])
Please sign in to comment.
Something went wrong with that request. Please try again.