Sha256: 9cf0fc779cac14bc698abeade49b6ac3598f93951dbf019470d8736d99271bcc

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

# encoding: UTF-8

# Global requires
require 'multi_json'

# Local requires
require 'gooddata/models/models'

module ProjectHelper
  PROJECT_ID = 'we1vvh4il93r0927r809i3agif50d7iz'
  PROJECT_URL = "/gdc/projects/#{PROJECT_ID}"
  PROJECT_TITLE = 'GoodTravis'
  PROJECT_SUMMARY = 'No summary'

  def self.get_default_project(opts = { :client => GoodData.connection })
    GoodData::Project[PROJECT_ID, opts]
  end

  def self.delete_old_projects(opts = {:client => GoodData.connection})
    projects = opts[:client].projects
    projects.each do |project|
      next if project.json['project']['meta']['author'] != client.user.uri
      next if project.pid == 'we1vvh4il93r0927r809i3agif50d7iz'
      begin
        puts "Deleting project #{project.title}"
        project.delete
      rescue e
        puts 'ERROR: ' + e.to_s
      end
    end
  end

  def self.create_random_user(client)
    num = rand(1e7)
    login = "gemtest#{num}@gooddata.com"

    GoodData::Membership.create({
      email: login,
      login: login,
      first_name: 'the',
      last_name: num.to_s,
      role: 'editor',
      password: CryptoHelper.generate_password,
      domain: ConnectionHelper::DEFAULT_DOMAIN
    }, client: client)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gooddata-0.6.15 spec/helpers/project_helper.rb
gooddata-0.6.14 spec/helpers/project_helper.rb
gooddata-0.6.13 spec/helpers/project_helper.rb