README.md in versioncake-3.4.0 vs README.md in versioncake-4.0.0

- old
+ new

@@ -1,11 +1,10 @@ ![Version Cake](https://raw.github.com/alicial/versioncake/master/images/versioncake-logo450x100.png) [![Build Status](https://secure.travis-ci.org/bwillis/versioncake.png?branch=master)](http://travis-ci.org/bwillis/versioncake) [![Code Climate](https://codeclimate.com/github/bwillis/versioncake.png)](https://codeclimate.com/github/bwillis/versioncake) [![Coverage Status](https://coveralls.io/repos/bwillis/versioncake/badge.png?branch=master)](https://coveralls.io/r/bwillis/versioncake) -[![Dependency Status](https://gemnasium.com/bwillis/versioncake.png)](https://gemnasium.com/bwillis/versioncake) [![Gem Version](https://badge.fury.io/rb/versioncake.png)](http://badge.fury.io/rb/versioncake) Co-authored by Ben Willis ([bwillis](https://github.com/bwillis/)) and Jim Jones ([aantix](https://github.com/aantix)). Version Cake is an unobtrusive way to version APIs in your Rails app. @@ -312,11 +311,11 @@ If you start supporting a newer version, v3 for instance, you do not have to copy posts/show.v2 to posts/show.v3. By default, the request for v3 or higher will gracefully degrade to the view that is the newest, supported version, in this case posts/show.v2. ### Controller -You don't need to do anything special in your controller, but if you find that you want to perform some tasks for a specific version you can use `requested_version` and `latest_version`. This may be updated in the [near future](https://github.com/bwillis/versioncake/issues/1). +You don't need to do anything special in your controller, but if you find that you want to perform some tasks for a specific version you can use `request_version` and `version_context.resource.latest_version`. This may be updated in the [near future](https://github.com/bwillis/versioncake/issues/1). ```ruby def index # shared code for all versions @posts = Post.scoped @@ -354,11 +353,11 @@ private def render_unsupported_version headers['API-Version-Supported'] = 'false' respond_to do |format| - format.json { render json: {message: "You requested an unsupported version (#{requested_version})"}, status: :unprocessable_entity } + format.json { render json: {message: "You requested an unsupported version (#{request_version})"}, status: :unprocessable_entity } end end ... @@ -396,16 +395,16 @@ end ``` ### Testing all supported versions -You can iterate over all of the supported version numbers by accessing the ```AppName::Application.config.versioncake.supported_version_numbers```. +You can iterate over all of the supported version numbers by accessing the ```VersionCake.config.versioned_resources.first.available_versions```. ```ruby -VersionCake.config.resources.first.supported_versions.each do |supported_version| +VersionCake.config.versioned_resources.first.available_versions.each do |supported_version| before do - @controller.stubs(:requested_version).returns(supported_version) + @controller.stubs(:request_version).returns(supported_version) end test "all versions render the correct template" do get :index assert_equal @response.body, "index.html.v1.erb" @@ -434,9 +433,10 @@ * [Jeroen K.](https://github.com/jrnkntl) * [Masaya Myojin](https://github.com/mmyoji) * [John Hawthorn](https://github.com/jhawthorn) * [Ersin Akinci](https://github.com/earksiinni) * [Bartosz Bonisławski](https://github.com/bbonislawski) +* [Harry Lascelles](https://github.com/hlascelles) # Related Material ## Usages