Class: Unit::UnitResponse
- Inherits:
-
Object
- Object
- Unit::UnitResponse
- Defined in:
- lib/unit/models/unit_response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#included ⇒ Object
readonly
Returns the value of attribute included.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Class Method Summary collapse
-
.from_json_api(response) ⇒ UnitResponse
Creates a new UnitResponse from given response.
Instance Method Summary collapse
-
#initialize(data, included, meta) ⇒ UnitResponse
constructor
A new instance of UnitResponse.
Constructor Details
#initialize(data, included, meta) ⇒ UnitResponse
Returns a new instance of UnitResponse.
10 11 12 13 14 |
# File 'lib/unit/models/unit_response.rb', line 10 def initialize(data, included, ) @data = data @included = included @meta = end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/unit/models/unit_response.rb', line 6 def data @data end |
#included ⇒ Object (readonly)
Returns the value of attribute included.
6 7 8 |
# File 'lib/unit/models/unit_response.rb', line 6 def included @included end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
6 7 8 |
# File 'lib/unit/models/unit_response.rb', line 6 def @meta end |
Class Method Details
.from_json_api(response) ⇒ UnitResponse
Creates a new UnitResponse from given 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 |