Prepares the params for a `bundles_set` call
 and returns a Hash with the params ready for the HTTP request.

 Raises::  WWW::Delicious::Error
495469
def prepare_bundles_delete_params(name_or_bundle)
        bundle = prepare_param_bundle(name_or_bundle) do |b|
          raise Error, "Bundle name is empty" if b.name.empty?
        end
        { :bundle => bundle.name }
      end
1126906
def prepare_params(params)
      # Create a new hash in case is a HashWithIndifferentAccess (keys are
      # always a String)
      params = Utils.symbolize_keys(Hash[params])
      # Only pull out the relevant parameters, other won't be included in the
      # signature so will cause false negatives
      keys = [:resource_id, :resource_type, :resource_uri, :state, :signature]
      params = Hash[params.select { |k,v| keys.include? k }]
      (keys - [:state]).each do |key|
        raise ArgumentError, "Parameters missing #{key}" if !params.key?(key)
      end
      params
    end
920205
def prepare_url(method, params = {})
			timestamp = Time.now.utc.strftime('%Y%m%d%H%M%S')
			params[:method] = method
			params[:appid] = @appid
			params[:ts] = timestamp
			html_params = params.map { |k,v| "#{k.to_s}=#{v}" }.join("&")

			raw = @secret + params.keys.
					sort{ |a,b| a.to_s.downcase <=> b.to_s.downcase }.
					map{ |k| "#{k.to_s}#{params[k]}" }.
					join

			sig = Digest::MD5.hexdigest(raw)
			"http://cloud.scorm.com/api?#{html_params}&sig=#{sig}"
		end
272508
def _init_request_urls(self, api_urls):
        
        if not isinstance(api_urls, (str, list, tuple)):
            raise TypeError('api_urls needs to be string or iterable!')

        if isinstance(api_urls, str):
            api_urls = (api_urls,)

        api_urls = list(api_urls)

        for url in api_urls:
            if not url.startswith('http://') and \
               not url.startswith('https://'):
                raise ValueError(('URL "%s" contains an invalid or missing'
                                 ' scheme' % (url)))

        return list(api_urls)
1308800
def prepare_options(options)
      options = engine.config.to_hash.merge(options)
      options.keys.each { |k| options[k.to_s.gsub(/_([a-z])/) { $1.upcase }.to_sym] = options[k] }
      options.delete_if { |k, v| v.nil? }
    end
609105
def build_request_chain(sequence, context)
      sequence.reverse.reduce(nil) do |successor, item|
        item.build_middleware(context, successor)
      end
    end
1008792
def apply_to_request(context, rack_env:, for_type:)
      req = rails_req?(rack_env) ? rack_env : Rack::Request.new(rack_env)

      context.request = Context::Request.new unless context.request
      request = context.request

      request.socket = Context::Request::Socket.new(req)
      request.http_version = build_http_version rack_env
      request.method = req.request_method
      request.url = Context::Request::Url.new(req)

      request.body = should_capture_body?(for_type) ? get_body(req) : SKIPPED

      headers, env = get_headers_and_env(rack_env)
      request.headers = headers if config.capture_headers?
      request.env = env if config.capture_env?

      context
    end
522078
def build_resource_hash
      @resource_hash = {}
      resources.each do |resource|
        @resource_hash[resource['type']] ||= {}

        title = normalized_title(resource['title'], resource['type'])
        @resource_hash[resource['type']][title] = resource

        if resource.key?('parameters')
          @resource_hash[resource['type']][resource['parameters']['alias']] = resource if resource['parameters'].key?('alias')
          @resource_hash[resource['type']][resource['parameters']['name']] = resource if resource['parameters'].key?('name')
        end
      end
    end
982947
def put(url, params)
      params = convert_hash_keys(params)
      preform(url, :put, params: params) do
        return connection.put(url, params)
      end
    end
353183
def add_params(endpoint, params):
    
    p = PreparedRequest()
    p.prepare(url=endpoint, params=params)
    if PY2:  # pragma: no cover
        return unicode(p.url)
    else:  # pragma: no cover
        return p.url
1168899
def to_params_hash(keys,values)
      hash = {}
      keys.size.times { |i| hash[ keys[i].to_sym ] = values[i] }
      hash
    end
1306181
def prepare(self, scheme='http', handle_files=True, encoding='utf-8'):
        

        if isinstance(scheme, list):
            if self.__scheme is None:
                scheme = scheme.pop()
            else:
                if self.__scheme in scheme:
                    scheme = self.__scheme
                else:
                    raise Exception('preferred scheme:{} is not supported by the client or spec:{}'.format(self.__scheme, scheme))
        elif not isinstance(scheme, six.string_types):
            raise ValueError('"scheme" should be a list or string')

        # combine path parameters into path
        # TODO: 'dot' is allowed in swagger, but it won't work in python-format
        path_params = {}
        for k, v in six.iteritems(self.__p['path']):
            path_params[k] = six.moves.urllib.parse.quote_plus(v)

        self.__path = self.__path.format(**path_params)

        # combine path parameters into url
        self.__url = ''.join([scheme, ':', self.__url.format(**path_params)])

        # header parameters
        self.__header.update(self.__p['header'])

        # update data parameter
        content_type = None
        if self.__p['file']:
            if handle_files:
                content_type, self.__data = self._prepare_files(encoding)
            else:
                # client that can encode multipart/form-data, should
                # access form-data via data property and file from file
                # property.

                # only form data can be carried along with files,
                self.__data = self.__p['formData']

        elif self.__p['formData']:
            content_type, self.__data = self._prepare_forms()
        elif self.__p['body']:
            content_type, self.__data = self._prepare_body()
        else:
            self.__data = None

        if content_type:
            self.__header.update({'Content-Type': content_type})

        accept = self.__produce
        if not accept and self.__op.produces:
            accept = self.__op.produces[0]
        if accept:
            if self.__op.produces and accept not in self.__op.produces:
                raise errs.SchemaError('accept {0} does not present in {1}'.format(accept, self.__op.produces))
            self.__header.update({'Accept': accept})

        return self
1338958
def http_build_query(params = {})
        params.collect do |k,v|
          "#{URI.encode(k.to_s)}=#{URI.encode(v.to_s)}" unless v.nil?
        end.compact.join('&')
      end
260186
def params
			@params ||=
				begin
					request.params.symbolize_keys(deep: true)
				rescue ArgumentError => e
					raise unless e.message.include?('invalid %-encoding')

					{}
				end
		end
583880
def build_request(verb, uri, opts = {}) # rubocop:disable Style/OptionHash
      opts    = @default_options.merge(opts)
      uri     = make_request_uri(uri, opts)
      headers = make_request_headers(opts)
      body    = make_request_body(opts, headers)

      req = HTTP::Request.new(
        :verb           => verb,
        :uri            => uri,
        :uri_normalizer => opts.feature(:normalize_uri)&.normalizer,
        :proxy          => opts.proxy,
        :headers        => headers,
        :body           => body
      )

      opts.features.inject(req) do |request, (_name, feature)|
        feature.wrap_request(request)
      end
    end
35432
def to_query(params)
      unless params.is_a?(Hash)
        raise "Expected Hash but got #{params.class.name}"
      end
      Addressable::URI.form_encode(params)
    end
848319
def _request(self, method, uri_relative, request_bytes, params,
                 custom_headers):
        

        uri_relative_with_params = self._append_params_to_uri(uri_relative,
                                                              params)
        if uri_relative not in self._URIS_NOT_REQUIRING_ACTIVE_SESSION:
            if self._api_context.ensure_session_active():
                from bunq.sdk.context import BunqContext

                BunqContext.update_api_context(self._api_context)

        all_headers = self._get_all_headers(
            method,
            uri_relative_with_params,
            request_bytes,
            custom_headers
        )

        response = requests.request(
            method,
            self._get_uri_full(uri_relative_with_params),
            data=request_bytes,
            headers=all_headers,
            proxies={self._FIELD_PROXY_HTTPS: self._api_context.proxy_url},
        )

        self._assert_response_success(response)

        if self._api_context.installation_context is not None:
            security.validate_response(
                self._api_context.installation_context.public_key_server,
                response.status_code,
                response.content,
                response.headers
            )

        return self._create_bunq_response_raw(response)