 request = require('request')
 
 class DataHelper
+  'fetchDefs': ->
+    @fetchStatDefs (error, response, body) =>
+      @statDefs = JSON.parse(body)
+    @fetchVendorDefs (error, response, body) =>
+      @vendorDefs = JSON.parse(body)
+
   'serializeFromApi': (response) ->
     damageColor =
       Kinetic: '#d9d9d9'

    nodes: response.data.talentNodes
    nodeDefs: response.definitions.talentGrids[item.talentGridHash].nodes
    damageType: damageTypeName

  'parseItemAttachment': (item) ->
    name = "#{item.itemName}"

      column++
    return orderedNodes

  # creates fields for perks and their descriptions
  'buildFields': (nodes, nodeDefs) ->
    displayNodes = nodes.map (node) ->
      step = nodeDefs[node.nodeIndex].steps[node.stepIndex]
      description = step.nodeStepDescription.replace(/(\r\n|\n|\r)/gm," ").replace("  "," ")

      title: step.nodeStepName
      value: description
      short: true

    displayNodes.filter (x) -> x

  'buildText': (nodes, nodeDefs) ->
    getName = (node) ->
      step = nodeDefs[node.nodeIndex].steps[node.stepIndex]
