Sha256: 1d708f48fc6dd0239197b570c545c00c784091d5da33f54881b70a7f0b110147
Contents?: true
Size: 505 Bytes
Versions: 5
Compression:
Stored size: 505 Bytes
Contents
class JsonFormat include LHC::BasicMethods def self.request(options) options[:headers] ||= {} options[:headers]['Content-Type'] = 'application/json' options[:headers]['Accept'] = 'application/json' options[:format] = new super(options) end def parse(response) JSON.parse(response.body, object_class: OpenStruct) rescue JSON::ParserError => e raise LHC::ParserError.new(e.message, response) end def to_s 'json' end def to_sym to_s.to_sym end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
lhc-3.6.1 | lib/lhc/formats/json.rb |
lhc-3.6.0 | lib/lhc/formats/json.rb |
lhc-3.5.5 | lib/lhc/formats/json.rb |
lhc-3.5.4 | lib/lhc/formats/json.rb |
lhc-3.5.3 | lib/lhc/formats/json.rb |