Class: Graphlyte::Schema::Type
Overview
A full type definition.
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#enums ⇒ Object
readonly
Returns the value of attribute enums.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#input_fields ⇒ Object
readonly
Returns the value of attribute input_fields.
-
#interfaces ⇒ Object
readonly
Returns the value of attribute interfaces.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#name ⇒ Object
Returns the value of attribute name.
-
#possible_types ⇒ Object
readonly
Returns the value of attribute possible_types.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Type
constructor
A new instance of Type.
Methods inherited from Data
#==, attr_accessor, attr_reader, attributes, #dup, #eql?, #hash, #inspect
Constructor Details
#initialize ⇒ Type
Returns a new instance of Type.
84 85 86 87 88 89 90 91 |
# File 'lib/graphlyte/schema.rb', line 84 def initialize(**) super @fields ||= {} @input_fields ||= {} @interfaces ||= [] @enums ||= {} @possible_types ||= [] end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
81 82 83 |
# File 'lib/graphlyte/schema.rb', line 81 def description @description end |
#enums ⇒ Object (readonly)
Returns the value of attribute enums.
82 83 84 |
# File 'lib/graphlyte/schema.rb', line 82 def enums @enums end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
82 83 84 |
# File 'lib/graphlyte/schema.rb', line 82 def fields @fields end |
#input_fields ⇒ Object (readonly)
Returns the value of attribute input_fields.
82 83 84 |
# File 'lib/graphlyte/schema.rb', line 82 def input_fields @input_fields end |
#interfaces ⇒ Object (readonly)
Returns the value of attribute interfaces.
82 83 84 |
# File 'lib/graphlyte/schema.rb', line 82 def interfaces @interfaces end |
#kind ⇒ Object
Returns the value of attribute kind.
81 82 83 |
# File 'lib/graphlyte/schema.rb', line 81 def kind @kind end |
#name ⇒ Object
Returns the value of attribute name.
81 82 83 |
# File 'lib/graphlyte/schema.rb', line 81 def name @name end |
#possible_types ⇒ Object (readonly)
Returns the value of attribute possible_types.
82 83 84 |
# File 'lib/graphlyte/schema.rb', line 82 def possible_types @possible_types end |
Class Method Details
.from_schema_response(data) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/graphlyte/schema.rb', line 93 def self.from_schema_response(data) new( kind: data['kind'].to_sym, name: data['name'], description: data['description'], fields: Schema.entity_map(Field, data['fields']), input_fields: Schema.entity_map(InputValue, data['inputFields']), enums: Schema.entity_map(Enum, data['enumValues']), interfaces: Schema.entity_list(TypeRef, data['interfaces']), possible_types: Schema.entity_list(TypeRef, data['possibleTypes']) ) end |