Class: AWS::Core::Http::Request::Param

Inherits:
Object
  • Object
show all
Includes:
UriEscape
Defined in:
lib/aws/core/http/request.rb

Overview

Represents a single request paramater. Some services accept this in a form encoded body string, others as query parameters. It is up to each service’s Request class to determine how to consume these params.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UriEscape

#escape, #escape_path

Constructor Details

#initialize(name, value = nil) ⇒ Param

Returns a new instance of Param.



224
225
226
227
# File 'lib/aws/core/http/request.rb', line 224

def initialize name, value = nil
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



222
223
224
# File 'lib/aws/core/http/request.rb', line 222

def name
  @name
end

#valueObject

Returns the value of attribute value.



222
223
224
# File 'lib/aws/core/http/request.rb', line 222

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



229
230
231
# File 'lib/aws/core/http/request.rb', line 229

def <=> other
  name <=> other.name
end

#==(other) ⇒ Object



237
238
239
# File 'lib/aws/core/http/request.rb', line 237

def ==(other)
  other.kind_of?(Param) and to_s == other.to_s
end

#encodedObject



241
242
243
# File 'lib/aws/core/http/request.rb', line 241

def encoded
  value ? "#{escape(name)}=#{escape(value)}" : escape(name)
end

#to_sObject



233
234
235
# File 'lib/aws/core/http/request.rb', line 233

def to_s
  value ? "#{name}=#{value}" : name
end