Module: Sinatra::TwitterServer::Helpers
- Defined in:
- lib/twitter_server.rb
Instance Method Summary collapse
- #api_options(*keys) ⇒ Object
- #render_xml(root) ⇒ Object
- #render_xml_statuses(statuses) ⇒ Object
- #render_xml_user(user) ⇒ Object
Instance Method Details
#api_options(*keys) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/twitter_server.rb', line 25 def (*keys) = {} [:auth] = @auth if @auth keys.inject() do |memo, key| params.include?(key.to_s) ? memo.update(key => params[key]) : memo end end |
#render_xml(root) ⇒ Object
49 50 51 52 53 |
# File 'lib/twitter_server.rb', line 49 def render_xml(root) ::TwitterServer.xml_renderer.new(root) do |renderer| yield renderer end.to_s end |
#render_xml_statuses(statuses) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/twitter_server.rb', line 33 def render_xml_statuses(statuses) render_xml(:statuses) do |r| statuses.each do |st| r.node(:status) do r.status(st) end end end end |
#render_xml_user(user) ⇒ Object
43 44 45 46 47 |
# File 'lib/twitter_server.rb', line 43 def render_xml_user(user) render_xml(:user) do |r| r.user(user) end end |