lib/gooddata/models/domain.rb
# Runs async process that walks through segments and provisions projects if necessary.
#
# @return [Enumerator] Returns Enumerator of results
Runs async process that walks through segments and provisions projects if necessary.
Runs async process that walks through segments and provisions projects if necessary .
def provision_client_projects(segments = nil)
      body = if segments
               {
                 provisionClientProjects: {
                   segments: segments.is_a?(Array) ? segments : [segments]
                 }
               }
             end
      res = client.post(segments_uri + '/provisionClientProjects', body)
      res = client.poll_on_code(res['asyncTask']['links']['poll'])
      failed_count = GoodData::Helpers.get_path(res, %w(clientProjectProvisioningResult failed count), 0)
      created_count = GoodData::Helpers.get_path(res, %w(clientProjectProvisioningResult created count), 0)
      return Enumerator.new([]) if failed_count + created_count == 0 
      Enumerator.new do |y|
        uri = GoodData::Helpers.get_path(res, %w(clientProjectProvisioningResult links details))
        loop do
          result = client.get(uri)
          (GoodData::Helpers.get_path(result, %w(clientProjectProvisioningResultDetails items)) || []).each do |item|
            y << ProvisioningResult.new(item['id'], item['status'], item['project'], item['error'])
          end
          uri = GoodData::Helpers.get_path(res, %w(clientProjectProvisioningResultDetails paging next))
          break if uri.nil?
        end
      end
    end
def provision_client_projects ( segments = nil ) body = if segments { provisionClientProjects : { segments : segments . is_a? ( Array ) ? segments : [ segments ] } } end res = client . post ( segments_uri + '/provisionClientProjects' , body ) res = client . poll_on_code ( res [ 'asyncTask' ] [ 'links' ] [ 'poll' ] ) failed_count = GoodData :: Helpers . get_path ( res , %w( clientProjectProvisioningResult failed count ) , 0 ) created_count = GoodData :: Helpers . get_path ( res , %w( clientProjectProvisioningResult created count ) , 0 ) return Enumerator . new ( [ ] ) if failed_count + created_count == 0 Enumerator . new do | y | uri = GoodData :: Helpers . get_path ( res , %w( clientProjectProvisioningResult links details ) ) loop do result = client . get ( uri ) ( GoodData :: Helpers . get_path ( result , %w( clientProjectProvisioningResultDetails items ) ) || [ ] ) . each do | item | y << ProvisioningResult . new ( item [ 'id' ] , item [ 'status' ] , item [ 'project' ] , item [ 'error' ] ) end uri = GoodData :: Helpers . get_path ( res , %w( clientProjectProvisioningResultDetails paging next ) ) break if uri . nil? end end end
Runs async process that walks through segments and provisions projects if necessary.
Runs async process that walks through segments and provisions projects if necessary .
# rubocop:disable Style/NumericPredicate
Returns Enumerator of results
Returns Enumerator of results
Enumerator
segments