GithubHelp home page GithubHelp logo

arsduo / koala Goto Github PK

View Code? Open in Web Editor NEW
3.6K 91.0 468.0 7.27 MB

A lightweight Facebook library supporting the Graph, Marketing, and Atlas APIs, realtime updates, test users, and OAuth.

Home Page: http://developers.facebook.com/

License: MIT License

Ruby 100.00%
facebook ruby ruby-on-rails social-network

koala's Introduction

Koala Version Build Status Code Climate Code Coverage

Koala is a Facebook library for Ruby, supporting the Graph API (including the batch requests and photo uploads), the Marketing API, the Atlas API, realtime updates, test users, and OAuth validation. We wrote Koala with four goals:

  • Lightweight: Koala should be as light and simple as Facebook’s own libraries, providing API accessors and returning simple JSON.
  • Fast: Koala should, out of the box, be quick. Out of the box, we use Facebook's faster read-only servers when possible and if available, the Typhoeus gem to make snappy Facebook requests. Of course, that brings us to our next topic:
  • Flexible: Koala should be useful to everyone, regardless of their current configuration. We support all currently-supported Ruby versions (MRI 2.1-2.4) and Koala should work on JRuby and Rubinius.
  • Tested: Koala should have complete test coverage, so you can rely on it. Our test coverage is complete and can be run against either mocked responses or the live Facebook servers; we're also on Travis CI.

Found a bug? Interested in contributing? Check out the Maintenance section below!

Installation

Koala 3.0 is out! There should be no significant changes for most users. If you encounter any problems, please file an issue and I'll take a look.

In Bundler:

gem "koala"

Otherwise:

[sudo|rvm] gem install koala

Configuration

Most applications will only use one application configuration. Rather than having to provide that value every time, you can configure Koala to use global settings:

# In Rails, you could put this in config/initializers/koala.rb
Koala.configure do |config|
  config.access_token = MY_TOKEN
  config.app_access_token = MY_APP_ACCESS_TOKEN
  config.app_id = MY_APP_ID
  config.app_secret = MY_APP_SECRET
  # See Koala::Configuration for more options, including details on how to send requests through
  # your own proxy servers.
end

Note: this is not currently threadsafe. (PRs welcome as long as they support both threaded and non-threaded configuration.)

Graph API

The Graph API is the interface to Facebook's data. Using it with Koala is quite straightforward. First, you'll need an access token, which you can get through Facebook's Graph API Explorer (click on 'Get Access Token').

Then, go exploring:

require 'koala'

# access_token and other values aren't required if you set the defaults as described above
@graph = Koala::Facebook::API.new(access_token)

profile = @graph.get_object("me")
friends = @graph.get_connections("me", "friends")
@graph.put_connections("me", "feed", message: "I am writing on my wall!")

# Three-part queries are easy too!
@graph.get_connections("me", "mutualfriends/#{friend_id}")

# You can use the Timeline API:
# (see https://developers.facebook.com/docs/beta/opengraph/tutorial/)
@graph.put_connections("me", "namespace:action", object: object_url)

# For extra security (recommended), you can provide an appsecret parameter,
# tying your access tokens to your app secret.
# (See https://developers.facebook.com/docs/reference/api/securing-graph-api/

# You may need to turn on 'Require proof on all calls' in the advanced section
# of your app's settings when doing this.
@graph = Koala::Facebook::API.new(access_token, app_secret)

# Facebook is now versioning their API. # If you don't specify a version, Facebook
# will default to the oldest version your app is allowed to use.
# See https://developers.facebook.com/docs/apps/versions for more information.
#
# You can specify version either globally:
Koala.config.api_version = "v2.0"
# or on a per-request basis
@graph.get_object("me", {}, api_version: "v2.0")

The response of most requests is the JSON data returned from the Facebook servers as a Hash.

When retrieving data that returns an array of results (for example, when calling API#get_connections or API#search) a GraphCollection object will be returned, which makes it easy to page through the results:

# Returns the feed items for the currently logged-in user as a GraphCollection
feed = @graph.get_connections("me", "feed")
feed.each {|f| do_something_with_item(f) } # it's a subclass of Array
next_feed = feed.next_page

# You can also get an array describing the URL for the next page: [path, arguments]
# This is useful for storing page state across multiple browser requests
next_page_params = feed.next_page_params
page = @graph.get_page(next_page_params)

You can also make multiple calls at once using Facebook's batch API:

# Returns an array of results as if they were called non-batch
@graph.batch do |batch_api|
  batch_api.get_object('me')
  batch_api.put_wall_post('Making a post in a batch.')
end

You can pass a "post-processing" block to each of Koala's Graph API methods. This is handy for two reasons:

  1. You can modify the result returned by the Graph API method:

     education = @graph.get_object("me") { |data| data['education'] }
     # returned value only contains the "education" portion of the profile
    
  2. You can consume the data in place which is particularly useful in the batch case, so you don't have to pull the results apart from a long list of array entries:

     @graph.batch do |batch_api|
       # Assuming you have database fields "about_me" and "photos"
       batch_api.get_object('me')                {|me|     self.about_me = me }
       batch_api.get_connections('me', 'photos') {|photos| self.photos   = photos }
     end
    

Check out the wiki for more details and examples.

App Access Tokens

You get your application's own access token, which can be used without a user session for subscriptions and certain other requests:

@oauth = Koala::Facebook::OAuth.new(app_id, app_secret, callback_url)
@oauth.get_app_access_token

For those building apps on Facebook, parsing signed requests is simple:

@oauth.parse_signed_request(signed_request_string)

The OAuth class has additional methods that may occasionally be useful.

Real-time Updates

Sometimes, reaching out to Facebook is a pain -- let it reach out to you instead. The Graph API allows your application to subscribe to real-time updates for certain objects in the graph; check the official Facebook documentation for more details on what objects you can subscribe to and what limitations may apply.

Koala makes it easy to interact with your applications using the RealtimeUpdates class:

# This class also supports the defaults as described above
@updates = Koala::Facebook::RealtimeUpdates.new(app_id: app_id, secret: secret)

You can do just about anything with your real-time update subscriptions using the RealtimeUpdates class:

# Add/modify a subscription to updates for when the first_name or last_name fields of any of your users is changed
@updates.subscribe("user", "first_name, last_name", callback_url, verify_token)

# Get an array of your current subscriptions (one hash for each object you've subscribed to)
@updates.list_subscriptions

# Unsubscribe from updates for an object
@updates.unsubscribe("user")

And to top it all off, RealtimeUpdates provides a static method to respond to Facebook servers' verification of your callback URLs:

# Returns the hub.challenge parameter in params if the verify token in params matches verify_token
Koala::Facebook::RealtimeUpdates.meet_challenge(params, your_verify_token)

For more information about meet_challenge and the RealtimeUpdates class, check out the Real-Time Updates page on the wiki.

Rate limits

We support Facebook rate limit informations as defined here: https://developers.facebook.com/docs/graph-api/overview/rate-limiting/

The information is available either via the Facebook::APIError:

error.fb_buc_usage
error.fb_ada_usage
error.fb_app_usage

Or with the rate_limit_hook:

# App level configuration

Koala.configure do |config|
  config.rate_limit_hook = ->(limits) { 
    limits["x-app-usage"] # {"call_count"=>0, "total_cputime"=>0, "total_time"=>0}
    limits["x-ad-account-usage"] # {"acc_id_util_pct"=>9.67}
    limits["x-business-use-case-usage"] # {"123456789012345"=>[{"type"=>"messenger", "call_count"=>1, "total_cputime"=>1, "total_time"=>1, "estimated_time_to_regain_access"=>0}]}
  }
end

# Per API configuration

Koala::Facebook::API.new('', '', ->(limits) {})

Test Users

We also support the test users API, allowing you to conjure up fake users and command them to do your bidding using the Graph API:

# This class also supports the defaults as described above
@test_users = Koala::Facebook::TestUsers.new(app_id: id, secret: secret)
user = @test_users.create(is_app_installed, desired_permissions)
user_graph_api = Koala::Facebook::API.new(user["access_token"])
# or, if you want to make a whole community:
@test_users.create_network(network_size, is_app_installed, common_permissions)

Talking to Facebook

Koala uses Faraday to make HTTP requests, which means you have complete control over how your app makes HTTP requests to Facebook. You can set Faraday options globally or pass them in on a per-request (or both):

# Set an SSL certificate to avoid Net::HTTP errors
Koala.http_service.http_options = {
  ssl: { ca_path: "/etc/ssl/certs" }
}
# or on a per-request basis
@api.get_object(id, args_hash, { request: { timeout: 10 } })

The HTTP Services wiki page has more information on what options are available, as well as on how to configure your own Faraday middleware stack (for instance, to implement request logging).

See examples, ask questions

Some resources to help you as you play with Koala and the Graph API:

  • Complete Koala documentation on the wiki
  • Facebook's Stack Overflow site is a stupendous place to ask questions, filled with people who will help you figure out what's up with the Facebook API.
  • Facebook's Graph API Explorer, where you can play with the Graph API in your browser

Testing

Unit tests are provided for all of Koala's methods. By default, these tests run against mock responses and hence are ready out of the box:

# From anywhere in the project directory:
bundle exec rake spec

You can also run live tests against Facebook's servers:

# Again from anywhere in the project directory:
LIVE=true bundle exec rake spec
# you can also test against Facebook's beta tier
LIVE=true BETA=true bundle exec rake spec

By default, the live tests are run against test users, so you can run them as frequently as you want. If you want to run them against a real user, however, you can fill in the OAuth token, code, and access_token values in spec/fixtures/facebook_data.yml. See the wiki for more details.

Maintenance

Pull requests: Koala exists as it does thanks to the amazing support and work of community members of all backgrounds and levels of experience. Pull requests are very welcome!

Issues: If you have any questions about the gem, found an issue in the Ruby code or documentation, or have another question that isn't right for StackOverflow, just open an issue and fill out the template.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See code_of_conduct.md for more information.

koala's People

Contributors

amrnt avatar arsduo avatar binarygeek avatar bnorton avatar chadk avatar danteoh avatar dwkns avatar eckz avatar etiennebarrie avatar gacha avatar imajes avatar jayeff avatar jbender avatar jch avatar joshk avatar kbighorse avatar kentonwhite avatar lsimoneau avatar marcgg avatar morgoth avatar mwpastore avatar nchelluri avatar pawandubey avatar petergoldstein avatar rjacoby avatar romanbsd avatar sanemat avatar seejohnrun avatar waynn avatar ylecuyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

koala's Issues

Test user befriend broken?

It appears that the api call to befriend test users needs the access token of the first user in the URL. Currently Koala uses the app-based access token and the calls fail. Also, it currently does a GET on the URL but a POST is needed.

Here is the current code:
def befriend(user1, user2)
user1 = user1["id"] if user1.is_a?(Hash)
user2 = user2["id"] if user2.is_a?(Hash)
@graph_api.graph_call("/#{user1}/friends/#{user2}") && @graph_api.graph_call("/#{user2}/friends/#{user1}")
end

This is how I modified it to make it work:
def befriend(user1, user2)
api = Koala::Facebook::GraphAPI.new(user1["access_token"])
begin
api.graph_call("/#{user1["id"]}/friends/#{user2["id"]}", {}, "post")
rescue APIError => e
unless e.message =~ /#520/ # already made friend request
return if e.message =~ /#522/ # already friends
raise e
end
end
api = Koala::Facebook::GraphAPI.new(user2["access_token"])
begin
api.graph_call("/#{user2["id"]}/friends/#{user1["id"]}", {}, "post")
rescue APIError => e
raise e unless e.message =~ /#522/ # already friends
end
end

Not sure if my version is appropriate for Koala since it has some custom error handling and expects users to be hashes instead of ids.

Error validating verification code

I suceeded with a testing facebook app (http://testfb.heroku.com/), in using almost exactly the same code (keys, urls and secrets exchanged) And I get the following error when acting on the returned verification code...

Koala::Facebook::APIError (OAuthException: Error validating verification code.):
then a file stack, pointing back to:

@graph = Koala::Facebook::GraphAPI.new(@oauth.get_access_token(session[:code]))
(the @oauth object created without issue)

I have no idea where I can chase this down.

OAuthException: same exact issue as issue #26

I posted a comment on issue #26 -- Koala is giving an OAuth exception even though the access token I have is functional both on the web and in the Rails console.

Is there any more information about this issue? Has it been solved or looked into or is it most likely something wrong on my end? Thank you!

Rails 3 file uploads fails

Passing in ActionDispatch::Http::UploadedFile to koala.put_picture(uploadedFile) fails with exception
"Invalid arguments to initialize an UploadableIO".

After inspecting the rails UploadedFile it seems it does not contain a "path" property and the check at line 45 on UploadableIO class fails.

Thanks!

options never reaches make_request

I just realized that every path that calls 'make_request' never uses any options hash, it's impossible to use :typhoeus_options or the patch I made for timeout and proxy.

Documentation typo

A small typo in your documentation that threw me. In the OAuth section of your readme you say:

@oauth = Koala::Facebook::OAuth.new(app_id, code, callback_url)

Which then allows you to do:

@oauth.get_access_token( code )

The OAuth.new should actually take (app_id, app_secret, callback_url). When I switched out code for secret, then I was able to do the second call w/o an error.

Problem with @graph.put_like

On @graph.put_like("7204941866_117111188317384") I always get an error - Koala::Facebook::APIError: OAuthException: (#210) User not visible

But @graph.put_wall_post("hey, i'm learning kaola") is works.

get_connections("me", "picture") doesn't work

Facebook's "picture" connection should get the user's picture. Unfortunately, they do that by redirecting the request to the picture, not returning the URL as JSON. This totally blindsides Koala, and so it returns nil rather than chasing the redirect. We need to special-case either "pictures" or that kind of redirect to return the redirected URL.

NoMethodError when calling parse_signed_request

I am using koala's new feature: @auth.parse_signed_request .
But i think something wrong.
I found following error when i call the method:

NoMethodError (private method split' called for #<ActionController::Request:0x1037e0488>): /opt/local/lib/ruby/gems/1.8/gems/koala-1.0.0.beta/lib/koala.rb:216:inparse_signed_request'

Question:

When I get a graph object and print it to a text file I get something like this:

{
  "name": "Gonzalo Rodriguez-Baltanas",
  "timezone": 2,
  "gender": "male",
  "id": "100000024399383",
  "about": "Erasmus :)",
  "last_name": "Rodriguez-Baltanas",
  "updated_time": "2011-03-23T03:09:34+0000",
  "verified": true,
  "locale": "es_ES",
  "link": "http://www.facebook.com/profile.php?id=100000024399383",
  "education": [
    {
      "school": {
        "name": "Universidad Pablo de Olavide",
        "id": "102024426506188"
      },
      "concentration": [
        {
          "name": "ITIG",
          "id": "193736437317949"
        }
      ],
      "type": "College",
      "year": {
        "name": "2009",
        "id": "136328419721520"
      }
    },
    {
      "school": {
        "name": "Alminar",
        "id": "102096309831591"
      },
      "type": "High School",
      "year": {
        "name": "2005",
        "id": "138383069535219"
      }
    }
  ],
  "first_name": "Gonzalo"
}

Which is exactly what I want. But when I get a connection and print it to a text file I get this:

nameJessica Cifreid502913330nameJoaquín Valdellós Ariasid512276363nameGege Xuid513971163nameElisabeth Heijmansid514324538nameRubén Visuerte Almagroid519030614nameMeri Olivellaid552327897nameGiuseppe Vidalid558322771nameFernando Sotomayorid563370284nameAlejandro Gaitan Barrientosid570494003nameManuel Pacoid571084353nameCheringan Delgado Perezid571982295nameJoseph MorMarid572099620nameJosé Vázquez Infantesid614851132nameLydia Amoresid633576820nameOscar Fleitas van Aggelenid645032118nameVíctor López Velázquezid663769294namePatry Lopezid682226816 ....

Which is not what I wanted.

The line that save the file for the first file is:

File.open("#{RAILS_ROOT}/tmp/export/profile.txt", 'w') {|f| f.write(JSON.pretty_generate(graph.get_object('me'))) }

And this is for the second:

File.open("#{RAILS_ROOT}/tmp/export/friends.txt", 'w') {|f| f.write(graph.get_connections('me','friends')) }

If I try to do a JSON.pretty_generate in this last line I get an exception:

NoMethodError (undefined method `merge' for #<JSON::Ext::Generator::State:0x7f7064a6b220>):

So my question is, how can I get the same output, JSON, for the connection?

It would be nice if mock http server was available to koala's users

Hey Alex,

I loved this gem and I am using it!

I thought it would be good if instead of the mock class belong in the spec tree it would be organized within the koala's code so actual users of the gem could use it as an advantage to offline testing.

If this is something you think it is doable and a real benefit, I can help to refactor with some guidance from you.

Thanks.

Use of next_page on a GraphCollection seems broken, returns strange results

I think we need to build the params for the next_page from some kind of sane source, (eg the last request data, or sensible defaults, or a ), and generate decent request params, rather than wrangling some buggy values from facebook.

Probably not koalas fault, but have so far seen the client return the wrong number of pages, and generally performing strangely, and these are all symptoms I have observed so far.

Example:

page (p) has dozens of feed updates I need:

Mis-retrieval of a set:

irb(main)> cs = c.get_connections(p.page_id, 'feed', :limit => 10)
...
irb(main)> cs.size
=> 8

way wrong:

irb(main)> c.get_connections(p.page_id, 'feed', :limit => 100).size
=> 15 

this seems to be missing an offset:
also: "until"? Eh?

irb(main)> cs.next_page_params
=> [".../feed", {"limit"=>"10", "access_token"=>"...", "until"=>"2010-12-06T22:58:31+0000"}]

still wrong:

irb(main)> ds = cs.next_page
...
irb(main)> ds.size
=> 7

more bizarre 'until' fields, unbehest:

irb(main)> ds.next_page_params
 [".../feed", {"limit"=>"10", "access_token"=>"...", "until"=>"2010-10-21T19:57:27+0000"}]

finally:

irb(main)> es = ds.next_page
=> []
irb(main)> es.class
=> Koala::Facebook::GraphCollection
irb(main)> es.next_page_params
=> nil

Debugging:

Could this be a permissions issue? I don't see how it could be, all my dozens of posts are the same person, and the data does not appear in the "statuses" connection.

All very strange. Hope you can replicate.

#graph_call sometimes returns false

Hi,

I've just noticed a strange errors on my production server:
NoMethodError: undefined method `[]' for false:FalseClass
caused by the following lines:
user_data = graph.get_object(:me)
self.first_name = user_data["first_name"] # this line causes the error

When #graph_call method can actually return false?

BTW. I'm not using Typhoeus.

Gemspec file missing

Echoe deletes the gemspec file when it builds the gem; I need to change that behavior so the gemspec remains in the project.

Bad example in your readme

There is an error in your example :

graph = Koala::Facebook::GraphAPI.new(oauth_access_token)
profile = graph.get_object("me")
friends = graph.get_connection("me", "friends")
graph.put_object("me", "feed", :message => "I am writing on my wall!")

Check out the wiki for more examples.

friends = graph.get_connection("me", "friends")
should be
friends = graph.get_connections("me", "friends")

Note the 's' ;-)

Path missing leading forward-slash

In Koala::Facebook::API, the path created lacks a leading forward-slash "/". For example, the path "/method/fql.query" is formed as "method/fql.query"

The standard Net::HTTP library can correctly deal with the path missing the forward-slash. However it causes problems with some stubbing libraries such as FakeWeb and VCR, which expect the path to have the leading forward-slash.

It's debatable if this is an issue with Koala or the stubbing libraries. I looked at the definition for Net::HTTP and all examples given have a leading forward-slash, which is fairly typical usage.

Can't get app token

When I invoke @oauth.get_app_access_token_info I get following:
Koala::Facebook::APIError: OAuthException: Missing client_id parameter.
from /usr/lib/ruby/gems/1.8/gems/koala-0.10.0/lib/koala.rb:266:in get_token_from_server' from /usr/lib/ruby/gems/1.8/gems/koala-0.10.0/lib/koala.rb:202:inget_app_access_token_info'
from (irb):16

Am I doing sth wrong?

get_user_from_cookie does not properly parse cookie

I'm using this gem out of the box, calling:

@oauth = Koala::Facebook::OAuth.new(FACEBOOK_APP_ID, FACEBOOK_SECRET_CODE)    
user_data = @oauth.get_user_from_cookie(cookies)
puts "my cookies: #{cookies.inspect}"
puts "user data: #{user_data.inspect}"

I can see the fbs cookie in my cookies, but when i show the user_data, it's not what I would expect..

my cookies: {"fbs_160039450704873"=>""access_token=160033|2.MVeB91qxeS_QrtKcVsywkw__.3600.1290380400-704697|rm4zNBPO8UelY1uk&expires=1290380400&secret=Sknhn3hUfDTg__&session_key=2.MVeB91qxeS_QrtKcVsywkw__.3600.1290380400-704697&sig=ea963b5c41d288316c7a8112&uid=704697""}

user data: "704697"

Any thoughts?

Correct token produces "Koala::Facebook::APIError (OAuthException: Error validating application.)"

I use Koala together with Omniauth to integrate into Facebook. Omniauth works fine so far and after authenticating the user, it produces an access token in the "uid | code-code | code" format. Using this code in the browser via

 https://graph.facebook.com/me?access_token=... 

works fine. However, using this code (my_token) as follows

    g = Koala::Facebook::GraphAPI.new(urlescape(my_token))
    mylogger g.get_object("me")

produces

 Koala::Facebook::APIError (OAuthException: Error validating application.):
  koala (0.10.0) lib/koala/graph_api.rb:184:in `graph_call'
  koala (0.10.0) lib/koala.rb:77:in `api'
  koala (0.10.0) lib/koala/graph_api.rb:181:in `graph_call'
  koala (0.10.0) lib/koala/graph_api.rb:88:in `get_object'

Why is that ... can you please help?

Thank you!

Don't have fbs cookies in an iframe app.

I'm trying to follow the instructions in the tutorial, with a before_filter :parse_facebook_cookies. However it's always failing when it does Koala::Facebook::OAuth.new(id, secret).get_user_info_from_cookies(cookies)

When I look at cookies.inspect there is no fbs cookie there. This is for an iframe-based Facebook app. Can anyone tell me what I'm doing wrong here?

callback_token should be callback_url in the documentation

Very minor issue, but it was confusing at first.

The documentation says:
@updates.subscribe("user", "first_name, last_name", callback_token, verify_token)

The code says:
def subscribe(object, fields, callback_url, verify_token)

cheers

Investigate running live tests as test user, not real user

Right now the live tests are run on the current user's account, but we should investigate whether some to most of those test cases can run against test users from the OAuth Playground (or otherwise-specified app) instead. A few test cases may still have to run as the user, but we should be able to minimize them.

This would remove the occasional comments from people who see test posts appear and disappear on users' walls. (It'd also be a great chance to rewrite a lot of the wording on the test case titles to make them easier to read.)

OpenSSL Digest in Ruby 1.8.7 patch-level 253 (enterprise ruby)

In the enterprise ruby (1.8.7 patch-level 253) the OpenSSL Digest seems to have slightly changed. The line 231 in koala.rb which tries to do a hexdigest with sha256 fails with an error message that a string is given instead of a OpenSSL::Digest::Digest type. A similar problem is reported here (has nothing to do with koala):

http://stackoverflow.com/questions/3393849/typeerror-wrong-argument-string-expected-kind-of-openssldigestdigest

I am not sure yet how to make it compatible between the different ruby versions, but I will look into it and tell you if I find out.

NoMethodError when calling parse_signed_request method

I am using koala's new feature parse_signed_request method now.
BUT i think something wrong in this method.
When i use this method in my controller, i got the following error.

NoMethodError (private method split' called for #<ActionController::Request:0x1037e0488>): /opt/local/lib/ruby/gems/1.8/gems/koala-1.0.0.beta/lib/koala.rb:216:inparse_signed_request'

FQL query

Hi I'm not sure if this is the right place to ask this question, but I'm hoping to use this gem (love it so far, btw) to find all of the 'friends' of user X which are from the same network (or 'affiliations'). Any advice on how to do this? I couldn't find any examples of such a query in the documentation.

Thanks,
Mike

Rails 3 Bundle - Invalid gemspec file.

Excerpt from $ bundle update:

Using koala (0.9.0) from git://github.com/arsduo/koala.git (at master)
koala at /Library/Ruby/Gems/1.8/bundler/gems/koala-54bc69db664b did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
["examples/oauth_playground/Capfile", "examples/oauth_playground/LICENSE", "examples/oauth_playground/Rakefile", "examples/oauth_playground/config.ru", "examples/oauth_playground/config/deploy.rb", "examples/oauth_playground/config/facebook.yml", "examples/oauth_playground/lib/load_facebook.rb", "examples/oauth_playground/lib/oauth_playground.rb", "examples/oauth_playground/readme.md", "examples/oauth_playground/spec/oauth_playground_spec.rb", "examples/oauth_playground/spec/spec_helper.rb", "examples/oauth_playground/tmp/restart.txt", "examples/oauth_playground/views/index.erb", "examples/oauth_playground/views/layout.erb"] are not files

better way to handle facebook allow access?

you suggested that app should first redirect user to a page where they can click on the oauth url, which will consequently present facebook allow access page. is there anyway to directly go to the allow access page? the good old facebooker has the desired behavior. my attempt of using redirect_to :auth_url in welcomes_controller#index fails.

Unable to get checkins

trying to get checkins with with get_connections("me","checkins"), which should be the same as likes results in invalid token error

Application Access Tokens - OAuthException

This gem looks amazing, thank you!

I'm working to create an Application Access Token as discussed here: https://github.com/arsduo/koala/wiki/OAuth

Here's what I have in my controller:

@oauth = Koala::Facebook::OAuth.new
@oauth_token = @oauth.get_app_access_token
@graph = Koala::Facebook::GraphAPI.new(@oauth_token)
@fb = @graph.search('[email protected]', {:type => "user"})  

Problem is this errors with: OAuthException: An access token is required to request this resource

Suggestions? thanks

Update documentation for 1.0

Typhoeus file uploads (including ensuring curl is up to date)
Net::HTTP proxies and timeouts
(more to be added)

Error with RealtimeUpdates: need "app secret signed session"

Hello,

I'm using Koala 0.9.1 with Rails 3.0.1 and Ruby 1.8.7.
I set up Koala with Rails according to the directions in the wiki.

This works fine:

@updates = Koala::Facebook::RealtimeUpdates.new(:app_id =>
Facebook::APP_ID, :secret => Facebook::SECRET)

But when I type @updates.list_subscriptions, I get the following
error:

Koala::Facebook::APIError: OAuthException: (#15) The method you are
calling must be called with an app secret signed session
from /usr/lib/ruby/gems/1.8/gems/koala-0.9.1/lib/koala/
realtime_updates.rb:81:in api' from /usr/lib/ruby/gems/1.8/gems/koala-0.9.1/lib/koala.rb:72:inapi'
from /usr/lib/ruby/gems/1.8/gems/koala-0.9.1/lib/koala/
realtime_updates.rb:78:in api' from /usr/lib/ruby/gems/1.8/gems/koala-0.9.1/lib/koala/ realtime_updates.rb:74:inlist_subscriptions'
from (irb):2

I get the same when I run @updates.subscribe.

Would someone please explain what this means? I tried creating
@updates with the app_access_token and it didn't make any difference.
What is an "app secret signed session"?

Thanks,

Nick

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.