Class: Ant::Client::Format::URLEncodedFormat

Inherits:
JSONFormat
  • Object
show all
Defined in:
lib/ant/client/format/url_encoded.rb

Instance Method Summary collapse

Methods inherited from JSONFormat

#unformat, #unpack

Instance Method Details

#encode(data) ⇒ Object



15
16
17
# File 'lib/ant/client/format/url_encoded.rb', line 15

def encode(data)
  data.map { |k, v| "#{k}=#{v}" }.join('&')
end

#pack(data) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/ant/client/format/url_encoded.rb', line 7

def pack(data)
  {
    body: encode(data),
    headers: { 'Content-type' =>
               'application/x-www-form-urlencoded; charset=UTF-8' }
  }
end