Sha256: 60b85e44d442f33e10a733c0d47cbcb7446e52b1b4a7177837eb186f4d57415e

Contents?: true

Size: 922 Bytes

Versions: 6

Compression:

Stored size: 922 Bytes

Contents

# frozen_string_literal: true

require 'travis/client/weak_entity'
require 'json'

module Travis
  module Client
    class Settings < WeakEntity
      attr_accessor :repository

      # @!parse attr_reader :builds_only_with_travis_yml, :build_pushes, :build_pull_requests, :maximum_number_of_builds, :auto_cancel_pushes, :auto_cancel_pull_requests
      attributes :builds_only_with_travis_yml, :build_pushes, :build_pull_requests, :maximum_number_of_builds,
                 :auto_cancel_pushes, :auto_cancel_pull_requests
      one :settings
      many :settings

      def save
        raise 'repository unknown' unless repository

        result = session.patch("/repos/#{repository.id}/settings", JSON.dump('settings' => attributes))
        attributes.replace(result['settings'].attributes)
        self
      end

      def inspect_info
        repository ? repository.slug : repository
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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