Class: Gatherable::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/gatherable/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_methodObject



23
24
25
# File 'lib/gatherable/configuration.rb', line 23

def auth_method
  @auth_method || :session
end

#global_identifierObject

Returns the value of attribute global_identifier.



4
5
6
# File 'lib/gatherable/configuration.rb', line 4

def global_identifier
  @global_identifier
end

#schema_nameObject



19
20
21
# File 'lib/gatherable/configuration.rb', line 19

def schema_name
  @schema_name || 'gatherable'
end

Instance Method Details

#data_point(name, data_type, options = {}) ⇒ Object



7
8
9
# File 'lib/gatherable/configuration.rb', line 7

def data_point(name, data_type, options = {})
  data_tables << DataTable.new(name, {name => data_type}, options)
end

#data_table(name, columns, options = {}) ⇒ Object



11
12
13
# File 'lib/gatherable/configuration.rb', line 11

def data_table(name, columns, options = {})
  data_tables << DataTable.new(name, columns, options)
end

#data_tablesObject



15
16
17
# File 'lib/gatherable/configuration.rb', line 15

def data_tables
  @data_tables ||= []
end

#prefixed_resourcesObject



27
28
29
# File 'lib/gatherable/configuration.rb', line 27

def prefixed_resources
  @prefixed_resources ||= []
end

#prefixed_resources=(resources) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gatherable/configuration.rb', line 31

def prefixed_resources=(resources)
  all_table_names = DataTable.all.keys
  @prefixed_resources = case resources
  when String, Symbol, Array
    Array(resources).map(&:to_sym) && all_table_names
  when Hash
    if resources.key?(:only)
      Array(resources[:only]).map(&:to_sym) && all_table_names
    elsif resources.key?(:except)
      all_table_names - Array(resources[:except]).map(&:to_sym)
    end
  end
end