Class: Translatomatic::HTTP::Param

Inherits:
Object
  • Object
show all
Defined in:
lib/translatomatic/http/param.rb

Overview

Formats a basic string key/value pair for a multipart post

Direct Known Subclasses

FileParam

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, value:) ⇒ Param

Returns a new instance of Param.



7
8
9
10
# File 'lib/translatomatic/http/param.rb', line 7

def initialize(key:, value:)
  @key = key
  @value = value
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/translatomatic/http/param.rb', line 5

def key
  @key
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/translatomatic/http/param.rb', line 5

def value
  @value
end

Instance Method Details

#to_sString

Returns Representation of this parameter as it appears within a multipart post request.

Returns:

  • (String)

    Representation of this parameter as it appears within a multipart post request.



14
15
16
# File 'lib/translatomatic/http/param.rb', line 14

def to_s
  header(header_data) + "\r\n#{value}\r\n"
end