Module: OneLogin::Api::Util::UrlBuilder

Included in:
OneLogin::Api::Util
Defined in:
lib/onelogin/api/util/url_builder.rb

Instance Method Summary collapse

Instance Method Details

#url_for(base, obj_id = nil, extra_id = nil) ⇒ Object

Build the URL of the API endpoint

Parameters:

  • base (String)

    Base of the endpoint

  • obj_id (String, nil) (defaults to: nil)

    Id of the referenced object

  • extra_id (String, nil) (defaults to: nil)

    Id of the secundary referenced object


12
13
14
15
16
17
18
19
20
# File 'lib/onelogin/api/util/url_builder.rb', line 12

def url_for(base, obj_id=nil, extra_id=nil)
  if obj_id.nil? || obj_id.to_s.empty?
    base % [@region]
  elsif extra_id.nil? || extra_id.to_s.empty?
    base % [@region, obj_id]
  else
    base % [@region, obj_id, extra_id]
  end
end