Method: Unit::UnitResponse.from_json_api

Defined in:
lib/unit/models/unit_response.rb

.from_json_api(response) ⇒ UnitResponse

Creates a new UnitResponse from given response.

Parameters:

  • response (HTTP::Response)

    The response returned from Unit’s API

Returns:

  • (UnitResponse)

    a new UnitResponse populated with values taken from the response



19
20
21
# File 'lib/unit/models/unit_response.rb', line 19

def self.from_json_api(response)
  new(response.body["data"], response.body["included"], response.body["meta"])
end