Class: GraphQLPreview::SchemaModification
- Inherits:
-
Object
- Object
- GraphQLPreview::SchemaModification
- Defined in:
- lib/graphql-preview/schema_modification.rb
Class Method Summary collapse
- .announced_on(date, url: nil) ⇒ Object
- .announcement ⇒ Object
- .apply_to_schema(schema) ⇒ Object
- .description(new_description = nil) ⇒ Object
- .title(new_title = nil) ⇒ Object
- .to_h ⇒ Object
- .toggled_by(new_toggled_by = nil) ⇒ Object
- .toggled_on(member_paths = nil) ⇒ Object
- .unset(schema) ⇒ Object
- .updated_on(date, url: nil) ⇒ Object
- .updates ⇒ Object
Class Method Details
.announced_on(date, url: nil) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/graphql-preview/schema_modification.rb', line 38 def self.announced_on(date, url: nil) @announcement = { date: date, url: url } end |
.announcement ⇒ Object
45 46 47 |
# File 'lib/graphql-preview/schema_modification.rb', line 45 def self.announcement @announcement end |
.apply_to_schema(schema) ⇒ Object
80 81 82 |
# File 'lib/graphql-preview/schema_modification.rb', line 80 def self.apply_to_schema(schema) set_preview_toggled_by_on_members(schema, self) end |
.description(new_description = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/graphql-preview/schema_modification.rb', line 22 def self.description(new_description = nil) if new_description @description = new_description else @description end end |
.title(new_title = nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/graphql-preview/schema_modification.rb', line 14 def self.title(new_title = nil) if new_title @title = new_title else @title end end |
.to_h ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/graphql-preview/schema_modification.rb', line 3 def self.to_h { title: title, description: description, toggled_by: toggled_by, announcement: announcement, updates: updates, toggled_on: toggled_on } end |
.toggled_by(new_toggled_by = nil) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/graphql-preview/schema_modification.rb', line 30 def self.toggled_by(new_toggled_by = nil) if new_toggled_by @toggled_by = new_toggled_by else @toggled_by end end |
.toggled_on(member_paths = nil) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/graphql-preview/schema_modification.rb', line 62 def self.toggled_on(member_paths = nil) if member_paths member_paths.each do |path| unless path.is_a?(String) raise ArgumentError, "Provide string paths to `toggled_on`. For example, to toggle on a field called `name` on a type `Author`, use `\"Author.name\"``" end end @member_paths = member_paths else @member_paths end end |
.unset(schema) ⇒ Object
76 77 78 |
# File 'lib/graphql-preview/schema_modification.rb', line 76 def self.unset(schema) set_preview_toggled_by_on_members(schema, nil) end |
.updated_on(date, url: nil) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/graphql-preview/schema_modification.rb', line 49 def self.updated_on(date, url: nil) @updates ||= [] @updates << { date: date, url: url } end |
.updates ⇒ Object
58 59 60 |
# File 'lib/graphql-preview/schema_modification.rb', line 58 def self.updates @updates end |