Hi There, I was wondering what the appropriate way to use the applicationproperties.rb model was. I was hoping to query it to find out which users are developers for my app and then grant special permissions to them ... I tried creating something like this: class ApplicationProperties < ActiveRecord::Base def facebook_session @facebook_session || returning Facebooker::Session.create do |session| session.secure_with!(session_key,User.find(:first).facebook_id,1.hour.from_now) end end end but that doesn''t seem to help, i.e. the facebook session thing is specific to the user model .... Many thanks in advance CHEERS> SAM -- Sam Joseph, Ph.D. Co-Director Laboratory for Interactive Learning Technologies Department of Information and Computer Sciences University of Hawaii
I was just trying this: >> app.facebook_session.admin.get_app_properties NameError: uninitialized constant Facebooker::Admin::JSON from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:493:in `const_missing'' from /Users/samueljoseph/Code/eclipse-workspace/stem_survey-fresh/vendor/plugins/facebooker/lib/facebooker/admin.rb:18:in `get_app_properties'' from (irb):6 from :0 >> but get an error ... do I need a JSON gem or something? Many thanks in advance CHEERS> SAM Sam Joseph wrote:> Hi There, > > I was wondering what the appropriate way to use the > applicationproperties.rb model was. > > I was hoping to query it to find out which users are developers for my > app and then grant special permissions to them ... > > I tried creating something like this: > > class ApplicationProperties < ActiveRecord::Base > def facebook_session > @facebook_session ||> returning Facebooker::Session.create do |session| > > session.secure_with!(session_key,User.find(:first).facebook_id,1.hour.from_now) > > end > end > end > > but that doesn''t seem to help, i.e. the facebook session thing is > specific to the user model .... > > Many thanks in advance > CHEERS> SAM >-- Sam Joseph, Ph.D. Co-Director Laboratory for Interactive Learning Technologies Department of Information and Computer Sciences University of Hawaii
Hi David, Many thanks, that helped, i.e. removed the immediate error, but all the application properties themselves are nil: >> app = ApplicationProperties.find(1) => #<ApplicationProperties id: 1, app_id: "5953de36a0fccdec831bca3d5f57f8f7", session_key: nil, created_at: "2008-12-16 01:44:16", updated_at: "2008-12-16 01:44:16"> >> prop = app.facebook_session.admin.get_app_properties [] >> prop.inspect => "#<Facebooker::ApplicationProperties:0x23afb54>" >> prop.edit_url => nil >> prop.canvas_name => nil feels like I need some way to trace the XML being sent back and forth to get to the bottom of this ... CHEERS> SAM David Crockett wrote:> I have to add require ''json'' to the top of facebooker.rb to use the > admin model. > > David Crockett > > On Dec 15, 2008, at 6:55 PM, Sam Joseph <srjoseph at hawaii.edu> wrote: > >> I was just trying this: >> >> >> app.facebook_session.admin.get_app_properties >> NameError: uninitialized constant Facebooker::Admin::JSON >> from >> /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:493:in >> `const_missing'' >> from >> /Users/samueljoseph/Code/eclipse-workspace/stem_survey-fresh/vendor/plugins/facebooker/lib/facebooker/admin.rb:18:in >> `get_app_properties'' >> from (irb):6 >> from :0 >> >> >> >> >> but get an error ... >> >> do I need a JSON gem or something? >> >> Many thanks in advance >> CHEERS> SAM >> >> Sam Joseph wrote: >>> Hi There, >>> >>> I was wondering what the appropriate way to use the >>> applicationproperties.rb model was. >>> >>> I was hoping to query it to find out which users are developers for >>> my app and then grant special permissions to them ... >>> >>> I tried creating something like this: >>> >>> class ApplicationProperties < ActiveRecord::Base >>> def facebook_session >>> @facebook_session ||>>> returning Facebooker::Session.create do |session| >>> >>> session.secure_with!(session_key,User.find(:first).facebook_id,1.hour.from_now) >>> >>> end >>> end >>> end >>> >>> but that doesn''t seem to help, i.e. the facebook session thing is >>> specific to the user model .... >>> >>> Many thanks in advance >>> CHEERS> SAM >>> >> >> >> -- >> Sam Joseph, Ph.D. >> Co-Director >> Laboratory for Interactive Learning Technologies >> Department of Information and Computer Sciences >> University of Hawaii >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >-- Sam Joseph, Ph.D. Co-Director Laboratory for Interactive Learning Technologies Department of Information and Computer Sciences University of Hawaii
Hey Sam, I store facebook app parameters in a database instead of facebooker.yml. It appears that you are doing the same. This is my code: class FacebookApplication < ActiveRecord::Base ... # the api_key and api_secret are loaded from the database def logo_url Facebooker::Session.new(api_key, api_secret).admin.get_app_properties(:logo_url).logo_url end end Also further inspection shows that I am adding require ''json'' to the top of admin.rb, not facebooker.rb Good luck, David On Dec 16, 2008, at 5:38 PM, Sam Joseph wrote:> Hi David, > > Many thanks, that helped, i.e. removed the immediate error, but all > the application properties themselves are nil: > > >> app = ApplicationProperties.find(1) > => #<ApplicationProperties id: 1, app_id: > "5953de36a0fccdec831bca3d5f57f8f7", session_key: nil, created_at: > "2008-12-16 01:44:16", updated_at: "2008-12-16 01:44:16"> > >> prop = app.facebook_session.admin.get_app_properties > [] > >> prop.inspect > => "#<Facebooker::ApplicationProperties:0x23afb54>" > >> prop.edit_url > => nil > >> prop.canvas_name > => nil > > feels like I need some way to trace the XML being sent back and > forth to get to the bottom of this ... > > CHEERS> SAM > > David Crockett wrote: >> I have to add require ''json'' to the top of facebooker.rb to use the >> admin model. >> >> David Crockett >> >> On Dec 15, 2008, at 6:55 PM, Sam Joseph <srjoseph at hawaii.edu> wrote: >> >>> I was just trying this: >>> >>> >> app.facebook_session.admin.get_app_properties >>> NameError: uninitialized constant Facebooker::Admin::JSON >>> from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/ >>> active_support/dependencies.rb:493:in `const_missing'' >>> from /Users/samueljoseph/Code/eclipse-workspace/stem_survey-fresh/ >>> vendor/plugins/facebooker/lib/facebooker/admin.rb:18:in >>> `get_app_properties'' >>> from (irb):6 >>> from :0 >>> >> >>> >>> >>> but get an error ... >>> >>> do I need a JSON gem or something? >>> >>> Many thanks in advance >>> CHEERS> SAM >>> >>> Sam Joseph wrote: >>>> Hi There, >>>> >>>> I was wondering what the appropriate way to use the >>>> applicationproperties.rb model was. >>>> >>>> I was hoping to query it to find out which users are developers >>>> for my app and then grant special permissions to them ... >>>> >>>> I tried creating something like this: >>>> >>>> class ApplicationProperties < ActiveRecord::Base >>>> def facebook_session >>>> @facebook_session ||>>>> returning Facebooker::Session.create do |session| >>>> session.secure_with! >>>> (session_key,User.find(:first).facebook_id,1.hour.from_now) >>>> end >>>> end >>>> end >>>> >>>> but that doesn''t seem to help, i.e. the facebook session thing is >>>> specific to the user model .... >>>> >>>> Many thanks in advance >>>> CHEERS> SAM >>>> >>> >>> >>> -- >>> Sam Joseph, Ph.D. >>> Co-Director >>> Laboratory for Interactive Learning Technologies >>> Department of Information and Computer Sciences >>> University of Hawaii >>> >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > > > -- > Sam Joseph, Ph.D. > Co-Director > Laboratory for Interactive Learning Technologies > Department of Information and Computer Sciences > University of Hawaii >