Sha256: 045ee3d4f6aec6db50d570581e14acb5608a11ceaed77c75d262ff7d19bff269

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'travis/client/weak_entity'

module Travis
  module Client
    class Request < WeakEntity
      # @!parse attr_reader :commit_id, :repository_id, :created_at, :owner_id, :owner_type, :event_type, :base_commit, :head_commit, :result, :message, :pull_request, :pull_request_number, :pull_request_title, :branch, :tag
      attributes :commit_id, :repository_id, :created_at, :owner_id, :owner_type, :event_type, :base_commit,
                 :head_commit, :result, :message, :pull_request, :pull_request_number, :pull_request_title, :branch, :tag
      time :created_at

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

      one  :request
      many :requests

      def owner
        repository.owner
      end

      def accepted?
        result == 'accepted'
      end

      def rejected?
        result == 'rejected'
      end

      def inspect_info
        [
          repository && repository.slug,
          event_type, branch || pull_request_number, result
        ].compact.join(' ')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
travis-1.14.0 lib/travis/client/request.rb
travis-1.13.3 lib/travis/client/request.rb
travis-1.13.2 lib/travis/client/request.rb
travis-1.13.1 lib/travis/client/request.rb
travis-1.13.0 lib/travis/client/request.rb
travis-1.12.0 lib/travis/client/request.rb