Class: GraphQL::Client::Response
- Inherits:
-
Object
- Object
- GraphQL::Client::Response
- Defined in:
- lib/graphql/client/response.rb
Overview
Public: Abstract base class for GraphQL responses.
https://facebook.github.io/graphql/#sec-Response-Format
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Public: Wrapped ObjectType of data returned from the server.
-
#errors ⇒ Object
readonly
Public: Get partial failures from response.
-
#extensions ⇒ Object
readonly
Public: Hash of server specific extension metadata.
-
#original_hash ⇒ Object
(also: #to_h)
readonly
Public: Original JSON response hash returned from server.
Instance Method Summary collapse
-
#initialize(hash, data: nil, errors: Errors.new, extensions: {}) ⇒ Response
constructor
Internal: Initialize base class.
Constructor Details
#initialize(hash, data: nil, errors: Errors.new, extensions: {}) ⇒ Response
Internal: Initialize base class.
34 35 36 37 38 39 |
# File 'lib/graphql/client/response.rb', line 34 def initialize(hash, data: nil, errors: Errors.new, extensions: {}) @original_hash = hash @data = data @errors = errors @extensions = extensions end |
Instance Attribute Details
#data ⇒ Object (readonly)
Public: Wrapped ObjectType of data returned from the server.
https://facebook.github.io/graphql/#sec-Data
Returns instance of ObjectType subclass.
21 22 23 |
# File 'lib/graphql/client/response.rb', line 21 def data @data end |
#errors ⇒ Object (readonly)
Public: Get partial failures from response.
https://facebook.github.io/graphql/#sec-Errors
Returns Errors collection object with zero or more errors.
28 29 30 |
# File 'lib/graphql/client/response.rb', line 28 def errors @errors end |
#extensions ⇒ Object (readonly)
Public: Hash of server specific extension metadata.
31 32 33 |
# File 'lib/graphql/client/response.rb', line 31 def extensions @extensions end |
#original_hash ⇒ Object (readonly) Also known as: to_h
Public: Original JSON response hash returned from server.
Returns Hash.
13 14 15 |
# File 'lib/graphql/client/response.rb', line 13 def original_hash @original_hash end |