class Aws::Rest::Request::QuerystringBuilder

def build(params)

Returns:
  • (String) - Returns a built querystring

Parameters:
  • params (Array>) -- An array of
def build(params)
  params.map do |(shape_ref, param_value)|
    build_part(shape_ref, param_value)
  end.join('&')
end

def build_part(shape_ref, param_value)

def build_part(shape_ref, param_value)
  case shape_ref.shape
  # supported scalar types
  when *SUPPORTED_TYPES
    "#{shape_ref.location_name}=#{query_value(shape_ref, param_value)}"
  when MapShape
    generate_query_map(shape_ref, param_value)
  when ListShape
    generate_query_list(shape_ref, param_value)
  else
    raise NotImplementedError
  end
end

def escape(string)

def escape(string)
  Seahorse::Util.uri_escape(string)
end

def generate_query_list(ref, values)

def generate_query_list(ref, values)
  member_ref = ref.shape.member
  values.map do |value|
    value = query_value(member_ref, value)
    "#{ref.location_name}=#{value}"
  end
end

def generate_query_map(ref, value)

def generate_query_map(ref, value)
  case ref.shape.value.shape
  when StringShape
    query_map_of_string(value)
  when ListShape
    query_map_of_string_list(value)
  else
    msg = 'Only map of string and string list supported'
    raise NotImplementedError, msg
  end
end

def query_map_of_string(hash)

def query_map_of_string(hash)
  list = []
  hash.each_pair do |key, value|
    list << "#{escape(key)}=#{escape(value)}"
  end
  list
end

def query_map_of_string_list(hash)

def query_map_of_string_list(hash)
  list = []
  hash.each_pair do |key, values|
    values.each do |value|
      list << "#{escape(key)}=#{escape(value)}"
    end
  end
  list
end

def query_value(ref, value)

def query_value(ref, value)
  case ref.shape
  when TimestampShape
    escape(timestamp(ref, value))
  when *SUPPORTED_TYPES
    escape(value.to_s)
  else
    raise NotImplementedError
  end
end

def timestamp(ref, value)

def timestamp(ref, value)
  case ref['timestampFormat'] || ref.shape['timestampFormat']
  when 'unixTimestamp' then value.to_i
  when 'rfc822' then value.utc.httpdate
  else
    # querystring defaults to iso8601
    value.utc.iso8601
  end
end