Sha256: c9863933159f2fe44b36d2836e7204a3b6e3ab60493f2c973b0fb2e3c4befe6e

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

require 'travis/client'

module Travis
  module Client
    class Build < Entity
      include States, Restartable

      # @!parse attr_reader :repository_id, :commit_id, :number, :pull_request, :config, :state, :started_at, :finished_at, :duration, :job_ids
      attributes :repository_id, :commit_id, :number, :pull_request, :config, :state, :started_at, :finished_at, :duration, :job_ids
      time :started_at, :finished_at

      alias pull_request? pull_request

      # @!parse attr_reader :repository, :commit, :jobs
      has :repository, :commit, :jobs

      one :build
      many :builds
      aka :branch, :branches

      def push?
        not pull_request?
      end

      def pr_number
        commit.compare_url[/\d+$/] if pull_request?
      end

      def branch_info
        pull_request? ? "Pull Request ##{pr_number}" : commit.branch
      end

      def pusher_channels
        repository.pusher_channels
      end

      def inspect_info
        "#{repository.slug}##{number}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
travis-1.5.6.travis.303.4 lib/travis/client/build.rb
travis-1.5.6.travis.301.4 lib/travis/client/build.rb
travis-1.5.6.travis.299.4 lib/travis/client/build.rb
travis-1.5.6.travis.297.4 lib/travis/client/build.rb
travis-1.5.6.travis.296.4 lib/travis/client/build.rb