Class: LHC::Formats::JSON
- Inherits:
-
Object
- Object
- LHC::Formats::JSON
- Includes:
- BasicMethodsConcern
- Defined in:
- lib/lhc/formats/json.rb
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(input) ⇒ Object
- #as_open_struct(input) ⇒ Object
- #to_body(input) ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Class Method Details
.request(options) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/lhc/formats/json.rb', line 5 def self.request() [:headers] ||= {} [:headers]['Content-Type'] = 'application/json; charset=utf-8' [:headers]['Accept'] = 'application/json; charset=utf-8' [:format] = new super() end |
Instance Method Details
#as_json(input) ⇒ Object
13 14 15 |
# File 'lib/lhc/formats/json.rb', line 13 def as_json(input) parse(input, Hash) end |
#as_open_struct(input) ⇒ Object
17 18 19 |
# File 'lib/lhc/formats/json.rb', line 17 def as_open_struct(input) parse(input, OpenStruct) end |
#to_body(input) ⇒ Object
21 22 23 |
# File 'lib/lhc/formats/json.rb', line 21 def to_body(input) input.to_json end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/lhc/formats/json.rb', line 25 def to_s 'json' end |
#to_sym ⇒ Object
29 30 31 |
# File 'lib/lhc/formats/json.rb', line 29 def to_sym to_s.to_sym end |