Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

minne の API 改善

7,445 views

Published on

Rubyエンジニアが語る、2016年の振り返りとこれから
GMOペパボ株式会社・株式会社Speee

minne で 2016 年に行った API 改善の一部を紹介

Published in: Technology
  • Be the first to comment

minne の API 改善

  1. 1. 1.
  2. 2. 🙅
  3. 3. # Gemfile + gem 'log-analyzer' $ bundle exec rake log_analyzer:analyze ┏━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓ ┃ method ┃ endpoint ┃ count ┃ response_time(avg) ┃ response_time(max) ┃ response_time(min) ┃ ┣━━━━━━━━╊━━━━━━━━━━━━╊━━━━━━━╊━━━━━━━━━━━━━━━━━━━━╊━━━━━━━━━━━━━━━━━━━━╊━━━━━━━━━━━━━━━━━━━━┫ ┃ GET ┃ / ┃ 10 ┃ 20.5 ┃ 55 ┃ 3 ┃ ┃ GET ┃ /users ┃ 5 ┃ 10.3 ┃ 30 ┃ 3 ┃ ┃ GET ┃ /users/:id ┃ 3 ┃ 10 ┃ 15 ┃ 5 ┃ ┃ POST ┃ /users ┃ 2 ┃ 30 ┃ 40 ┃ 20 ┃ ┃ DELETE ┃ /users/:id ┃ 0 ┃ ┃ ┃ ┃ ┗━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━━┻━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━┛
  4. 4. 2.
  5. 5. # routes.rb scope :v1 do resources :users, controller: 'v3/users' end scope :v3 do resources :users end
  6. 6. # routes.rb scope :v1 do resources :users, controller: 'v3/users' end
  7. 7. module RenderReplaceable def _prefixes request_version = request.path.match(//v[0-9]//).to_s self.class._prefixes.map do |prefix| prefix.sub(/^api/v[0-9]//, "api#{request_version}") end end end
  8. 8. 🙆 🙆

×