[Facebooker-talk] New publishing API
Christopher Redinger
redinger at gmail.com
Tue Jul 15 13:27:56 EDT 2008
And then I had to rename the migration class to
CreateFacebookTemplates. It was CreateFacebookTemplateRegistries, but
the filename was create_facebook_templates.
On Tue, Jul 15, 2008 at 1:16 PM, David Clements <digidigo at gmail.com> wrote:
> Same thing happened to me, btw.
>
> Dave
>
>
> On Tue, Jul 15, 2008 at 11:02 AM, Christopher Redinger <redinger at gmail.com>
> wrote:
>>
>> FYI, I couldn't get the migration to generate. I went into
>> publisher_generator.rb and commented out the unless (and end) line
>> because it wasn't getting in there, even though I didn't have the
>> migration already. Then it worked.
>>
>> On Tue, Jul 15, 2008 at 9:54 AM, Mike Mangino
>> <mmangino at elevatedrails.com> wrote:
>> > I've added support for the new message templates. Check out the
>> > documentation (http://facebooker.rubyforge.org/ and
>> > http://facebooker.rubyforge.org/classes/Facebooker/Rails/Publisher.html
>> > in
>> > particular)
>> >
>> > If you've already created a publisher, you will need to re-run the
>> > script/generate command to create a new migration. By default,
>> > Facebooker
>> > will now keep track of your template ids. To send a message using the
>> > new
>> > API, you'll need to create two methods. The first returns the templates.
>> > For
>> > example:
>> >
>> > class MyPublisher < Facebooker::Rails::Publisher
>> > def publish_action_template
>> > one_line_story_template "{*actor*} did stuff with {*friend*}"
>> > one_line_story_template "{*actor*} did stuff"
>> > short_story_template "{*actor*} has a title {*friend*}",
>> > render(:partial=>"short_body")
>> > short_story_template "{*actor*} has a title",
>> > render(:partial=>"short_body")
>> > full_story_template "{*actor*} has a title {*friend*}",
>> > render(:partial=>"full_body")
>> > end
>> >
>> > The name of the method needs to end in _template.
>> >
>> > To register this template, you can call
>> >
>> > MyPublisher.register_publish_action
>> >
>> > or, to register all templates in a publisher, you can call
>> >
>> > MyPublisher.register_all_templates
>> >
>> >
>> > Facebooker will store the template id and the template name in the
>> > facebook_templates table.
>> >
>> > To send a message from a stored template, you'll need to create another
>> > method that registers the data:
>> >
>> > def publish_action(f)
>> > from f
>> > data :friend=>"Mike"
>> > end
>> >
>> > Then, you can call
>> > MyPublisher.deliver_publish_action
>> >
>> > Facebooker will look up the template id automatically.
>> >
>> > Let me know if you have any issues with this.
>> >
>> > Mike
>> > --
>> > Mike Mangino
>> > http://www.elevatedrails.com
>> >
>> >
>> >
>> > _______________________________________________
>> > Facebooker-talk mailing list
>> > Facebooker-talk at rubyforge.org
>> > http://rubyforge.org/mailman/listinfo/facebooker-talk
>> >
>>
>>
>>
>> --
>> Christopher Redinger
>> http://www.agiledisciple.com
>> _______________________________________________
>> Facebooker-talk mailing list
>> Facebooker-talk at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/facebooker-talk
>
>
--
Christopher Redinger
http://www.agiledisciple.com
More information about the Facebooker-talk
mailing list