Class: DatagroutConduit::DiscoveredTool

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



149
150
151
# File 'lib/datagrout_conduit/types.rb', line 149

def description
  @description
end

#input_schemaObject

Returns the value of attribute input_schema

Returns:

  • (Object)

    the current value of input_schema



149
150
151
# File 'lib/datagrout_conduit/types.rb', line 149

def input_schema
  @input_schema
end

#integrationObject

Returns the value of attribute integration

Returns:

  • (Object)

    the current value of integration



149
150
151
# File 'lib/datagrout_conduit/types.rb', line 149

def integration
  @integration
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



149
150
151
# File 'lib/datagrout_conduit/types.rb', line 149

def name
  @name
end

#scoreObject

Returns the value of attribute score

Returns:

  • (Object)

    the current value of score



149
150
151
# File 'lib/datagrout_conduit/types.rb', line 149

def score
  @score
end

#serverObject

Returns the value of attribute server

Returns:

  • (Object)

    the current value of server



149
150
151
# File 'lib/datagrout_conduit/types.rb', line 149

def server
  @server
end

Class Method Details

.from_hash(hash) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/datagrout_conduit/types.rb', line 150

def self.from_hash(hash)
  hash = hash.transform_keys(&:to_s)
  # DG returns "tool_name" (not "name") and "input_contract" (not "input_schema")
  new(
    name: hash["tool_name"] || hash["name"],
    description: hash["description"],
    input_schema: hash["input_contract"] || hash["input_schema"] || hash["inputSchema"],
    score: hash["score"]&.to_f,
    integration: hash["integration"],
    server: hash["server"]
  )
end