agorapulse / grails-facebook-sdk

Facebook SDK Grails Plugin
http://agorapulse.github.com/grails-facebook-sdk/guide
30 stars 13 forks source link

typo - FacebookAppService.groovy:240 #7

Closed markthompson closed 11 years ago

markthompson commented 11 years ago

should be toLong() instead tolong() :) ?

http://localhost:8080/facebook-sdk-demo/website/

When trying to login with fb either server side redirect or js, I get:

Error 500: Internal Server Error

No signature of method: java.lang.String.tolong() is applicable for argument types: () values: [] Possible solutions: toLong(), toLong(), isLong(), isLong(), toFloat(), toFloat(). Stacktrace follows: groovy.lang.MissingMethodException: No signature of method: java.lang.String.tolong() is applicable for argument types: () values: [] Possible solutions: toLong(), toLong(), isLong(), isLong(), toFloat(), toFloat() at grails.plugin.facebooksdk.FacebookAppService.getUserId(FacebookAppService.groovy:240) at grails.plugin.facebooksdk.FacebookSdkFilters$_closure1_closure2_closure3.doCall(FacebookSdkFilters.groovy:20) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

thanks!!

Mark

PS: will probably be using this plugin quite intensely over the next few weeks. probably here from me again.

benorama commented 11 years ago

Indeed, bad typo... I'll release a fix tomorrow.

Thanks!

benorama commented 11 years ago

FYI, I just release V0.3.4 for this bug fix.

benorama commented 11 years ago

Hi Mark,

FYI, I'm going to release pretty soon Facebook SDK V0.4. The main objective was to "clean" the SDK code which was pretty messy (since it was a port of PHP code...). The other objective was to be able to support multiple Facebook app within a single Grails app. It's pretty big refactoring of the code base.

Unfortunately, it won't be backward compatible with V0.3.* ... FacebookApp, FacebookSdkFilters and FacebookAppService have been deprecated and replaced by a single FacebookContext bean : a cleaner approach to access Facebook context info (current app, user, page...) So if you use any of them, you might have to do some refactoring on your app.

I'm looking for some feedback, if you have some time to play with it, it's on "develop" branch. You can download the updated docs here : http://cl.ly/2q2T300G201J

Thanks !

Ben

markthompson commented 11 years ago

Hi Ben,

Sounds great. I was actually wondering how one might support multiple fb apps in grails :) A scenario I see in the near future at my company is that our fb grails app just serves up simple canvas pages and be responsible for POSTing simple OpenGraph actions/objects. I'm not really sure opengraph action/object support is part of the scope for your sdk, but some utilities to help test it during dev would be nice, I have a few ideas based on some fb demos/tutorials.

I'll grab your dev branch and give it a try!

Regards,

Mark.

On Sun, Sep 23, 2012 at 1:47 PM, Benoit Hediard notifications@github.comwrote:

Hi Mark,

FYI, I'm going to release pretty soon Facebook SDK V0.4. The main objective was to "clean" the SDK code which was pretty messy (since it was a port of PHP code...). The other objective was to be able to support multiple Facebook app within a single Grails app. It's pretty big refactoring of the code base.

Unfortunately, it won't be backward compatible with V0.3.* ... FacebookApp, FacebookSdkFilters and FacebookAppService have been deprecated and replaced by a single FacebookContext bean : a cleaner approach to access Facebook context info (current app, user, page...) So if you use any of them, you might have to do some refactoring on your app.

I'm looking for some feedback, if you have some time to play with it, it's on "develop" branch. You can download the updated docs here : http://cl.ly/2q2T300G201J

Thanks !

Ben

— Reply to this email directly or view it on GitHubhttps://github.com/benorama/grails-facebook-sdk/issues/7#issuecomment-8802756.

benorama commented 11 years ago

Hi Mark,

Yes, you can easily publish OpenGraph actions.

Here is how we do it in one of our Services : long publishAction(String userToken, long appFacebookId, String actionName, String objectName, String objectUrl, long userFacebookId, Map parameters = [:], boolean scrapeEnabled = false) { assert userToken, 'User access token is required' assert appFacebookId, 'App facebookId is required' assert actionName, 'Action name is required' assert objectName, 'Object name is required' assert objectUrl, 'Object url is required' assert userFacebookId, 'User facebookId is required'

    App app = App.findByFacebookId(appFacebookId)
    assert app, 'App must be valid to publish action'
    long storyId = 0
    FacebookGraphClient facebookGraphClient = new FacebookGraphClient(userToken)
    parameters += [
            objectName: objectUrl,
            scrape: scrapeEnabled
    ]
    try {
        Map result = facebookGraphClient.makePostRequest("${userFacebookId}/${app.nameSpace}:${actionName}", parameters) as Map
        if (result['id']) storyId = result['id'] as long
    } catch(FacebookException exception) {
        exceptionTrackingService.track(exception, Level.WARN)
    }
    return storyId
}

App is the domain class that represents facebook apps on our platform.

You will see in the documentation that if you use multiple FB apps, you can easily "map" each FB app to a controller.

FYI, we are currently migrating all our FB apps to Grails with this SDK. That's also why I had to perform important refactoring / improvements for the V0.4 release. It should go in production (http://www.agorapulse.com) at the end of next month.

Let me know if you have any questions to migrate you current apps to V0.4.

Regards,

Ben

Le 24 sept. 2012 à 09:47, markthompson notifications@github.com a écrit :

Hi Ben,

Sounds great. I was actually wondering how one might support multiple fb apps in grails :) A scenario I see in the near future at my company is that our fb grails app just serves up simple canvas pages and be responsible for POSTing simple OpenGraph actions/objects. I'm not really sure opengraph action/object support is part of the scope for your sdk, but some utilities to help test it during dev would be nice, I have a few ideas based on some fb demos/tutorials.

I'll grab your dev branch and give it a try!

Regards,

Mark.

On Sun, Sep 23, 2012 at 1:47 PM, Benoit Hediard notifications@github.comwrote:

Hi Mark,

FYI, I'm going to release pretty soon Facebook SDK V0.4. The main objective was to "clean" the SDK code which was pretty messy (since it was a port of PHP code...). The other objective was to be able to support multiple Facebook app within a single Grails app. It's pretty big refactoring of the code base.

Unfortunately, it won't be backward compatible with V0.3.* ... FacebookApp, FacebookSdkFilters and FacebookAppService have been deprecated and replaced by a single FacebookContext bean : a cleaner approach to access Facebook context info (current app, user, page...) So if you use any of them, you might have to do some refactoring on your app.

I'm looking for some feedback, if you have some time to play with it, it's on "develop" branch. You can download the updated docs here : http://cl.ly/2q2T300G201J

Thanks !

Ben

— Reply to this email directly or view it on GitHubhttps://github.com/benorama/grails-facebook-sdk/issues/7#issuecomment-8802756.

— Reply to this email directly or view it on GitHub.