Class: JsonFormat
- Inherits:
-
Object
- Object
- JsonFormat
- Includes:
- LHC::BasicMethods
- Defined in:
- lib/lhc/formats/json.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.request(options) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/lhc/formats/json.rb', line 4 def self.request() [:headers] ||= {} [:headers]['Content-Type'] = 'application/json' [:headers]['Accept'] = 'application/json' [:format] = new super() end |
Instance Method Details
#parse(response) ⇒ Object
12 13 14 15 16 |
# File 'lib/lhc/formats/json.rb', line 12 def parse(response) JSON.parse(response.body, object_class: OpenStruct) rescue JSON::ParserError => e raise LHC::ParserError.new(e., response) end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/lhc/formats/json.rb', line 18 def to_s 'json' end |
#to_sym ⇒ Object
22 23 24 |
# File 'lib/lhc/formats/json.rb', line 22 def to_sym to_s.to_sym end |