Build the correct API URL given the store URL provided

@since 2.0
4864
public function build_api_url() {

		$url = parse_url( $this->store_url );

		// default to http if not provided
		$scheme = isset( $url['scheme'] ) ? $url['scheme'] : 'http';

		// set host
		$host = $url['host'];

		// add port to host if provided
		$host .= isset( $url['port'] ) ? ':' . $url['port'] : '';

		// set path and strip any trailing slashes
		$path = isset( $url['path'] ) ? rtrim( $url['path'], '/' ) : '';

		// add WC API path
		$path .= '/wc-api/v2/';

		// build URL
		$this->api_url = "{$scheme}://{$host}{$path}";
	}
1367807
def api_url
      @api_url ||= Addressable::URI.new(
        :scheme => scheme, :host => host, :port => port,
        :path => path_with_base("/_api", resource_path)
      ).normalize.to_s
    end
92068
@Override
    public URI buildUrl(UriBuilder builder) throws MalformedURLException, IllegalArgumentException, URISyntaxException {
        synchronized (builder) {
            return builder.build();
        }
    }
130874
function Router_buildQuery(params) {
        var data = [];
        Object.keys(params).forEach(function (key) {
            data.push(key + '=' + encodeURIComponent(params[key]));
        });
        return data.join('&');
    }
435882
def url_for(self, action='view', **kwargs):
        
        app = current_app._get_current_object() if current_app else None
        if app is not None and action in self.url_for_endpoints.get(app, {}):
            endpoint, paramattrs, _external = self.url_for_endpoints[app][action]
        else:
            try:
                endpoint, paramattrs, _external = self.url_for_endpoints[None][action]
            except KeyError:
                raise BuildError(action, kwargs, 'GET')
        params = {}
        for param, attr in list(paramattrs.items()):
            if isinstance(attr, tuple):
                # attr is a tuple containing:
                # 1. ('parent', 'name') --> self.parent.name
                # 2. ('**entity', 'name') --> kwargs['entity'].name
                if attr[0].startswith('**'):
                    item = kwargs.pop(attr[0][2:])
                    attr = attr[1:]
                else:
                    item = self
                for subattr in attr:
                    item = getattr(item, subattr)
                params[param] = item
            elif callable(attr):
                params[param] = attr(self)
            else:
                params[param] = getattr(self, attr)
        if _external is not None:
            params['_external'] = _external
        params.update(kwargs)  # Let kwargs override params

        # url_for from flask
        return url_for(endpoint, **params)
236471
function() {
          var url;
          if (this.get('sql_api_template')) {
            url = this.get("sql_api_template").replace('{user}', this.get('user_name'));
          } else {
            url = this.get('sql_api_protocol') + '://' +
              this.get('user_name') + '.' +
              this.get('sql_api_domain') + ':' +
              this.get('sql_api_port');
          }
          return url;
        }
856730
private function buildUrl($method, $params)
    {
        $url = $this->address.$method;

        return $url."?".http_build_query($params);
    }
455253
def _build_request_url(self, secure, api_method, version):
        
        if secure:
            proto = ANDROID.PROTOCOL_SECURE
        else:
            proto = ANDROID.PROTOCOL_INSECURE
        req_url = ANDROID.API_URL.format(
            protocol=proto,
            api_method=api_method,
            version=version
        )
        return req_url
81556
function urlBuilder(params) {
  var builtUrl = params.base;

  builtUrl += '?';

  if (params.apiKey) {
    builtUrl += 'key=' + params.apiKey + '&';
  }

  if (params.client) {
    builtUrl += 'client=' + params.client + '&';
  }

  if (params.libraries.length > 0) {
    builtUrl += 'libraries=';

    params.libraries.forEach(function(library, index) {
      builtUrl += library;

      if (index !== params.libraries.length - 1) {
        builtUrl += ',';
      }
    });

    builtUrl += '&';
  }

  if (params.language) {
    builtUrl += 'language=' + params.language + '&';
  }

  if (params.version) {
    builtUrl += 'v=' + params.version + '&';
  }

  builtUrl += 'callback=' + params.callback;

  return builtUrl;
}
448261
function (callback, slug) {
        // returns resource and ID
        var host = apiStorefront
        // replace / with $ on slug to escape URL
        var endpoint = '/' + storeId + '@' + slug.replace(/\//g, '$') + '.json'

        // middleware callback
        var Callback = function (err, body) {
          if (!err) {
            var val = body.GET
            if (val) {
              /*
              {
                "GET": "[resource]@[id]"
              }
              */
              val = val.split('@')
              // overwrite body
              body = {
                'resource': val[0],
                '_id': val[1]
              }

              // success, pass the object
              callback(null, body)
            } else {
              // Redis key not found
              body = {
                'status': 404,
                'error_code': -44,
                'message': 'Page not found, invalid slug or store ID'
              }
              var msg = body.message
              errorHandling(callback, msg, body)
            }
          } else {
            // just pass the error
            callback(err, body)
          }
        }

        runMethod(Callback, endpoint, host)
      }
32423
def _build_url(self, endpoint):
        
        if not issubclass(type(self), ChatApiBase) and not self.subdomain:
            raise ZenpyException("subdomain is required when accessing the Zendesk API!")

        if self.subdomain:
            endpoint.netloc = '{}.{}'.format(self.subdomain, self.domain)
        else:
            endpoint.netloc = self.domain

        endpoint.prefix_path(self.api_prefix)
        return endpoint.build()
660637
def _build_url(*args, **kwargs) -> str:
    
    resource_url = API_RESOURCES_URLS
    for key in args:
        resource_url = resource_url[key]

    if kwargs:
        resource_url = resource_url.format(**kwargs)

    return urljoin(URL, resource_url)
1337012
def _url_builder(url_root,api_key,path,params):
    
    params['api_key'] = api_key
    url_end = urlencode(params)
    url = "%s%s%s" % (url_root,path,url_end)
    return url
1123643
def _build_url(self, api_call):
        
        if self.api_version in ('1.13.0', '1.13.0+update.1', '1.13.0+update.2'):
            if '/' not in api_call:
                return "{0}/{1}/index.json".format(self.site_url, api_call)
        return "{0}/{1}.json".format(self.site_url, api_call)
492361
private function buildUri($uri, $params)
    {
        $parse_url = parse_url($uri);

        // Add our params to the parsed uri
        foreach ( $params as $k => $v ) {
            if (isset($parse_url[$k])) {
                $parse_url[$k] .= "&" . http_build_query($v);
            } else {
                $parse_url[$k] = http_build_query($v);
            }
        }

        // Put humpty dumpty back together
        return
            ((isset($parse_url["scheme"])) ? $parse_url["scheme"] . "://" : "")
            . ((isset($parse_url["user"])) ? $parse_url["user"]
            . ((isset($parse_url["pass"])) ? ":" . $parse_url["pass"] : "") . "@" : "")
            . ((isset($parse_url["host"])) ? $parse_url["host"] : "")
            . ((isset($parse_url["port"])) ? ":" . $parse_url["port"] : "")
            . ((isset($parse_url["path"])) ? $parse_url["path"] : "")
            . ((isset($parse_url["query"])) ? "?" . $parse_url["query"] : "")
            . ((isset($parse_url["fragment"])) ? "#" . $parse_url["fragment"] : "")
        ;
    }
538621
function buildPath (basePath, queryParams) {
    basePath = basePath.concat('?')
    var url = basePath.concat(queryString.stringify(queryParams))
    return url
  }
681952
def build_post_url
      @optional.map { |k, v| @parameters[k] = v unless v.nil? }
      @parameters['Timestamp'] = Time.now.utc.iso8601 unless @parameters.key?('Timestamp')
      @parameters = @default_hash.merge(@parameters)
      post_url = @parameters.sort.map { |k, v| "#{k}=#{custom_escape(v)}" }.join('&')
      post_body = ['POST', @mws_endpoint.to_s, "/#{@sandbox_str}/#{AmazonPay::API_VERSION}", post_url].join("\n")
      post_url += '&Signature=' + sign(post_body)
      if @log_enabled
        data = AmazonPay::Sanitize.new(post_url)
        @logger.debug("request/Post: #{data.sanitize_request_data}")
      end

      post_url
    end