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

 Raises::  WWW::Delicious::Error
480800
def prepare_bundles_set_params(name_or_bundle, tags = [])
        bundle = prepare_param_bundle(name_or_bundle, tags) do |b|
          raise Error, "Bundle name is empty" if b.name.empty?
          raise Error, "Bundle must contain at least one tag" if b.tags.empty?
        end
        { :bundle => bundle.name, :tags => bundle.tags.join(' ') }
      end
377364
def prepare_posts_params(params, allowed_params = [])
        compare_params(params, allowed_params)

        # we don't need to check whether the following parameters
        # are valid for this request because compare_params
        # would raise if an invalid param is supplied

        params[:tag]    = prepare_param_tag(params[:tag])  if params[:tag]
        params[:dt]     = TIME_CONVERTER.call(params[:dt]) if params[:dt]
        params[:url]    = URI.parse(params[:url])          if params[:url]
        params[:count]  = if value = params[:count]
          raise Error, 'Expected `count` <= 100' if value.to_i > 100 # requirement
          value.to_i
        else
          15 # default value
        end

        params
      end
891841
def prepare_request(self, *args, **kw):
        
        self.http_request = self.request_class(self.path, *args, **kw)
41050
def list_available_ssl_options(custom_headers:nil)
      response = list_available_ssl_options_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end
1070826
def build_params(self, params, i):
        
        prefix = 'Tags.member.%d.' % i
        params[prefix+'ResourceId'] = self.resource_id
        params[prefix+'ResourceType'] = self.resource_type
        params[prefix+'Key'] = self.key
        params[prefix+'Value'] = self.value
        if self.propagate_at_launch:
            params[prefix+'PropagateAtLaunch'] = 'true'
        else:
            params[prefix+'PropagateAtLaunch'] = 'false'
610712
def prepare_params p
      results = {}
      # Build a new hash with string keys
      p.each { |k, v| results[k.to_s] = v }
      # Sort nested structures
      results.sort.to_h
    end
982947
def put(url, params)
      params = convert_hash_keys(params)
      preform(url, :put, params: params) do
        return connection.put(url, params)
      end
    end
1226049
def get_bundles():
    
    global _cached_bundles

    if not _cached_bundles:
        _cached_bundles = BundleManager()

        for bundle_conf in bundles_settings.BUNDLES:
            _cached_bundles[bundle_conf[0]] = Bundle(bundle_conf)

    return _cached_bundles
652810
def set_all(params = self.class::DEFAULT_REQUEST_HEADER)
      params = params.data if params.class <= Resource
      params = Hash[params.map { |(k, v)| [k.to_s, v] }]
      params.each { |key, value| set(key.to_s, value) }
      self
    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
1262812
def request_setup req_or_uri # :nodoc:
    req = if URI === req_or_uri then
            Net::HTTP::Get.new req_or_uri.request_uri
          else
            req_or_uri
          end

    @headers.each do |pair|
      req.add_field(*pair)
    end

    @override_headers.each do |name, value|
      req[name] = value
    end

    unless req['Connection'] then
      req.add_field 'Connection', 'keep-alive'
      req.add_field 'Keep-Alive', @keep_alive
    end

    req
  end
260186
def params
			@params ||=
				begin
					request.params.symbolize_keys(deep: true)
				rescue ArgumentError => e
					raise unless e.message.include?('invalid %-encoding')

					{}
				end
		end
1052146
def prepare_schemes(self, req):
        

        # fix test bug when in python3 scheme, more details in commint msg
        ret = sorted(self.__schemes__ & set(req.schemes), reverse=True)

        if len(ret) == 0:
            raise ValueError('No schemes available: {0}'.format(req.schemes))
        return ret
1185075
def prepare_parallel_request
      request = ::Typhoeus::Request.new(@uri, userpwd: "#{@api_secret}:")

      request.on_complete do |response|
        if response.success?
          Utils.to_hash(response.body, @format)
        elsif response.timed_out?
          raise TimeoutError
        elsif response.code == 0
          # Could not get an http response, something's wrong
          raise HTTPError, response.curl_error_message
        else
          # Received a non-successful http response
          error_message = if response.body && response.body != ''
                            JSON.parse(response.body)['error']
                          else
                            response.code.to_s
                          end

          raise HTTPError, error_message
        end
      end

      request
    end
211429
def set(options)
      json_body = options.to_json
      request_uri = "#{base_request_uri}/state"
      HTTParty.put(request_uri, :body => json_body)
    end
743763
def prepare(self):
        
        # Maybe the Brok is a old daemon one or was already prepared
        # if so, the data is already ok
        if hasattr(self, 'prepared') and not self.prepared:
            self.data = unserialize(self.data)
            if self.instance_id:
                self.data['instance_id'] = self.instance_id
        self.prepared = True
1055257
def ensure_hash(ambiguous_param)
      case ambiguous_param
        when String
          if ambiguous_param.present?
            ensure_hash(JSON.parse(ambiguous_param))
          else
            {}
          end
        when Hash, ActionController::Parameters
          ambiguous_param
        when nil
          {}
        else
          raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
      end
    end