Method: Sawyer::Response#process_data
- Defined in:
- lib/sawyer/response.rb
#process_data(data) ⇒ Object
Turns parsed contents from an API response into a Resource or collection of Resources.
data - Either an Array or Hash parsed from JSON.
Returns either a Resource or Array of Resources.
38 39 40 41 42 43 44 45 |
# File 'lib/sawyer/response.rb', line 38 def process_data(data) case data when Hash then Resource.new(agent, data) when Array then data.map { |hash| process_data(hash) } when nil then nil else data end end |