Sha256: b574fabe981128dd2e85bb14ee3768ed5ea43e0bec9967f3ab2d564a1cd9740b

Contents?: true

Size: 1.14 KB

Versions: 12

Compression:

Stored size: 1.14 KB

Contents

module Percy
  class Config
    # @!attribute [w] access_token
    #   @return [String] Percy project 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 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 :default_widths

    # List of configurable keys for {Percy::Client}
    # @return [Array] Option keys.
    def keys
      @keys ||= [
        :access_token,
        :api_url,
        :debug,
        :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

    # 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

12 entries across 12 versions & 1 rubygems

Version Path
percy-client-2.1.1 lib/percy/config.rb
percy-client-2.1.0 lib/percy/config.rb
percy-client-2.0.9 lib/percy/config.rb
percy-client-2.0.8 lib/percy/config.rb
percy-client-2.0.7 lib/percy/config.rb
percy-client-2.0.6 lib/percy/config.rb
percy-client-2.0.5 lib/percy/config.rb
percy-client-2.0.4 lib/percy/config.rb
percy-client-2.0.3 lib/percy/config.rb
percy-client-2.0.2 lib/percy/config.rb
percy-client-2.0.1 lib/percy/config.rb
percy-client-2.0.0 lib/percy/config.rb