summaryrefslogtreecommitdiff
path: root/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb
blob: e1b6a7e646950b145b325a3815722336dc0a25a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'ffi_yajl'
require 'chef_zero/rest_base'

module ChefZero
  module Endpoints
    # /organizations/ORG/association_requests
    class OrganizationAssociationRequestsEndpoint < RestBase
      def post(request)
        ChefZero::Endpoints::OrganizationUserBase.post(self, request, 'user')
      end

      def get(request)
        orgname = request.rest_path[1]
        ChefZero::Endpoints::OrganizationUserBase.get(self, request) do |username|
          { "id" => "#{username}-#{orgname}", 'username' => username }
        end
      end
    end
  end
end