Class: DatagroutConduit::DiscoverResult
- Inherits:
-
Struct
- Object
- Struct
- DatagroutConduit::DiscoverResult
- Defined in:
- lib/datagrout_conduit/types.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
Returns the value of attribute query.
-
#tools ⇒ Object
Returns the value of attribute tools.
-
#total ⇒ Object
Returns the value of attribute total.
Class Method Summary collapse
Instance Attribute Details
#query ⇒ Object
Returns the value of attribute query
164 165 166 |
# File 'lib/datagrout_conduit/types.rb', line 164 def query @query end |
#tools ⇒ Object
Returns the value of attribute tools
164 165 166 |
# File 'lib/datagrout_conduit/types.rb', line 164 def tools @tools end |
#total ⇒ Object
Returns the value of attribute total
164 165 166 |
# File 'lib/datagrout_conduit/types.rb', line 164 def total @total end |
Class Method Details
.from_hash(hash) ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/datagrout_conduit/types.rb', line 165 def self.from_hash(hash) hash = hash.transform_keys(&:to_s) # DG returns "results" (not "tools") and "goal_used" (not "query") tools_raw = hash["results"] || hash["tools"] || [] tools = tools_raw.map { |t| DiscoveredTool.from_hash(t) } new( tools: tools, query: hash["goal_used"] || hash["query"], total: hash["total"] || tools.size ) end |