class TwinetorController < ApplicationController
def index
end
def login
oauth.set_callback_url("http://#{request.host}#{":#{request.port}"
unless request.port == 80}/twinetor/finalize")
session[:request_token] = oauth.request_token.token
session[:request_secret] = oauth.request_token.secret
redirect_url = oauth.request_token.authorize_url
redirect_url = "http://" + redirect_url unless redirect_url.match(/
^http:\/\//)
redirect_to redirect_url
end
def finalize
oauth.authorize_from_request(session[:request_token],
session[:request_secret], params[:oauth_verifier])
@profile = Twitter::Base.new(oauth).verify_credentials
session[:request_token] = nil
session[:request_secret] = nil
@auth_token = session[:auth_token] = oauth.access_token.token
session[:auth_secret] = oauth.access_token.secret
end
private
def oauth
@oauth ||= Twitter::OAuth.new(APP_CONFIG[:twitter][:consumer_key],
APP_CONFIG[:twitter][:consumer_secret])
end
end
и в виде finilize: <%= @profile.status.text %>
То есть последний пост я могу получить уже, да =)
Что дальше? Как, к примеру, сделать поиск среди всех твиттов
пользователя те, что содержат в себе хэштег, допустим "family" ?
И почему каждый раз когда я хочу обновить страничку finilize мне
приходится идти обратно в index, логинится, давать доступ в самом
твиттере и потом редиректиться уже на этот finilize? Иначе при
обновлении странички показывает 4010ую ошибку.
On Oct 31, 9:29 am, Fodoj <fodoj...@gmail.com> wrote:
> Не могу разобраться, так как толковых туториалов в сети нет, а в силу
> моего нубства в рельсах на данный момент, вот этиhttp://rdoc.info/github/jnunemaker/twitter/masterдоки ничем мне
31 октября 2010 г. 15:43 пользователь Кирилл Ширинкин
<fodo...@gmail.com> написал:
> --
> --
> Данное сообщение отправлено Вам, так как Вы являетесь подписчиком группы
> "RubyOnRails to russian" на группах Google.
> FAQ группы находится по адресу: http://ru.wikibooks.org/wiki/RubyFAQ
>
> Для того, чтобы отправить сообщение в эту группу, пошлите его по адресу
> ror...@googlegroups.com
> Чтобы отменить подписку на эту группу, отправьте сообщение по адресу:
> ror2ru-un...@googlegroups.com
> Дополнительные варианты находятся на странице группы
> http://groups.google.com/group/ror2ru?hl=ru
You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.each
>> y client.friends[0]
--- !map:Hashie::Mash
profile_sidebar_border_color: C0DEED
name: wycats
profile_background_tile: false
profile_sidebar_fill_color: DDEEF6
created_at: Thu Aug 30 04:07:52 +0000 2007
location: "iPhone: 37.786461,-122.394867"
profile_image_url: http://a2.twimg.com/profile_images/427781590/yehuda_normal.jpg
follow_request_sent: false
profile_link_color: 0084B4
id_str: "8526432"
favourites_count: 7
url: http://www.yehudakatz.com
contributors_enabled: false
id: 8526432
utc_offset: -28800
listed_count: 1034
profile_use_background_image: true
lang: en
profile_text_color: "333333"
protected: false
followers_count: 8844
description: HTML5 is a jewel that we need to cut into a weapon @dalmaer
verified: false
time_zone: Pacific Time (US & Canada)
notifications: false
profile_background_color: C0DEED
geo_enabled: false
status: !map:Hashie::Mash
coordinates:
favorited: false
truncated: false
created_at: Sat Oct 30 21:10:28 +0000 2010
id_str: "29217769977"
in_reply_to_user_id_str: "114816721"
text: "@senorprogrammer can you post your Gemfile to the bundler list or issue tracker. 3 hrs is ridiculous, and I'd be interested in learning more"
contributors:
id: 29217769977
in_reply_to_status_id_str: "29212443580"
retweet_count:
geo:
retweeted: false
in_reply_to_user_id: 114816721
source: <a href="http://www.echofon.com/" rel="nofollow">Echofon</a>
in_reply_to_screen_name: senorprogrammer
place:
in_reply_to_status_id: 29212443580
statuses_count: 5582
profile_background_image_url: http://s.twimg.com/a/1287523226/images/themes/theme1/bg.png
friends_count: 177
screen_name: wycats
show_all_inline_media: false
following: true