Class: DatagroutConduit::Tool

Inherits:
Struct
  • Object
show all
Defined in:
lib/datagrout_conduit/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#annotationsObject

Returns the value of attribute annotations

Returns:

  • (Object)

    the current value of annotations



4
5
6
# File 'lib/datagrout_conduit/types.rb', line 4

def annotations
  @annotations
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



4
5
6
# File 'lib/datagrout_conduit/types.rb', line 4

def description
  @description
end

#input_schemaObject

Returns the value of attribute input_schema

Returns:

  • (Object)

    the current value of input_schema



4
5
6
# File 'lib/datagrout_conduit/types.rb', line 4

def input_schema
  @input_schema
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



4
5
6
# File 'lib/datagrout_conduit/types.rb', line 4

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/datagrout_conduit/types.rb', line 5

def self.from_hash(hash)
  hash = normalize_keys(hash)
  new(
    name: hash[:name],
    description: hash[:description],
    input_schema: hash[:input_schema] || hash[:inputschema],
    annotations: hash[:annotations]
  )
end

.normalize_keys(hash) ⇒ Object



15
16
17
18
19
# File 'lib/datagrout_conduit/types.rb', line 15

def self.normalize_keys(hash)
  hash.each_with_object({}) do |(k, v), memo|
    memo[k.to_s.downcase.to_sym] = v
  end
end