module HTTParty::ClassMethods
def format(f)
format :json
include HTTParty
class Foo
Must be one of the allowed formats ie: json, xml
Allows setting the format with which to parse.
def format(f) raise UnsupportedFormat, "Must be one of: #{AllowedFormats.values.map { |v| v.to_s }.uniq.sort.join(', ')}" unless AllowedFormats.value?(f) default_options[:format] = f end