Created
October 21, 2011 13:03
-
-
Save byroot/1303791 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To launch the test: | |
| $ gem install bundler | |
| $ bundle install | |
| $ bundle exec bin/test_upload.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A sample Gemfile | |
| source "http://rubygems.org" | |
| gem "koala", '1.2.1' | |
| gem 'json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GEM | |
| remote: http://rubygems.org/ | |
| specs: | |
| addressable (2.2.6) | |
| faraday (0.7.5) | |
| addressable (~> 2.2.6) | |
| multipart-post (~> 1.1.3) | |
| rack (>= 1.1.0, < 2) | |
| json (1.5.2) | |
| koala (1.2.1) | |
| faraday (~> 0.7.0) | |
| multi_json (~> 1.0) | |
| multi_json (1.0.3) | |
| multipart-post (1.1.3) | |
| rack (1.3.5) | |
| PLATFORMS | |
| ruby | |
| DEPENDENCIES | |
| json | |
| koala (= 1.2.1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'pp' | |
| require 'koala' | |
| require 'json' | |
| access_token = 'AAADUIlHSiPoBAG49TXMeAC47X5xn6BwWObzRK4TKwGacyTNJXwZBkqZBRxnT8LnZBqOOTL0YCjbBPQoRlubi6SIarb0FwkZD' | |
| page_id = '161768787251555' | |
| album_id = '162605180501249' | |
| url = 'http://asset-staging.tigerlilyapps.com/images/5910' | |
| graph = Koala::Facebook::GraphAPI.new(access_token) | |
| graph.get_object(page_id) | |
| page_token = graph.get_object(page_id, :fields => "access_token")["access_token"] | |
| page_graph = Koala::Facebook::API.new(page_token) | |
| print 'upload image ' | |
| image_id = page_graph.put_picture(url, {:message => "Hello from my test app !"}, album_id)['id'] | |
| puts image_id | |
| puts 'sleep 5' | |
| sleep 5 | |
| puts 'delete image' | |
| pp page_graph.delete_object(image_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment