Module: Facebooker::Rails::ProfilePublisherExtensions

Included in:
Controller
Defined in:
lib/facebooker/rails/profile_publisher_extensions.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) render_publisher_error(title, body)

render an error while publishing the template This can be used for validation errors



23
24
25
# File 'lib/facebooker/rails/profile_publisher_extensions.rb', line 23

def render_publisher_error(title,body)
  render :json=>{:errorCode=>1,:errorTitle=>title,:errorMessage=>body}.to_json
end

- (Object) render_publisher_interface(fbml, publish_enabled = true, comment_enabled = false)

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



16
17
18
19
# File 'lib/facebooker/rails/profile_publisher_extensions.rb', line 16

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

- (Object) render_publisher_response(user_action)

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



30
31
32
33
34
35
36
37
38
39
# File 'lib/facebooker/rails/profile_publisher_extensions.rb', line 30

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

- (Boolean) wants_interface?

returns true if Facebook is requesting the interface for a profile publisher



7
8
9
# File 'lib/facebooker/rails/profile_publisher_extensions.rb', line 7

def wants_interface?
  params[:method] == "publisher_getInterface"
end