Issue with Stream.publish

14 views
Skip to first unread message

Rajat Garg

unread,
Oct 11, 2009, 9:05:47 PM10/11/09
to facebooker
Folks,

I am trying this logic to send stream.publish ->

def ask_for_recommendation
params[:message] ="#{current_user.name} is looking for #{params
[:id]}
on HotelsBlah. #{current_user.name} is unsure
and needs
your help. Will you help #{current_user.name} by
rating #{params[:id]}?"
links = Hash.new()
links["text"] = "Recommend hotels in #{params[:id]} on
HotelsBlah.com"
links["href"] = "http://www.hotelsblah.com"
params[:action_links] = links

attach = Hash.new()
attach["name"] = "Hotel name"
attach["href"] = "http://www.hotelsblah.com"
attach["caption"] = "HotelsBlah.com"
attach["description"] = "Hotel description"

media_attach = Hash.new()
media_attach["type"] = "image"
media_attach["src"] = "http://image.hotelsblah.com/hotels/
10776_6_390_0_1.jpg"
media_attach["href"] = "http://www.hotelsblah.com#{params
[:ref_uri]}"

attach["media"] = media_attach
params[:attachment] = attach

FbPublisher.deliver_publish_stream(facebook_session.user,
facebook_session.user, params)
flash[:notice] = "Your request has been sent to the friends who
are also using HotelsBlah."
redirect_to params[:ref_uri]
end


I am getting the following error ->

Processing MessagingController#ask_for_recommendation (for
76.104.161.13 at 2009-10-12 00:47:07) [GET]
Parameters: {"ref_uri"=>"/hotels/united-states/california/san-
francisco", "id"=>"San Francisco Hotels"}
facebook.friends.getAppUsers (0.24001407623291)

facebook.stream.publish (0)
Facebooker::Session::MissingOrInvalidParameter: type 'h' is not
allowed: target_id = 100000335871919, uid = 100000335871919,
action_links = [{"href": "http://www.hotelsoutlook.com", "text":
"Recommend hotels in San Francisco Hotels on HotelsOutlook.com"}],
message = Rajat Garg is looking for San Francisco Hotels
on HotelsOutlook. Rajat Garg is unsure and needs
your help. Will you help Rajat Garg by rating
San Francisco Hotels?, attachment = {"name": "Hotel name", "href":
"http://www.hotelsoutlook.com", "media": {"href": "http://
www.hotelsoutlook.com/hotels/united-states/california/san-francisco",
"type": "image", "src": "http://image.gtahotels.com/hotels/
10776_6_390_0_1.jpg"}, "caption": "HotelsOutlook.com", "description":
"Hotel description"}


What am I missing? Any pointers will be greatly appreciated.

Thx.

Rajat Garg

unread,
Oct 11, 2009, 9:29:19 PM10/11/09
to facebooker
Fixed by doing this ...
media_att = Array.new()
media_att << media_attach
attach["media"] = media_att
params[:attachment] = attach
> "http://www.hotelsoutlook.com", "media": {"href": "http://www.hotelsoutlook.com/hotels/united-states/california/san-francisco",

venetanji

unread,
Nov 4, 2009, 9:26:11 AM11/4/09
to facebooker

Thanks, that was driving me crazy...

G
> > "http://www.hotelsoutlook.com", "media": {"href": "http://www.hotelsoutlook.com/hotels/united-states/california/san-fran...",
Reply all
Reply to author
Forward
0 new messages