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.
-
#full_response ⇒ Object
readonly
Public: Complete response hash returned from server.
-
#original_hash ⇒ Object
(also: #to_h, #to_hash)
readonly
Public: Original JSON response hash returned from server.
Instance Method Summary collapse
-
#initialize(hash, data: nil, errors: Errors.new, extensions: {}, full_response: nil) ⇒ Response
constructor
Internal: Initialize base class.
Constructor Details
#initialize(hash, data: nil, errors: Errors.new, extensions: {}, full_response: nil) ⇒ Response
Internal: Initialize base class.
40 41 42 43 44 45 46 |
# File 'lib/graphql/client/response.rb', line 40 def initialize(hash, data: nil, errors: Errors.new, extensions: {}, full_response: nil) @original_hash = hash @data = data @errors = errors @extensions = extensions @full_response = full_response 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.
22 23 24 |
# File 'lib/graphql/client/response.rb', line 22 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.
29 30 31 |
# File 'lib/graphql/client/response.rb', line 29 def errors @errors end |
#extensions ⇒ Object (readonly)
Public: Hash of server specific extension metadata.
32 33 34 |
# File 'lib/graphql/client/response.rb', line 32 def extensions @extensions end |
#full_response ⇒ Object (readonly)
Public: Complete response hash returned from server.
Returns Hash
37 38 39 |
# File 'lib/graphql/client/response.rb', line 37 def full_response @full_response end |
#original_hash ⇒ Object (readonly) Also known as: to_h, to_hash
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 |