Class: AllscriptsUnityClient::JSONUnityResponse
- Inherits:
-
UnityResponse
- Object
- UnityResponse
- AllscriptsUnityClient::JSONUnityResponse
- Defined in:
- lib/allscripts_unity_client/json_unity_response.rb
Overview
Transform Unity responses from Faraday into Hash objects.
Instance Attribute Summary
Attributes inherited from UnityResponse
Instance Method Summary collapse
-
#to_hash ⇒ Object
See UnityResponse#to_hash.
Methods inherited from UnityResponse
Constructor Details
This class inherits a constructor from AllscriptsUnityClient::UnityResponse
Instance Method Details
#to_hash ⇒ Object
See UnityResponse#to_hash.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/allscripts_unity_client/json_unity_response.rb', line 7 def to_hash result = @response # All JSON magic responses are an array with one item result = result.first # All JSON magic results contain one key on their object named # actioninfo result = result.values.first # The data in a JSON magic result is always an array. If that array # only has a single item, then just return that as the result. This is # a compromise as some actions that should always return arrays # (i.e. GetProviders) may return a single hash. if result.count == 1 result = result.first end result = convert_dates_to_utc(result) Utilities::recursively_symbolize_keys(result) end |