class ChefZero::Endpoints::UserOrganizationsEndpoint

/users/USER/organizations

Public Instance Methods

get(request) click to toggle source
# File lib/chef_zero/endpoints/user_organizations_endpoint.rb, line 8
def get(request)
  username = request.rest_path[1]
  result = list_data(request, [ "organizations" ]).select do |orgname|
    exists_data?(request, [ "organizations", orgname, "users", username ])
  end
  result = result.map do |orgname|
    org = get_data(request, [ "organizations", orgname, "org" ])
    org = FFI_Yajl::Parser.parse(org)
    { "organization" => ChefData::DataNormalizer.normalize_organization(org, orgname) }
  end
  json_response(200, result)
end