Sha256: 0cc83b1978d0accc7a22d1b50c3590592afee3cbbb8cfd8d2d70ba268580db80

Contents?: true

Size: 1.62 KB

Versions: 137

Compression:

Stored size: 1.62 KB

Contents

module Facebooker
  module Rails
    module ProfilePublisherExtensions

      ##
      # returns true if Facebook is requesting the interface for a profile publisher
      def wants_interface?
        params[:method] == "publisher_getInterface"
      end

      ##
      # render the interface for a publisher. 
      # fbml is the content in string form. Use render_to_string to get the content from a template
      # publish_enabled controlls whether the post form is active by default. If it isn't, you'll need to use fbjs to activate it
      # comment_enabled controls whether to include a comment box
      def render_publisher_interface(fbml,publish_enabled=true,comment_enabled=false)
        render :json=>{:content=>{:fbml=>fbml,:publishEnabled=>publish_enabled,:commentEnabled=>comment_enabled},
         :method=>"publisher_getInterface"}
      end
      
      # render an error while publishing the template
      # This can be used for validation errors
      def render_publisher_error(title,body)
        render :json=>{:errorCode=>1,:errorTitle=>title,:errorMessage=>body}.to_json
      end

      # render the response for a feed. This takes a user_action object like those returned from the Rails Publisher
      # For instance, AttackPublisher.create_attack(@attack)
      # The template must have been registered previously
      def render_publisher_response(user_action)
        render :json=>{:content=> {
            :feed=>{
              :template_id=>user_action.template_id,
              :template_data=>user_action.data
            }
          },
          :method=>"publisher_getFeedStory"
        }
      end
    end
  end
end

Version data entries

137 entries across 137 versions & 30 rubygems

Version Path
al-facebooker-1.0.12.1 lib/facebooker/rails/profile_publisher_extensions.rb
al-facebooker-1.0.12 lib/facebooker/rails/profile_publisher_extensions.rb
al-facebooker-1.0.9 lib/facebooker/rails/profile_publisher_extensions.rb
corey-facebooker-1.0.28.1 lib/facebooker/rails/profile_publisher_extensions.rb
cwninja-facebooker-1.0.8 lib/facebooker/rails/profile_publisher_extensions.rb
djanowski-facebooker-1.0.1 lib/facebooker/rails/profile_publisher_extensions.rb
djanowski-facebooker-1.0.10 lib/facebooker/rails/profile_publisher_extensions.rb
djanowski-facebooker-1.0.11 lib/facebooker/rails/profile_publisher_extensions.rb
djanowski-facebooker-1.0.12 lib/facebooker/rails/profile_publisher_extensions.rb
djanowski-facebooker-1.0.2 lib/facebooker/rails/profile_publisher_extensions.rb
djanowski-facebooker-1.0.4 lib/facebooker/rails/profile_publisher_extensions.rb
djanowski-facebooker-1.0.7 lib/facebooker/rails/profile_publisher_extensions.rb
djanowski-mmangino-facebooker-1.0.4 lib/facebooker/rails/profile_publisher_extensions.rb
fs-facebooker-1.0.37 lib/facebooker/rails/profile_publisher_extensions.rb
hashrocket-clearance-0.4.0 test/rails_root/vendor/plugins/facebooker/lib/facebooker/rails/profile_publisher_extensions.rb
hashrocket-clearance-0.4.1 test/rails_root/vendor/plugins/facebooker/lib/facebooker/rails/profile_publisher_extensions.rb
hashrocket-clearance-0.4.2 test/rails_root/vendor/plugins/facebooker/lib/facebooker/rails/profile_publisher_extensions.rb
hashrocket-clearance-0.4.3 test/rails_root/vendor/plugins/facebooker/lib/facebooker/rails/profile_publisher_extensions.rb
mborromeo-facebooker-1.0.28 lib/facebooker/rails/profile_publisher_extensions.rb
mborromeo-facebooker-1.0.29 lib/facebooker/rails/profile_publisher_extensions.rb