Sha256: 213122c42e0b7c8c931944b9f04be2fac22af91a76bf5dc72ee7a6f26ca40157

Contents?: true

Size: 674 Bytes

Versions: 226

Compression:

Stored size: 674 Bytes

Contents

require 'json'

module Travis
  module Client
    class SingletonSetting < Entity
      def self.base_path
        "settings/#{one}"
      end

      has :repository

      def repository_id
        id
      end

      def path
        "#{self.class.base_path}/#{id}"
      end

      def update(values = {})
        values = { 'value' => values } unless values.is_a? Hash
        values.each { |key, value| attributes[key.to_s] = value.to_s }
        session.patch_raw(path, JSON.dump(self.class.one => attributes))
        reload
      end

      def delete
        session.delete_raw(path)
        reload
        true
      end

      alias save update
    end
  end
end

Version data entries

226 entries across 226 versions & 3 rubygems

Version Path
travis-1.11.1 lib/travis/client/singleton_setting.rb
travis-1.11.0 lib/travis/client/singleton_setting.rb
travis-1.10.1.travis.1341.9 lib/travis/client/singleton_setting.rb
travis-1.10.1.travis.1321.9 lib/travis/client/singleton_setting.rb
travis-1.10.1.travis.1312.9 lib/travis/client/singleton_setting.rb
travis-1.10.1.travis.1311.9 lib/travis/client/singleton_setting.rb
travis-1.10.1.travis.1305.9 lib/travis/client/singleton_setting.rb
travis-1.10.0 lib/travis/client/singleton_setting.rb
travis-1.9.2.travis.1304.9 lib/travis/client/singleton_setting.rb
travis-1.9.2.travis.1303.9 lib/travis/client/singleton_setting.rb
travis-1.10.0.pre.rc4 lib/travis/client/singleton_setting.rb
travis-1.10.0.pre.rc3 lib/travis/client/singleton_setting.rb
travis-1.10.0.pre.rc2 lib/travis/client/singleton_setting.rb
travis-1.9.2.travis.1288.9 lib/travis/client/singleton_setting.rb
travis-1.9.2.travis.1285.9 lib/travis/client/singleton_setting.rb
travis-1.9.2.travis.1279.9 lib/travis/client/singleton_setting.rb
travis-1.10.0.pre.rc1 lib/travis/client/singleton_setting.rb
travis-1.9.2.travis.1254.9 lib/travis/client/singleton_setting.rb
travis-1.9.2.travis.1236.9 lib/travis/client/singleton_setting.rb
travis-1.9.2.travis.1224.9 lib/travis/client/singleton_setting.rb