Git Product home page Git Product logo

fbgraph's People

Contributors

ajaygithub avatar ender672 avatar ginkel avatar joren avatar jpemberthy avatar markbates avatar maxdemarzi avatar mlightner avatar nsanta avatar pboling avatar potomak avatar pwnall avatar riffraff avatar robertomiranda 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

fbgraph's Issues

Id not correct

client.selection.me.info!.id gives wrong output and i get the usual warning "Object#id will be deprecated; use Object#object_id"
client.selection.me.info!['id] gives correct
pretty printing shows correct output.

ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Ubuntu 10.4
Linux r-desktop 2.6.35.4 #2 SMP Mon Sep 20 08:46:54 IST 2010 x86_64 GNU/Linux

how to get the token life time

How can I get how long will be access token will be valid. Because I need to renew the token when it nears to the expiry date.

every page rendering happen inside facebook

hi
if a user has authorized my fb app,then he is allowed to invoke methods in the app.But it is natural that one of methods redirects the user to another method when he is requesting the previous method,in this case, i find the redirected page is not rendered in facebook canvas.Redirect is so common in an app,so how to let every page rendering happen inside facebook? can you tell us the latest facebook way to do it?
thanks!

Fails for some accounts

I'm running Rails 2.3.8 and using gem version 0.0.9. So I completely understand if you don't want to answer the following or feel compelled to laugh at me. That said, a number of users have synced their FB accounts to our system and the following code was working just fine. Recently, however, it only seems to be working for some of the users.

client = FBGraph::Client.new( :client_id => fb_key, :secret_id => fb_secret, :token => user_token )
sel = client.selection
sel.params=( { :fields => 'work,education,name,picture,link' } )
sel.me.info!

Running this code in IRB for a user for whom this code doesn't work, I get the following error:
OAuth2::HTTPError: Received HTTP 400 during request.

Any thoughts?

"message": "Missing redirect_uri parameter."

Hello I'm using the code from your example, but
I have this error during the redirection to the page of my app
{
"error": {
"type": "OAuthException",
"message": "Missing redirect_uri parameter."
}
}
Thanks

remove authorization module

i want to follow the twitter gem approach. So the user can choose which gemwants to use for authenticate/authorize.

installing 1.6 on windows then deploying on server has json related problem

hi
i have error like following deploying on server after install successfully on windows:

disk1/home/slugs/382819_57fdc91_0c4a-b8fa2bc3-0709-43c6-81cd-30963a36b0f3/mnt/.bundle/gems/ruby/1.8/gems/fbgraph-1.6.0/lib/fbgraph.rb:4:in `require': no such file to load -- json (LoadError)

i have try my best,but don't know how to make it work

use of accounts selection connection type with fbgraph

Is it possible to use fbgraph with the 'accounts' selection connection type? I want to get the Facebook page(s) the user administrates.

I first build my fb client for a user who has given the permissions "offline_access" and "manage_pages", and I can get call client.selection.accounts. But when I try client.selection.accounts.info! I get a HTTP Bad Request error from Facebook Graph API.

Is it possible to use the info! method on the connection accounts to get the pages the user administrates? If so do I have to do anything special?

Here is a session in the console:

info! on me is working

client.selection.me.info!
FBGRAPH [GET]: /me
warning: peer certificate won't be verified in this SSL session
=> <#Hashie::Mash email="[email protected]" first_name="my first name" gender="hombre" id="100000849285906" last_name="my last name" link="http://www.facebook.com/profile.php?id=100000849285906" locale="en_US" name="my name" timezone=-5 updated_time="2010-03-12T00:18:15+0000" verified=true>

I can call accounts

client.selection.accounts
=> #<FBGraph::Selection:0x1027dd1a8 @connection_type="accounts", @params={}, @client=#<FBGraph::Client:0x102801030 @facebook_uri="https://graph.facebook.com", @client_id="134493806579275", @consumer=#<OAuth2::AccessToken:0x102800608 @token="134493806579275|826d99c877f4c0adaf6e9255-100000849285906|WycnKxc7AtVxmyTUwCYhMBccyn0.", @expires_in=nil, @client=#<OAuth2::Client:0x102800ec8 @options={}, @id="134493806579275", @site="https://graph.facebook.com", @connection=#<Faraday::Connection:0x102800e78 @options={}, @parallel_manager=nil, @builder=#<Faraday::Builder:0x102800928 @handlers=[#Proc:0x0000000107ad2818@/Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/faraday-0.4.6/lib/faraday/builder.rb:17, #Proc:0x0000000107acda20@/Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/faraday-0.4.6/lib/faraday/builder.rb:55]>, @path_prefix="/", @PORT=nil, @scheme="https", @ssl={}, @params={}, @headers={}, @host="graph.facebook.com">, @secret="94ee5db7e831af89e1f789dd4d81469b">, @refresh_token=nil>, @access_token="134493806579275|826d99c877f4c0adaf6e9255-100000849285906|WycnKxc7AtVxmyTUwCYhMBccyn0.", @secret_id="94ee5db7e831af89e1f789dd4d81469b">>

but I can't call info!

client.selection.accounts.info!
FBGRAPH [GET]:
warning: peer certificate won't be verified in this SSL session
OAuth2::HTTPError: Received HTTP 400 during request.
from /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/oauth2-0.0.10/lib/oauth2/client.rb:70:in request' from /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/oauth2-0.0.10/lib/oauth2/access_token.rb:19:inrequest'
from /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/oauth2-0.0.10/lib/oauth2/access_token.rb:23:in get' from /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/bundler/gems/fbgraph-c1ffae2409fc4727c8b5aa7e6a1cf5f08ea9300d-master/lib/fbgraph/base.rb:47:ininfo!'

400 Error during process_callback

def get_client(token = nil)
      client = FBGraph::Client.new(:client_id => 'application_id_from_facebook',:secret_id =>'application_secret_from_facebook', :token=>token)
      return client
    end

    def authorize(code= nil)
      client = get_client
      puts "Using code: #{code}"
      access_token = client.authorization.process_callback(code, :redirect_uri => real_redirect_uri)

      puts access_token
    end

This is the code I'm using to handle the code provided by facebook's callback. When I get to the line that calls the process_callback method, I get a 400 error with no explanation of what's wrong. Am I doing something wrong?

facebook logo,not authorization screen

I make sure the app is not authorized,go the the app page on facebook to authorize, finally the facebook logo is show with a link that says "go to facebook". Then if I click that logo or point my browser directly to https://graph.facebook.com/oauth/authorize?client_id=...&redirect_uri=http://www.example.com/oauth_redirect, I do get an authorization screen.It is so strange if it is because of the expired token(after reading one closed issue here).What's more,if i directly use the facebook api instead of fbgraph,the same problem happens. is it because the fb new api is still in development?

Possibility to specify locale parameter to get user gender in a specified locale

Hi Nicolas,

By default the Facebook API does return the user gender attribute in the user locale ('hombre' for example)... making quite hard to deal with those values when the users come from different countries.

Looks like it's possible for force a locale when requesting the Facebook API to always get such attributes in a specified locale. I could not find a specific reference to that in the Facebook API documentation, but several posts mention it, for instance http://forum.developers.facebook.net/viewtopic.php?pid=174065

Do you think it would possible to add an option in fbgraph to force a locale when requesting the Facebook Graph API?

Florent

Publishing to a page feed as the page and not as the page owner

Hello,

Not sure if it's a fbgraph issue, or if I miss something using fbgraph...

With fbgraph I can publish a message to a page feed but it appears published by the page owner (I have his credentials) and not by the page itself. Here is how I do:

fbg_client = FBGraph::Client.new(:client_id => FACEBOOK_APP_ID, :secret_id => FACEBOOK_APP_SECRET, :token => user.facebook_token)
fbg_client.selection.page(business.facebook_page_id).feed.publish!(:message => message, :link => announcement_url, :name => "new message")

I now try to have the message posted published by the page itself instead of the page owner but I could not find a way to do this in the FBGraph API Post page (http://developers.facebook.com/docs/reference/api/post) and only found related bugs for the old Facebook REST API (http://bugs.developers.facebook.com/show_bug.cgi?id=8184, http://bugs.developers.facebook.com/show_bug.cgi?id=8691).

Is is possible to do it with fbgraph?

Any help appreciated :)

RestClient::BadRequest (400 Bad Request): while posting.

I was using the code like as follows -

def broadcast_on_facebook(donation)
client = FBGraph::Client.new(:client_id => facebook_account.uid ,:token => facebook_account.access_token)
u = client.selection.me.info!
client.selection.user(u[:id]).feed.publish!(
:message => "I donated for #{donation.cause.name} on mySite. Feels good and satisfied to be helpful to somebody in need.",
:name => "Donate Now !!",
:link => "#{RETURN_URL_LOCALHOST}?uuid=#{uuid}",
:picture => 'https://mysite.net/images/modules/header/logov3-hover.png',
:caption => donation.cause.description
)
donation.update_attributes(:broadcasted => true)
end

depending rcov is not able to install on wondows

it seems your gem is best for facebook app(i have looked over other fb gems) after reading the developer doc on facebook.But the depending rcov gem is not able to install on windows.while i don't want to reinstall ruby,can you tell us how to manage it?
The error is following:

ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

C:\Users\gyg>f:

F:>cd ruby/gem

F:\ruby\gem>gem install rcov-0.9.9.gem
Building native extensions. This could take a while...
ERROR: Error installing rcov-0.9.9.gem:
ERROR: Failed to build gem native extension.

C:/Ruby192/bin/ruby.exe extconf.rb
creating Makefile

make
'make' 不是内部或外部命令,也不是可运行的程序
或批处理文件。('is not internal or external command,also not a executable programm...')

Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/rcov-0.9.9 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/rcov-0.9.9/ext/rcovrt/gem_make.out

F:\ruby\gem>

undefined method `__request__' for class `Net::HTTP'

Recently updated my gems while merging two branches together and got this error:

$ rake test --trace
rake aborted!
undefined method `__request__' for class `Net::HTTP'
/Users/******/.rvm/gems/ruby-1.9.3-p392@ftue_refactor/gems/fbgraph-1.10.0/lib/fbgraph/client.rb:75:in `<class:HTTP>'

I'm running ruby-1.9.3-p392 and rails 3.2.18 on Mac OSX 10.8.5. The code that's being pointed out is the following:

# :nodoc: undo the clusterfuck that rest-client has done
module Net
  class HTTP
    undef request
    alias request __request__  # <=====
  end
end

Did __request__ exist in an old version of Net::HTTP or a newer? or something? Any ideas would be greatly appreciated. Thanks!

Getting 403 forbidden when posting to feed

I can retrieve information just fine, but cannot post

client = FBGraph::Client.new(:client_id => 'id',   :secret_id => 'secret', :token => current_user.authorizations.find(:all, :conditions => { :provider => 'facebook' })[0]['token'])

Token is derived from omniauth, id and secret are taken from my app page on facebook

client.selection.me.feed.publish!(:message => 'test', :name => 'test')

results in:
RestClient::Forbidden: 403 Forbidden

Any ideas?

Thanks

Edit: my omniauth access token was not granting me publish permissions, I modified that and now it's working.

No configured canvas_url causes the class to be unusable

Error:
undefined method []' for false:FalseClass .bundle/gems/ruby/1.8/gems/fbgraph-1.7.1/lib/fbgraph/authorization.rb:10:inauthorize_url'

(only showing relevant lines below)
Auth 10:
params = { :redirect_uri => FBGraph.config[:canvas_url] }.merge(params)

FBGraph.config
load_config(File.join(Rails.root , 'config' , 'facebook.yml')).freeze

FBGraph.load_config
return false unless File.exist?(yaml_file)

Can't load config from YAML?

I'm using Rails 3 on Ruby 1.8.7. I created facebook.yml and put it in the config folder. It doesn't get loaded. Based on what I'm reading in the code, it doesn't look like it ever will.

In the FbGraph module, the choice to grab the config is in the config method,
def config
@config ||= load_config(File.join(Rails.root , 'config' , 'facebook.yml')).freeze
end
But the @config member variable always has a value. It's set as soon as the FbGraph module is parsed.
@config = {}
The ||= never evaluates to loading the configuration. When I change the code and remove the automatic initialization of @config, it still seemingly doesn't work. This line from the Client initialization fails to get the config.
@client_id, @secret_id = options[:client_id] || FBGraph.config[:client_id], options[:secret_id] || FBGraph.config[:secret_id]
FBGraph.config[:client_id] is evaluated as nil when using a label to retrieve the value of client_id. Using the literal strings 'client_id' and 'secret_id' works to get the values. After that, things are fine.

Have I missed something?

selection without token

I can't do a selection when I'm not authenticated. If still need a consumer or I get this error:

undefined method `get' for nil:NilClass
/Users/joren/.bundle/ruby/1.8/bundler/gems/rails/activesupport/lib/active_support/whiny_nil.rb:48:in `method_missing'
/Library/Ruby/Gems/1.8/gems/fbgraph-0.0.9/lib/fbgraph/base.rb:47:in `info!'

I've created a client without a token because I don't need one to do a simple get like this:
http://graph.facebook.com/125467577971
But you need a token to create a consumer...

any ideas

NoMethodError (undefined method `[]' for false:FalseClass)

When I implement the example code and try to access oauth#start, I end up with an error:

NoMethodError (undefined method []' for false:FalseClass): app/controllers/oauth_controller.rb:3:in start'

Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (6.2ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (11.9ms)

create an album

how can I create an album with your gem ?
sorry for a lot of questions and thanks

Can't create a class instance?

"undefined method `[]' for false:FalseClass"
$creds = Hash.new
$creds[:facebook] = {:client_id => 'app_id', :secret_id => 'app_secret'}
code: client = FBGraph::Client.new($creds[:facebook])

I've looked around a bit and while I'm sure this error must be my own, I can't seem to find why my variable would be false and have debugged it not to be.

Strange problem with fbgraph authorization (Exchange Sessions Not Implemented)

Hi

I really hope you can shed some light at this problem I am having, I am using the fbgraph_example application and I cannot get it to show me the authorization screen when I use it from facebook. I am in my development environment and I use an ssh tunnel to communicate with facebook.

This is what I do: I make sure the app is not authorized on my facebook account, then I go the the app page on facebook and after a long time I get an error (the facebook logo is show with a link that says "go to facebook"). Facebook never calls the callback method. However, and this is the strange part if I point my browser directly to the start method (i.e. localhost:3000/oauth/start), I do get an authorization screen where I can authorize the app, then I get sent back to my app on facebook and everything works.

Does this have to do with the fact that I am in development or is this a problem with FBgraph? Does this happen for you as well?

Does this work with Rails 3.0.5

I get an error on Rails 3.0.5 in
OAuth_controller # Start
that says:

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

Probably, i havent setup my facebook.yml file correctly. May be i can help you with documenting this if you can tell me how to setup the facebook.yml file?

Live stream api

hello,
I am trying create a facebook live chatbot.
is fbgraph right for that ?
need request stream respond from http server.
how can i do that ?

Untitled

i have error like following deploying on server after install successfully on my local windows:

disk1/home/slugs/382819_57fdc91_0c4a-b8fa2bc3-0709-43c6-81cd-30963a36b0f3/mnt/.bundle/gems/ruby/1.8/gems/fbgraph-1.6.0/lib/fbgraph.rb:4:in `require': no such file to load -- json (LoadError)

i have try my best,but don't know how to make it work.it is locally installed well on my windows,but not able to deploy to heroku...

friends_count, likes_count, post_count

Hi, Is there any way to get those variables? friends_count, likes_count, post_count ??? Or any idea how to get it without iterate the whole structure?

thanks

Feed publish doesn't support picture

client.selection.me.feed.publish!() is publishing everything but the picture.
Every param of the following call is published except for the picture:
fbclient.selection.me.feed.publish!(
:message => "This is message"),
:name => "title of the feed",
:caption => "Caption of the feed",
:description => "Description of the feed"
:link => "",
:picture => '',:actions => "{'name': 'Volunteer', 'link': ''}")

tags

sorry for all of this questions , but without the documentation I can't understend a lot of things in your gem
this time I'm trying add the tags to a photo that I've created

me = FbGraph::User.me(session[:access_token])
file = File.new(File.join('/Users', 'tod','Documents','nov.jpg'), 'r')
photo = me.photo!(:name => 'foto di prova', :source => file, :tags => ?)

thanks

SSL certificate errors

I'm experiencing the following error while trying to use authenticated methods in fbgraph 1.8.3:

RestClient::SSLCertificateNotVerified (SSL Verification failed -- Preverify: false, Error: unable to get local issuer certificate (20)

I found two related mailing list threads (one, two) which mentioned the restclient_with_cert gem, however after including this in my Gemfile and updated my bundle the errors persisted.

Copying the certificates declared in restclient_with_cert's lib/cert file into fbgraph's lib/cacert.pem makes things work again, so I'm assuming I'm not using that gem correctly.

Any ideas the best way to resolve this issue?

TypeError in OauthsController#callback

I have a simple application in Rails 3.0.7 using only FB authentication methods provided by FBGraph gem (tested on current gem version and git version) and I recieve the following error:

TypeError in OauthsController#callback
can't convert Hash into Integer
app/controllers/oauth_controller.rb:7:in `callback'

My callback method is defined as follows:

def callback
access_token = client.authorization.process_callback(params[:code], :redirect_uri => 'http://localhost:3000/oauth/callback')
session[:access_token] = access_token
user_json = client.selection.me.info!
# in reality you would at this point store the access_token.token value as well as
# any user info you wanted
render :json => user_json
end

I get the same error when using example application linked in gem's readme file.

I'd be very grateful for any help regarding this issue. Thank you in advance.

<FbGraph::Exception: Unparsable Response: > fb_graph - rails 3.2.2

The latest version of this gem now causes a <FbGraph::Exception: Unparsable Response: > fb_graph - rails 3.1.3 exception.
I have resolved this by reverting back to the previous version of the gem as per my answer here.

http://stackoverflow.com/questions/9636619/fbgraphexception-unparsable-response-fb-graph-rails-3-1-3/9640466#9640466

I have no idea what causes the problem but if it is of any help the code that causes this exception looks like this
[code]
owner = FbGraph::User.me(FB_TOKEN)
pages = owner.accounts
page = pages.detect do |page|
page.identifier == FB_PAGE_ID
end
page.feed!(
:message => params[:message],
:description => params[:description],
:link => self.app_link
)
[/code]

Obviously the FB_PAGE_ID and the FB_TOKEN are constants for my specific page and user on facebook

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.