Class: MoveToGo::Meeting
- Inherits:
-
CanBecomeImmutable
- Object
- CanBecomeImmutable
- MoveToGo::Meeting
- Includes:
- SerializeHelper
- Defined in:
- lib/move-to-go/model/meeting.rb
Instance Attribute Summary collapse
-
#assigned_coworker ⇒ Object
Returns the value of attribute assigned_coworker.
-
#created_by ⇒ Object
Returns the value of attribute created_by.
-
#date_start ⇒ Object
Returns the value of attribute date_start.
-
#date_start_has_time ⇒ Object
Returns the value of attribute date_start_has_time.
-
#date_stop ⇒ Object
Returns the value of attribute date_stop.
-
#datechecked ⇒ Object
Returns the value of attribute datechecked.
-
#deal ⇒ Object
Returns the value of attribute deal.
-
#heading ⇒ Object
Returns the value of attribute heading.
-
#location ⇒ Object
Returns the value of attribute location.
-
#organization ⇒ Object
Returns the value of attribute organization.
-
#person ⇒ Object
Returns the value of attribute person.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #get_import_rows ⇒ Object
-
#id ⇒ Object
:attr_accessor: id.
-
#initialize(opt = nil) ⇒ Meeting
constructor
A new instance of Meeting.
-
#integration_id ⇒ Object
:attr_accessor: integration_id.
- #serialize_name ⇒ Object
- #serialize_variables ⇒ Object
- #validate ⇒ Object
Methods included from SerializeHelper
#serialize, #serialize_to_file
Methods inherited from CanBecomeImmutable
immutable_accessor, #is_immutable, #raise_if_immutable, #set_is_immutable
Constructor Details
#initialize(opt = nil) ⇒ Meeting
Returns a new instance of Meeting.
15 16 17 18 19 20 21 22 |
# File 'lib/move-to-go/model/meeting.rb', line 15 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
#assigned_coworker ⇒ Object
Returns the value of attribute assigned_coworker.
13 14 15 |
# File 'lib/move-to-go/model/meeting.rb', line 13 def assigned_coworker @assigned_coworker end |
#created_by ⇒ Object
Returns the value of attribute created_by.
13 14 15 |
# File 'lib/move-to-go/model/meeting.rb', line 13 def created_by @created_by end |
#date_start ⇒ Object
Returns the value of attribute date_start.
12 13 14 |
# File 'lib/move-to-go/model/meeting.rb', line 12 def date_start @date_start end |
#date_start_has_time ⇒ Object
Returns the value of attribute date_start_has_time.
12 13 14 |
# File 'lib/move-to-go/model/meeting.rb', line 12 def date_start_has_time @date_start_has_time end |
#date_stop ⇒ Object
Returns the value of attribute date_stop.
11 12 13 |
# File 'lib/move-to-go/model/meeting.rb', line 11 def date_stop @date_stop end |
#datechecked ⇒ Object
Returns the value of attribute datechecked.
12 13 14 |
# File 'lib/move-to-go/model/meeting.rb', line 12 def datechecked @datechecked end |
#deal ⇒ Object
Returns the value of attribute deal.
13 14 15 |
# File 'lib/move-to-go/model/meeting.rb', line 13 def deal @deal end |
#heading ⇒ Object
Returns the value of attribute heading.
11 12 13 |
# File 'lib/move-to-go/model/meeting.rb', line 11 def heading @heading end |
#location ⇒ Object
Returns the value of attribute location.
11 12 13 |
# File 'lib/move-to-go/model/meeting.rb', line 11 def location @location end |
#organization ⇒ Object
Returns the value of attribute organization.
13 14 15 |
# File 'lib/move-to-go/model/meeting.rb', line 13 def organization @organization end |
#person ⇒ Object
Returns the value of attribute person.
13 14 15 |
# File 'lib/move-to-go/model/meeting.rb', line 13 def person @person end |
#text ⇒ Object
Returns the value of attribute text.
11 12 13 |
# File 'lib/move-to-go/model/meeting.rb', line 11 def text @text end |
Instance Method Details
#get_import_rows ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/move-to-go/model/meeting.rb', line 43 def get_import_rows (serialize_variables + [ { :id => :organization, :type => :organization_reference}, { :id => :person, :type => :person_reference} ]).map do |p| map_to_row p end end |
#id ⇒ Object
:attr_accessor: id
6 |
# File 'lib/move-to-go/model/meeting.rb', line 6 immutable_accessor :id |
#integration_id ⇒ Object
:attr_accessor: integration_id
9 |
# File 'lib/move-to-go/model/meeting.rb', line 9 immutable_accessor :integration_id |
#serialize_name ⇒ Object
52 53 54 |
# File 'lib/move-to-go/model/meeting.rb', line 52 def serialize_name "Meeting" end |
#serialize_variables ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/move-to-go/model/meeting.rb', line 24 def serialize_variables [ :id, :text, :heading, :location, :integration_id ].map { |p| { :id => p, :type => :string } } + [ { :id => :date_start, :type => :datetime }, { :id => :date_stop, :type => :datetime }, { :id => :date_start_has_time, :type => :bool }, { :id => :created_by_reference, :type => :coworker_reference, :element_name => :created_by }, { :id => :assigned_coworker_reference, :type => :coworker_reference, :element_name => :assigned_coworker }, { :id => :organization_reference, :type => :organization_reference, :element_name => :organization }, { :id => :deal_reference, :type => :deal_reference, :element_name => :deal }, { :id => :person_reference, :type => :person_reference, :element_name => :person } ] end |
#validate ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/move-to-go/model/meeting.rb', line 189 def validate error = String.new if (@heading.nil? || @heading.empty?) error = "Heading is required for meeting\n" end if @created_by.nil? error = "#{error}Created_by is required for meeting\n" end if @date_start.nil? error = "#{error}Date_start is required for meeting\n" end if @date_start_has_time.nil? error = "#{error}Date_start_has_time is required for meeting\n" end if @date_stop.nil? error = "#{error}Date_stop is required for meeting\n" end if @organization.nil? error = "#{error}Organization is required for meeting\n" end return error end |