Method: DocuSign_Monitor::ApiClient#set_oauth_base_path

Defined in:
lib/docusign_monitor/client/api_client.rb

#set_oauth_base_path(oauth_base_path = nil) ⇒ Object

Helper method to set oauth base path

Parameters:

  • oauth_base_path (String) (defaults to: nil)

    if passed nil it will determined from base_path



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/docusign_monitor/client/api_client.rb', line 394

def set_oauth_base_path(oauth_base_path=nil)
  self.oauth_base_path = oauth_base_path if oauth_base_path
  return if self.oauth_base_path

  # did we need this check as we can determine it from base path
  #raise ArgumentError.new('oAuthBasePath cannot be empty')  unless oauth_base_path

  # Derive OAuth Base Path if not given
  if self.base_path.start_with?("https://demo") or self.base_path.start_with?("http://demo")
    self.oauth_base_path = OAuth::DEMO_OAUTH_BASE_PATH
  elsif self.base_path.start_with?("https://stage") or self.base_path.start_with?("http://stage")
    self.oauth_base_path = OAuth::STAGE_OAUTH_BASE_PATH
  else
    self.oauth_base_path = OAuth::PRODUCTION_OAUTH_BASE_PATH
  end
end