Sha256: 92ecbb3511084873cd8737a44a06d396c8a5a4620877e60bbb69d7036c6d723a
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require 'async_request/engine' module AsyncRequest VALID_ALGORITHMS = %w[HS256 RS256].freeze @config = { sign_algorithm: 'HS256', encode_key: nil, decode_key: nil, token_expiration: 86_400, request_header_key: 'X-JOB-AUTHORIZATION', queue: 'default', retry: false } def self.configure yield self end def self.sign_algorithm=(sign_algorithm) raise ArgumentError unless VALID_ALGORITHMS.include?(sign_algorithm) @config[:sign_algorithm] = sign_algorithm end def self.encode_key=(encode_key) @config[:encode_key] = encode_key end def self.decode_key=(decode_key) @config[:decode_key] = decode_key end def self.token_expiration=(token_expiration) @config[:token_expiration] = token_expiration end def self.request_header_key=(request_header_key) @config[:request_header_key] = request_header_key end def self.queue=(queue) @config[:queue] = queue end def self.retry=(retry_times) raise ArgumentError unless [true, false].include?(retry_times) || retry_times.is_a?(Integer) @config[:retry] = retry_times end def self.config @config end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
async_request-1.0.0 | lib/async_request.rb |