Skip to content

Instantly share code, notes, and snippets.

@thomasmckay
Last active December 26, 2015 19:39
Show Gist options
  • Save thomasmckay/7203406 to your computer and use it in GitHub Desktop.
Save thomasmckay/7203406 to your computer and use it in GitHub Desktop.

Activation Keys

Routes - config/routes/api/v2.rb

api_resources :activation_keys, :only => [:show, :index, :create, :update, :destroy] do
  api_resources :subscriptions, :only => [:show, :index, :create, :update, :destroy] do
    match '/available' => 'activatoin_keys#available_subscriptions', :via => :get
  end
end

JSON

GET /activation_keys/$id show.json.rabl

object @activation_key
extends 'api/v2/common/identifier'
extends 'api/v2/common/org_reference'
attributes :usage_count, :user_id, :usage_limit, :system_template_id
attributes :pools => :subscriptions
child :system_groups => :systemGroups do
  attributes :id, :name, :description, :total_systems
end
child :systems => :systems do
  extends 'api/v2/systems/show'
end
attributes :content_view
child :environment => :environment do
  extends 'api/v2/environments/show'
end
extends 'api/v2/common/timestamps'
extends 'api/v2/common/readonly'
  {
    id: $id,
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment