Class: ActiveAdmin::GraphQL::ResourceConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/active_admin/graphql/resource_config.rb

Overview

Per-resource GraphQL options set via graphql in ActiveAdmin.register.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResourceConfig

Returns a new instance of ResourceConfig.



27
28
29
30
# File 'lib/active_admin/graphql/resource_config.rb', line 27

def initialize
  @enabled = true
  @exclude_attributes = []
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



9
10
11
# File 'lib/active_admin/graphql/resource_config.rb', line 9

def enabled
  @enabled
end

#exclude_attributesObject

Returns the value of attribute exclude_attributes.



12
13
14
# File 'lib/active_admin/graphql/resource_config.rb', line 12

def exclude_attributes
  @exclude_attributes
end

#extension_blockObject

Returns the value of attribute extension_block.



13
14
15
# File 'lib/active_admin/graphql/resource_config.rb', line 13

def extension_block
  @extension_block
end

#graphql_type_nameObject

Returns the value of attribute graphql_type_name.



10
11
12
# File 'lib/active_admin/graphql/resource_config.rb', line 10

def graphql_type_name
  @graphql_type_name
end

#only_attributesObject

Returns the value of attribute only_attributes.



11
12
13
# File 'lib/active_admin/graphql/resource_config.rb', line 11

def only_attributes
  @only_attributes
end

#resolve_create_procObject

Returns the value of attribute resolve_create_proc.



19
20
21
# File 'lib/active_admin/graphql/resource_config.rb', line 19

def resolve_create_proc
  @resolve_create_proc
end

#resolve_destroy_procObject

Returns the value of attribute resolve_destroy_proc.



21
22
23
# File 'lib/active_admin/graphql/resource_config.rb', line 21

def resolve_destroy_proc
  @resolve_destroy_proc
end

#resolve_index_procObject

Optional resolver overrides (set from graphql do). SchemaBuilder still owns field names, arguments, and types; procs replace only the Ruby resolution body.



17
18
19
# File 'lib/active_admin/graphql/resource_config.rb', line 17

def resolve_index_proc
  @resolve_index_proc
end

#resolve_show_procObject

Returns the value of attribute resolve_show_proc.



18
19
20
# File 'lib/active_admin/graphql/resource_config.rb', line 18

def resolve_show_proc
  @resolve_show_proc
end

#resolve_update_procObject

Returns the value of attribute resolve_update_proc.



20
21
22
# File 'lib/active_admin/graphql/resource_config.rb', line 20

def resolve_update_proc
  @resolve_update_proc
end

#run_action_payload_typeObject

Default return type for run-action mutations (batch, member, collection) when a kind-specific ActiveAdmin::GraphQL::RunActionMutationConfig#payload_type is not set. Falls back to ActiveAdmin::GraphQL::RunActionPayload.



25
26
27
# File 'lib/active_admin/graphql/resource_config.rb', line 25

def run_action_payload_type
  @run_action_payload_type
end

Instance Method Details

#batch_run_actionObject



36
37
38
# File 'lib/active_admin/graphql/resource_config.rb', line 36

def batch_run_action
  @batch_run_action ||= RunActionMutationConfig.new
end

#collection_action_mutation_for(name) ⇒ Object



62
63
64
65
# File 'lib/active_admin/graphql/resource_config.rb', line 62

def collection_action_mutation_for(name)
  key = name.to_s
  collection_action_mutations[key] ||= RunActionMutationConfig.new
end

#collection_action_mutationsObject



58
59
60
# File 'lib/active_admin/graphql/resource_config.rb', line 58

def collection_action_mutations
  @collection_action_mutations ||= {}
end

#collection_run_actionObject



44
45
46
# File 'lib/active_admin/graphql/resource_config.rb', line 44

def collection_run_action
  @collection_run_action ||= RunActionMutationConfig.new
end

#disabled?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/active_admin/graphql/resource_config.rb', line 32

def disabled?
  !enabled
end

#member_action_mutation_for(name) ⇒ Object



53
54
55
56
# File 'lib/active_admin/graphql/resource_config.rb', line 53

def member_action_mutation_for(name)
  key = name.to_s
  member_action_mutations[key] ||= RunActionMutationConfig.new
end

#member_action_mutationsObject

Per member_action name (string) -> ActiveAdmin::GraphQL::RunActionMutationConfig for typed fields like posts_member_publish.



49
50
51
# File 'lib/active_admin/graphql/resource_config.rb', line 49

def member_action_mutations
  @member_action_mutations ||= {}
end

#member_run_actionObject



40
41
42
# File 'lib/active_admin/graphql/resource_config.rb', line 40

def member_run_action
  @member_run_action ||= RunActionMutationConfig.new
end