Sha256: 0acecfdda1ab0c159227d23445dd54a29c7aa9b5b77aaceb64b18d34ec627a07
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
# encoding: utf-8 # :nordoc: module Lexer # :nordoc: module Identity # Stores configuration details for communicating with the Lexer Identiy API. class Configuration # The full path to the API and endpoint attr_accessor :api_url # the API token provided by Lexer attr_accessor :api_token # the contributor token provided by Lexer attr_accessor :contributor_token # the consumer token provided by Lexer attr_accessor :consumer_token # Creates the configuration instance and defines default values def initialize @api_url = 'https://identity.lexer.io/identity' @api_token = nil @contributor_token = nil @consumer_token = nil end # validates the current configuration, raising exceptions when invalid def validate fail Lexer::Identity::ConfigurationError, 'An API token is required' if @api_token.nil? fail Lexer::Identity::ConfigurationError, 'A Contributor or Consumer token is required' if @contributor_token.nil? && @consumer_token.nil? fail Lexer::Identity::ConfigurationError, 'Contributor and Consumer tokens are not interchangable' if @contributor_token == @consumer_token end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lexer-identity-0.2.1 | lib/lexer/identity/configuration.rb |
lexer-identity-0.2.0 | lib/lexer/identity/configuration.rb |
lexer-identity-0.1.0 | lib/lexer/identity/configuration.rb |