Class: MoveToGo::CustomValue

Inherits:
Object
  • Object
show all
Includes:
SerializeHelper
Defined in:
lib/move-to-go/model/customfield.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializeHelper

#serialize, #serialize_to_file

Constructor Details

#initialize(opt = nil) ⇒ CustomValue

Returns a new instance of CustomValue.



63
64
65
66
67
68
69
70
# File 'lib/move-to-go/model/customfield.rb', line 63

def initialize(opt=nil)
    if opt != nil
        serialize_variables.each do |myattr|
            val = opt[myattr[:id]]
            instance_variable_set("@" + myattr[:id].to_s, val) if val != nil
        end
    end
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



61
62
63
# File 'lib/move-to-go/model/customfield.rb', line 61

def field
  @field
end

#valueObject

Returns the value of attribute value.



61
62
63
# File 'lib/move-to-go/model/customfield.rb', line 61

def value
  @value
end

Instance Method Details

#get_import_rowsObject



77
78
79
80
81
# File 'lib/move-to-go/model/customfield.rb', line 77

def get_import_rows
    serialize_variables.map do |p|
        map_to_row p
    end
end

#serialize_nameObject



83
84
85
# File 'lib/move-to-go/model/customfield.rb', line 83

def serialize_name
    "CustomValue"
end

#serialize_variablesObject



72
73
74
75
# File 'lib/move-to-go/model/customfield.rb', line 72

def serialize_variables
    [ { :id =>:field, :type => :custom_field_reference },
        { :id =>:value, :type => :string }]
end