Class: Amorail::Property::Task

Inherits:
PropertyItem show all
Defined in:
lib/amorail/property.rb

Instance Attribute Summary

Attributes inherited from PropertyItem

#data

Class Method Summary collapse

Methods inherited from PropertyItem

#[], #initialize

Methods included from MethodMissing

#method_missing, #respond_to_missing?

Constructor Details

This class inherits a constructor from Amorail::Property::PropertyItem

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Amorail::MethodMissing

Class Method Details

.parse(data) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/amorail/property.rb', line 118

def self.parse(data)
  hash = {}
  data.fetch('task_types', []).each do |tt|
    prop_item = PropertyItem.new(tt)
    identifier = tt['code'].presence || tt['name'].presence
    next if identifier.nil?

    hash[identifier.downcase] = prop_item
    hash[identifier] = prop_item
  end
  new hash
end