Sha256: 9f3e94a677730b5f99e3295918f5fe4d31ca9239e82a8eeaf5ac6d1a62c8dbd3

Contents?: true

Size: 1.3 KB

Versions: 19

Compression:

Stored size: 1.3 KB

Contents

module Percy
  class Config
    # @!attribute [w] access_token
    #   @return [String] Percy repo access token.
    # @!attribute api_url
    #   @return [String] Base URL for API requests. Default: https://percy.io/api/v1/
    # @!attribute debug
    #   @return [Boolean] Whether or not to enable debug logging.
    # @!attribute repo
    #   @return [String] Git repo name.
    # @!attribute default_widths
    #   @return [Array] List of default widths for snapshot rendering unless overridden.

    attr_writer :access_token
    attr_writer :api_url
    attr_writer :debug
    attr_writer :repo
    attr_writer :default_widths

    # List of configurable keys for {Percy::Client}
    # @return [Array] Option keys.
    def keys
      @keys ||= [
        :access_token,
        :api_url,
        :debug,
        :repo,
        :default_widths,
      ]
    end

    def access_token
      @access_token ||= ENV['PERCY_TOKEN']
    end

    def api_url
      @api_url ||= ENV['PERCY_API'] || 'https://percy.io/api/v1'
    end

    def debug
      @debug ||= ENV['PERCY_DEBUG'] == '1'
    end

    def repo
      @repo ||= Percy::Client::Environment.repo
    end

    # List of default widths sent for every snapshot, unless overridden on a per-snapshot basis.
    def default_widths
      @default_widths ||= []
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
percy-client-1.15.0 lib/percy/config.rb
percy-client-1.14.1 lib/percy/config.rb
percy-client-1.14.0 lib/percy/config.rb
percy-client-1.13.10 lib/percy/config.rb
percy-client-1.13.9 lib/percy/config.rb
percy-client-1.13.8 lib/percy/config.rb
percy-client-1.13.7 lib/percy/config.rb
percy-client-1.13.6 lib/percy/config.rb
percy-client-1.13.5 lib/percy/config.rb
percy-client-1.13.4 lib/percy/config.rb
percy-client-1.13.3 lib/percy/config.rb
percy-client-1.13.2 lib/percy/config.rb
percy-client-1.13.1 lib/percy/config.rb
percy-client-1.13.0 lib/percy/config.rb
percy-client-1.12.0 lib/percy/config.rb
percy-client-1.11.0 lib/percy/config.rb
percy-client-1.10.1 lib/percy/config.rb
percy-client-1.10.0 lib/percy/config.rb
percy-client-1.9.2 lib/percy/config.rb