You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
module Twitter class API < Grape::API version 'v1', using: :header, vendor: 'twitter' format :json prefix :api helpers do def current_user @current_user ||= User.authorize!(env) end def authenticate! error!('401 Unauthorized', 401) unless current_user end end resource :statuses do desc 'Return a public timeline.' get :public_timeline do Status.limit(20) end desc 'Return a personal timeline.' get :
Grape は Ruby で API を書くのに便利なフレームワークです。 Grape 自体については fakestarbaby 氏がすでにすてきなエントリを書いてくださっています。 Grape | API生成マイクロフレームワーク #Rails #Gems #Ruby #grape #api_builders - Qiita ここではどうやってテストを書くのかということについて書いてみたいと思います。 想定 RSpec の受け入れテストの request_spec を使うよ API は JSON を返すよ API 用のサブドメイン(api.foobar.com)を切っているよ JSON のテストは json_expressions を使うよ(参考) OAuth 2.0 の Provider になって Web Application Flow とかで認証しちゃったり モックは Factor
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く