module Veyor

`Veyor` - The top level module for using methods to access veyor APIs

The following methods are provided:

More will be added in future `veyor` versions

@see www.appveyor.com/docs/api/ for detailed description of the Appveyor API

@see www.appveyor.com/docs/api/environments-deployments for documentation on the Environments API

You no longer are required to have an API key for all requests. If you're only doing GET requests against public projects you won't need a key, but if you're doing GET requests against non-public projects, or non-GET requests against any projects then you'll need a key.

veyor::Request

Class to perform HTTP requests to the Appveyor API

Constants

VERSION

Public Class Methods

build_artifacts(job_id:, options: nil, verbose: false) click to toggle source

List artifacts of a job

@param job_id [String] Job ID @!macro veyor_options @!macro veyor_verbose @return [Array] An array of hashes

@example

require 'veyor'
x = Veyor.build_artifacts(job_id: '4b9u720e2sjulln9')
# File lib/veyor.rb, line 312
def self.build_artifacts(job_id:, options: nil, verbose: false)
  route = sprintf('/buildjobs/%s/artifacts', job_id)
  Request.new(route, {}, nil, options, verbose).get
end
build_cancel(account: nil, project:, version:, options: nil, verbose: false) click to toggle source

Cancel a build

@!macro veyor_acct_proj @param version [String] Project version @!macro veyor_options @!macro veyor_verbose @return [Int] 204 on success

@example

require 'veyor'
# start a build
x = Veyor.build_start(project: 'cowsay')
x = Veyor.build_cancel(project: 'cowsay', version: '1.0.6088')
# File lib/veyor.rb, line 262
def self.build_cancel(account: nil, project:, version:, options: nil, verbose: false)
  route = sprintf('/builds/%s/%s/%s', get_account(account), project, version)
  Request.new(route, {}, nil, options, verbose).delete
end
build_delete(build_id:, options: nil, verbose: false) click to toggle source

Delete a build

@param build_id [String] Build ID @!macro veyor_options @!macro veyor_verbose @return [Int] 204 on success

@example

require 'veyor'
# start a build
x = Veyor.build_start(project: 'cowsay')
x = Veyor.build_delete(build_id: '17962865')
# File lib/veyor.rb, line 280
def self.build_delete(build_id:, options: nil, verbose: false)
  route = sprintf('/builds/%s', build_id)
  Request.new(route, {}, nil, options, verbose).delete
end
build_log(job_id:, options: nil, verbose: false) click to toggle source

Download a build log

@param job_id [String] Job ID @!macro veyor_options @!macro veyor_verbose @return [Array] An array of hashes

@example

require 'veyor'
x = Veyor.build_log(job_id: '4b9u720e2sjulln9')
# File lib/veyor.rb, line 296
def self.build_log(job_id:, options: nil, verbose: false)
  route = sprintf('/buildjobs/%s/log', job_id)
  Request.new(route, {}, nil, options, verbose).get
end
build_start(account: nil, project:, branch: 'master', options: nil, verbose: false) click to toggle source

Start build of branch of most recent commit

@!macro veyor_acct_proj @!macro veyor_options @!macro veyor_verbose @param branch [String] Branch name @return [Array] An array of hashes

@example

require 'veyor'
# start a build
x = Veyor.build_start(project: 'cowsay')
# File lib/veyor.rb, line 242
def self.build_start(account: nil, project:, branch: 'master', options: nil, verbose: false)
  body = { :accountName => get_account(account),
    :projectSlug => project, :branch => branch }
  Request.new('builds', {}, body, options, verbose).post
end
environment_settings(id:, options: nil, verbose: false) click to toggle source

Get environment settings

@param id [String] A deployment environment ID @!macro veyor_options @!macro veyor_verbose @return [Array] An array of hashes

@example

require 'veyor'
Veyor.environment_settings(id: 123456)
# File lib/veyor.rb, line 342
def self.environment_settings(id:, options: nil, verbose: false)
  route = sprintf('/environments/%s/settings', id)
  Request.new(route, {}, nil, options, verbose).get
end
environments(options: nil, verbose: false) click to toggle source

environments

Get environments

@!macro veyor_options @!macro veyor_verbose @return [Array] An array of hashes

@example

require 'veyor'
x = Veyor.environments
# File lib/veyor.rb, line 328
def self.environments(options: nil, verbose: false)
  Request.new('environments', {}, nil, options, verbose).get
end
project(account: nil, project: nil, branch: nil, version: nil, options: nil, verbose: false) click to toggle source

Get a single project - gets the latest build

@!macro veyor_acct_proj @!macro veyor_options @!macro veyor_verbose @param branch [String] Branch name @param version [String] Project version @return [Array] An array of hashes

@example

require 'veyor'
# if account_name already set up
Veyor.project(project: 'cowsay')

# if not, or to fetch a project not under your account
Veyor.project(account: 'sckott', project: 'cowsay')

# get by branch
Veyor.project(project: 'cowsay', branch: 'changeback')

# get by version
Veyor.project(project: 'cowsay', version: '1.0.692')
# File lib/veyor.rb, line 112
def self.project(account: nil, project: nil, branch: nil,
  version: nil, options: nil, verbose: false)

  route = prep_route('projects', get_account(account), project, branch, version)
  Request.new(route, {}, nil, options, verbose).get
end
project_add(provider:, slug:, options: nil, verbose: false) click to toggle source

Add a project

@param provider [String] provider name, one of gitHub, bitBucket, vso,

gitLab, kiln, stash, git, mercurial, subversion

@param slug [String] a project slug like e.g., foo/bar @!macro veyor_options @!macro veyor_verbose @return [Hash] A hash

@example

require 'veyor'
Veyor.project_add(provider: 'gitHub', slug: 'sckott/httpcode')
# File lib/veyor.rb, line 132
def self.project_add(provider:, slug:, options: nil, verbose: false)
  route = prep_route('projects', nil, nil, nil, nil)
  body = { :repositoryProvider => check_provider(provider),
    :repositoryName => slug }
  Request.new(route, {}, body, options, verbose).post
end
project_delete(account:, project:, options: nil, verbose: false) click to toggle source

Delete a project

@!macro veyor_acct_proj @!macro veyor_options @!macro veyor_verbose @return [Int] 204 on success

@example

require 'veyor'
Veyor.project_delete(account: 'sckott', project: 'httpcode')
# File lib/veyor.rb, line 150
def self.project_delete(account:, project:, options: nil, verbose: false)
  route = prep_route('projects', account, project, nil, nil)
  Request.new(route, {}, nil, options, verbose).delete
end
project_deployments(account: nil, project: nil, options: nil, verbose: false) click to toggle source

Get project deployments

@!macro veyor_acct_proj @!macro veyor_options @!macro veyor_verbose @return [Array] An array of hashes

@example

require 'veyor'
# get project deployments
x = Veyor.project_deployments(project: 'cowsay');
x['deployments']
# File lib/veyor.rb, line 199
def self.project_deployments(account: nil, project: nil, options: nil, verbose: false)
  route = sprintf('/projects/%s/%s/deployments', get_account(account), project)
  Request.new(route, {}, nil, options, verbose).get
end
project_history(account: nil, project: nil, limit: 10, start_build: nil, branch: nil, options: nil, verbose: false) click to toggle source

Get project history

@!macro veyor_acct_proj @!macro veyor_options @!macro history_params @!macro veyor_verbose @return [Array] An array of hashes

@example

require 'veyor'
# get project history
x = Veyor.project_history(project: 'cowsay');
x['builds'].collect { |x| x['status'] }

# limit results
Veyor.project_history(project: 'cowsay', limit: 3)

# start by a certain build version
Veyor.project_history(project: 'cowsay', start_build: 2872582)

# get by branch
Veyor.project_history(project: 'cowsay', branch: 'changeback')
# File lib/veyor.rb, line 178
def self.project_history(account: nil, project: nil, limit: 10,
  start_build: nil, branch: nil, options: nil, verbose: false)

  route = sprintf('/projects/%s/%s/history', get_account(account), project)
  args = prep_args(limit, start_build, branch)
  Request.new(route, args, nil, options, verbose).get
end
project_settings(account: nil, project: nil, yaml: false, options: nil, verbose: false) click to toggle source

Get project settings

@!macro veyor_acct_proj @param yaml [Boolean] Return yaml version of project settings. Default: false @!macro veyor_options @!macro veyor_verbose @return [Array] An array of hashes

@example

require 'veyor'
# get project history
x = Veyor.project_settings(project: 'cowsay')
x['settings']
x['settings']['configuration']
# get yaml data
x = Veyor.project_settings(project: 'cowsay', yaml: true)
# File lib/veyor.rb, line 221
def self.project_settings(account: nil, project: nil, yaml: false, options: nil, verbose: false)
  route = sprintf('/projects/%s/%s/settings', get_account(account), project)
  if yaml
    route = route + '/yaml'
  end
  Request.new(route, {}, nil, options, verbose).get
end
projects(options: nil, verbose: false) click to toggle source

Fetch projects

@!macro veyor_options @!macro veyor_verbose @return [Array] An array of hashes

@example

require 'veyor'
Veyor.projects
# File lib/veyor.rb, line 84
def self.projects(options: nil, verbose: false)
  route = prep_route('projects', nil, nil, nil, nil)
  Request.new(route, {}, nil, options, verbose).get
end