class Ant::Client::Format::JSONFormat

Implements JSON format for http clients.

Public Instance Methods

pack(data) click to toggle source
# File lib/ant/client/format/json_format.rb, line 10
def pack(data)
  {
    body: data.to_json,
    headers: { 'Content-type' => 'application/json; charset=UTF-8',
               'User-Agent' => 'Ruby Ant Client' }
  }
end
unformat(msg) click to toggle source
# File lib/ant/client/format/json_format.rb, line 22
def unformat(msg)
  JSON.parse(msg, symbolize_names: true)
end
unpack(data) click to toggle source
# File lib/ant/client/format/json_format.rb, line 18
def unpack(data)
  unformat(data)
end