Class: PropertyConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker_inject/property_config.rb

Instance Method Summary collapse

Instance Method Details

#gosquared_custom_propertiesObject


22
23
24
25
26
27
28
# File 'lib/tracker_inject/property_config.rb', line 22

def gosquared_custom_properties
  @custom_properties = "custom: { \n "
  @custom_properties_hash.each do |key, value|
   @custom_properties  << "#{key}: '#{value}',\n "
 end
 @custom_properties << '}'
end

#gosquared_standard_propertiesObject


30
31
32
33
34
35
36
37
# File 'lib/tracker_inject/property_config.rb', line 30

def gosquared_standard_properties
  @standard_properties=  " { \n "
  @standard_properties_hash.each do |key, value|
   @standard_properties  << "#{key}: '#{value}',\n "
 end
 @standard_properties << '}' if @custom_properties == "custom: { \n }"
 @standard_properties
end

#sort_property_fields(hash) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tracker_inject/property_config.rb', line 4

def sort_property_fields(hash)
  validate_properties(hash)
  property_fields = ['id', 'email', 'name', 'first_name', 'last_name',
    'username', 'phone', 'created_at']

    @standard_properties_hash = {}
    @custom_properties_hash = {}
    hash.each do | key, value |
      property_fields.each do | property |
       if key.to_s === property
        @standard_properties_hash[key] = value
        hash.except!(key)
      end
      @custom_properties_hash = hash
    end
  end
end