class Makeleaps::Request::URLManager

Constants

API_ENDPOINT_BASE
CURRENCY_ENDPOINT
GENERIC_ENDPOINT

Attributes

partner_mid[R]

Public Instance Methods

build_url_for(resource_or_url, mid=nil) click to toggle source
# File lib/makeleaps/request/url_manager.rb, line 14
def build_url_for(resource_or_url, mid=nil)
  case resource_or_url
  when String
    resource_or_url # assume its a url
  when :partner
    compose_url GENERIC_ENDPOINT, mid
  when :currency
    compose_url CURRENCY_ENDPOINT
  when :client_contact
    # TODO: ensure that @partner_mid exists
    compose_url GENERIC_ENDPOINT, @partner_mid, :client, mid, :contact
  else
    # TODO: ensure that @partner_mid exists
    compose_url GENERIC_ENDPOINT, @partner_mid, resource_or_url, mid
  end
end
set_partner!(partner_mid) click to toggle source
# File lib/makeleaps/request/url_manager.rb, line 10
def set_partner!(partner_mid)
  @partner_mid = partner_mid
end

Private Instance Methods

compose_url(*parts) click to toggle source
# File lib/makeleaps/request/url_manager.rb, line 32
def compose_url(*parts)
  [*parts, ''].compact.join('/')
end