Skip to content

Commit

Permalink
Merge pull request #13842 from jntullo/enhancement/return_config_info
Browse files Browse the repository at this point in the history
Add config_info as additional attribute to Service Templates API
  • Loading branch information
abellotti committed Feb 13, 2017
2 parents 6bb97e0 + 6b6c6aa commit ca866e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/controllers/api/service_templates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@ class ServiceTemplatesController < BaseController
include Subcollections::Tags
include Subcollections::ResourceActions
include Subcollections::ServiceRequests

before_action :set_additional_attributes, :only => [:show]

private

def set_additional_attributes
@additional_attributes = %w(config_info)
end
end
end
12 changes: 12 additions & 0 deletions spec/requests/api/service_templates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@
"resource_id" => template.id,
"image_href" => /^http:.*#{picture.image_href}$/)
end

it 'returns config_info for a specific service_template resource' do
api_basic_authorize action_identifier(:service_templates, :read, :resource_actions, :get)

run_get(service_templates_url(template.id))

expected = {
'config_info' => template.config_info.deep_stringify_keys
}
expect(response).to have_http_status(:ok)
expect(response.parsed_body).to include(expected)
end
end

describe "Service Templates edit" do
Expand Down

0 comments on commit ca866e1

Please sign in to comment.