Class: MoveToGo::OrganizationReference
- Inherits:
-
Object
- Object
- MoveToGo::OrganizationReference
- Includes:
- SerializeHelper
- Defined in:
- lib/move-to-go/model/organization.rb
Instance Attribute Summary collapse
-
#heading ⇒ Object
Returns the value of attribute heading.
-
#id ⇒ Object
Returns the value of attribute id.
-
#integration_id ⇒ Object
Returns the value of attribute integration_id.
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(opt = nil) ⇒ OrganizationReference
constructor
A new instance of OrganizationReference.
- #serialize_variables ⇒ Object
- #to_s ⇒ Object
Methods included from SerializeHelper
#get_import_rows, #serialize, #serialize_to_file
Constructor Details
#initialize(opt = nil) ⇒ OrganizationReference
Returns a new instance of OrganizationReference.
13 14 15 16 17 18 19 20 |
# File 'lib/move-to-go/model/organization.rb', line 13 def initialize(opt = nil) if opt != nil serialize_variables.each do |var| value = opt[var[:id]] instance_variable_set("@" + var[:id].to_s, value) if value != nil end end end |
Instance Attribute Details
#heading ⇒ Object
Returns the value of attribute heading.
5 6 7 |
# File 'lib/move-to-go/model/organization.rb', line 5 def heading @heading end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/move-to-go/model/organization.rb', line 5 def id @id end |
#integration_id ⇒ Object
Returns the value of attribute integration_id.
5 6 7 |
# File 'lib/move-to-go/model/organization.rb', line 5 def integration_id @integration_id end |
Class Method Details
.from_organization(organization) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/move-to-go/model/organization.rb', line 30 def self.from_organization(organization) if organization.nil? return nil elsif organization.is_a?(Organization) return organization.to_reference elsif organization.is_a?(OrganizationReference) return organization end end |
Instance Method Details
#empty? ⇒ Boolean
26 27 28 |
# File 'lib/move-to-go/model/organization.rb', line 26 def empty? return !@integration_id && !@id && !@heading end |
#serialize_variables ⇒ Object
6 7 8 9 10 11 |
# File 'lib/move-to-go/model/organization.rb', line 6 def serialize_variables [ :id, :integration_id, :heading ].map { |prop| { :id => prop, :type => :string } } end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/move-to-go/model/organization.rb', line 22 def to_s return "(#{id}, #{integration_id}, #{heading})" end |