Class: OxfordDictionary::Deserialize
- Inherits:
-
Object
- Object
- OxfordDictionary::Deserialize
- Defined in:
- lib/oxford_dictionary/deserialize.rb
Overview
A small service object that parses a JSON payload into an OpenStruct recursively. The keys of the OpenStruct are in camelCase, not snake_case. This keeps the struct more representative of the JSON in the response.
Instance Method Summary collapse
-
#call(payload) ⇒ OpenStruct
Parses a JSON payload into an OpenStruct Nested objects are also parsed into OpenStructs.
Instance Method Details
#call(payload) ⇒ OpenStruct
Parses a JSON payload into an OpenStruct Nested objects are also parsed into OpenStructs
15 16 17 |
# File 'lib/oxford_dictionary/deserialize.rb', line 15 def call(payload) JSON.parse(payload, object_class: OpenStruct) end |