Class: IronBank::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_bank/endpoint.rb

Overview

Identify and return the proper base URL for a given Zuora domain.

Constant Summary collapse

PRODUCTION =
/\Arest\.zuora\.com\z/i.freeze
SERVICES =
/\A(rest)?(\.)?[a-z]+(\d+)?\.zuora\.com(:\d+)?\z/i.freeze
APISANDBOX =
/\Arest.apisandbox.zuora\.com\z/i.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.base_url(domain = "") ⇒ Object



13
14
15
# File 'lib/iron_bank/endpoint.rb', line 13

def self.base_url(domain = "")
  new(domain).base_url
end

Instance Method Details

#base_urlObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/iron_bank/endpoint.rb', line 17

def base_url
  case domain
  when PRODUCTION
    "https://rest.zuora.com/"
  when SERVICES
    "https://#{domain}/".downcase
  when APISANDBOX
    "https://rest.apisandbox.zuora.com/"
  end
end