Sha256: 2b5bc91704f2a7f934368e90d6ebf23a98a14ff24c50471efae318ddbce1e67b

Contents?: true

Size: 1022 Bytes

Versions: 4

Compression:

Stored size: 1022 Bytes

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 :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

4 entries across 4 versions & 1 rubygems

Version Path
travis-1.5.5 lib/travis/client/build.rb
travis-1.5.4 lib/travis/client/build.rb
travis-1.5.3 lib/travis/client/build.rb
travis-1.5.2 lib/travis/client/build.rb