lib/flexirest/configuration.rb in flexirest-1.3.14 vs lib/flexirest/configuration.rb in flexirest-1.3.15

- old
+ new

@@ -8,10 +8,11 @@ @@password = nil @@request_body_type = :form_encoded @lazy_load = false @api_auth_access_id = nil @api_auth_secret_key = nil + @api_auth_options = {} def base_url(value = nil) @base_url ||= nil @@base_url ||= nil if value.nil? @@ -134,19 +135,20 @@ def whiny_missing(value = nil) @whiny_missing ||= false value ? @whiny_missing = value : @whiny_missing end - def api_auth_credentials(access_id, secret_key) + def api_auth_credentials(access_id, secret_key, options = {}) begin require 'api-auth' rescue LoadError raise MissingOptionalLibraryError.new("You must include the gem 'api-auth' in your Gemfile to set api-auth credentials.") end @api_auth_access_id = access_id @api_auth_secret_key = secret_key + @api_auth_options = options end def using_api_auth? !self.api_auth_access_id.nil? && !self.api_auth_secret_key.nil? end @@ -168,9 +170,19 @@ elsif self.superclass.respond_to?(:api_auth_secret_key) return self.superclass.api_auth_secret_key end return nil + end + + def api_auth_options + if !@api_auth_options.nil? + return @api_auth_options + elsif self.superclass.respond_to?(:api_auth_options) + return self.superclass.api_auth_options + end + + return {} end def verbose! @verbose = true end