Skip to content

Instantly share code, notes, and snippets.

@maccman maccman/version.rb

Created May 15, 2015
Embed
What would you like to do?
module PersonHub
module Extensions
module Version extend self
CURRENT_API_VERSION = '2015-04-30'
def registered(app)
app.set(:version) do |value|
condition { request_api_version >= value }
end
app.helpers Helpers
end
module Helpers
def request_api_version
header_api_version || account_api_version
end
def header_api_version
env['HTTP_API_VERSION']
end
def account_api_version
if current_account.person_api_version.blank?
current_account.update_all(person_api_version: CURRENT_API_VERSION)
end
current_account.person_api_version
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.