Method: DocuSign_Maestro::ApiClient#set_oauth_base_path

Defined in:
lib/docusign_maestro/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

[View source]

399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/docusign_maestro/client/api_client.rb', line 399

def set_oauth_base_path(oauth_base_path=nil)
  if oauth_base_path
    raise ArgumentError.new('OAuth base path should only include domain name (without https://)')  if oauth_base_path.include? "//"
    self.oauth_base_path = oauth_base_path
    return
  end

  # 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.nil? or self.base_path.start_with?("https://demo") or self.base_path.start_with?("http://demo") or self.base_path.start_with?("https://apps-d") or self.base_path.start_with?("http://apps-d")
    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") or self.base_path.start_with?("https://apps-s") or self.base_path.start_with?("http://apps-s")
    self.oauth_base_path = OAuth::STAGE_OAUTH_BASE_PATH
  else
    self.oauth_base_path = OAuth::PRODUCTION_OAUTH_BASE_PATH
  end
end