Method: HTTParty::ClassMethods#format

Defined in:
lib/httparty.rb

#format(f = nil) ⇒ Object

Allows setting the format with which to parse. Must be one of the allowed formats ie: json, xml

class Foo
  include HTTParty
  format :json
end


249
250
251
252
253
254
255
256
257
# File 'lib/httparty.rb', line 249

def format(f = nil)
  if f.nil?
    default_options[:format]
  else
    parser(Parser) if parser.nil?
    default_options[:format] = f
    validate_format
  end
end