Class: Graphlyte::Schema::Field

Inherits:
Data
  • Object
show all
Defined in:
lib/graphlyte/schema.rb

Overview

A field definition

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Data

#==, attr_accessor, attr_reader, attributes, #dup, #eql?, #hash, #inspect

Constructor Details

#initializeField

Returns a new instance of Field.



112
113
114
115
116
# File 'lib/graphlyte/schema.rb', line 112

def initialize(**)
  super

  @arguments ||= {}
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



110
111
112
# File 'lib/graphlyte/schema.rb', line 110

def arguments
  @arguments
end

#deprecation_reasonObject

Returns the value of attribute deprecation_reason.



109
110
111
# File 'lib/graphlyte/schema.rb', line 109

def deprecation_reason
  @deprecation_reason
end

#descriptionObject

Returns the value of attribute description.



109
110
111
# File 'lib/graphlyte/schema.rb', line 109

def description
  @description
end

#is_deprecatedObject

Returns the value of attribute is_deprecated.



109
110
111
# File 'lib/graphlyte/schema.rb', line 109

def is_deprecated
  @is_deprecated
end

#nameObject

Returns the value of attribute name.



109
110
111
# File 'lib/graphlyte/schema.rb', line 109

def name
  @name
end

#typeObject

Returns the value of attribute type.



109
110
111
# File 'lib/graphlyte/schema.rb', line 109

def type
  @type
end

Class Method Details

.from_schema_response(data) ⇒ Object



118
119
120
121
122
123
124
125
126
127
# File 'lib/graphlyte/schema.rb', line 118

def self.from_schema_response(data)
  new(
    name: data['name'],
    description: data['description'],
    type: TypeRef.from_schema_response(data['type']),
    is_deprecated: data['isDeprecated'],
    deprecation_reason: data['deprecationReason'],
    arguments: Schema.entity_map(InputValue, data['arguments'])
  )
end