Class: MoveToGo::CoworkerReference

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializeHelper

#get_import_rows, #serialize, #serialize_to_file

Constructor Details

#initialize(opt = nil) ⇒ CoworkerReference

Returns a new instance of CoworkerReference.



6
7
8
9
10
11
12
13
# File 'lib/move-to-go/model/coworker_reference.rb', line 6

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

#headingObject

Returns the value of attribute heading.



4
5
6
# File 'lib/move-to-go/model/coworker_reference.rb', line 4

def heading
  @heading
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/move-to-go/model/coworker_reference.rb', line 4

def id
  @id
end

#integration_idObject

Returns the value of attribute integration_id.



4
5
6
# File 'lib/move-to-go/model/coworker_reference.rb', line 4

def integration_id
  @integration_id
end

Class Method Details

.from_coworker(coworker) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/move-to-go/model/coworker_reference.rb', line 23

def self.from_coworker(coworker)
    if coworker.nil?
        return nil
    elsif coworker.is_a?(Coworker)
        return coworker.to_reference
    elsif coworker.is_a?(CoworkerReference)
        return coworker
    end
end

Instance Method Details

#serialize_nameObject



19
20
21
# File 'lib/move-to-go/model/coworker_reference.rb', line 19

def serialize_name
    "CoworkerReference"
end

#serialize_variablesObject



15
16
17
# File 'lib/move-to-go/model/coworker_reference.rb', line 15

def serialize_variables
    [:id, :integration_id, :heading].map {|p| {:id => p, :type => :string} }
end