Sha256: f84d4d95192119b7edfcb12605c133065c78c8597980d349951606664160b1f2
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module FinAppsCore module REST # Represents the client configuration options class Configuration # :nodoc: using ObjectExtensions attr_accessor :tenant_token, :user_identifier, :user_token, :host, :proxy, :timeout, :retry_limit, :rashify, :log_level, :request_id def initialize(options={}) FinAppsCore::REST::Defaults::DEFAULTS.merge(remove_empty_options(options)) .each {|key, value| public_send("#{key}=", value) } raise FinAppsCore::InvalidArgumentsError.new "Invalid argument. {host: #{host}}" unless valid_host? raise FinAppsCore::InvalidArgumentsError.new "Invalid argument. {timeout: #{timeout}}" unless timeout.integer? end def valid_user_credentials? FinAppsCore::REST::Credentials.new(user_identifier, user_token).valid? end private def valid_host? host.start_with?('http://', 'https://') end def remove_empty_options(hash) hash.reject {|_, value| value.nil? } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
finapps_core-3.0.6 | lib/finapps_core/rest/configuration.rb |
finapps_core-3.0.5 | lib/finapps_core/rest/configuration.rb |
finapps_core-3.0.3 | lib/finapps_core/rest/configuration.rb |