Class: GraphQL::Client::Response
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/graphql/client/response.rb |
Overview
Public: Abstract base class for ::GraphQL
responses.
Class Method Summary
-
.new(hash, data: nil, errors: Errors.new, extensions: {}) ⇒ Response
constructor
Internal: Initialize base class.
Instance Attribute Summary
-
#data
readonly
Public: Wrapped ObjectType of data returned from the server.
-
#errors
readonly
Public: Get partial failures from response.
-
#extensions
readonly
Public: Hash of server specific extension metadata.
-
#original_hash
(also: #to_h)
readonly
Public: Original JSON response hash returned from server.
-
#to_h
readonly
Alias for #original_hash.
Constructor Details
.new(hash, data: nil, errors: Errors.new, extensions: {}) ⇒ Response
Internal: Initialize base class.
# 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 (readonly)
Public: Wrapped ObjectType of data returned from the server.
facebook.github.io/graphql/#sec-Data
Returns instance of ObjectType subclass.
# File 'lib/graphql/client/response.rb', line 21
attr_reader :data
#errors (readonly)
Public: Get partial failures from response.
facebook.github.io/graphql/#sec-Errors
Returns Errors collection object with zero or more errors.
# File 'lib/graphql/client/response.rb', line 28
attr_reader :errors
#extensions (readonly)
Public: Hash of server specific extension metadata.
# File 'lib/graphql/client/response.rb', line 31
attr_reader :extensions
#original_hash (readonly) Also known as: #to_h
Public: Original JSON response hash returned from server.
Returns Hash.
# File 'lib/graphql/client/response.rb', line 13
attr_reader :original_hash
#to_h (readonly)
Alias for #original_hash.
# File 'lib/graphql/client/response.rb', line 14
alias_method :to_h, :original_hash