Class: FruitToLime::Organization
- Inherits:
-
Object
- Object
- FruitToLime::Organization
- Includes:
- ModelHasCustomFields, ModelHasTags, SerializeHelper
- Defined in:
- lib/fruit_to_lime/model/organization.rb
Instance Attribute Summary collapse
-
#central_phone_number ⇒ Object
Returns the value of attribute central_phone_number.
-
#email ⇒ Object
Returns the value of attribute email.
-
#employees ⇒ Object
readonly
Returns the value of attribute employees.
-
#external_link ⇒ Object
Returns the value of attribute external_link.
-
#id ⇒ Object
Returns the value of attribute id.
-
#integration_id ⇒ Object
Returns the value of attribute integration_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#organization_number ⇒ Object
Returns the value of attribute organization_number.
-
#postal_address ⇒ Object
Returns the value of attribute postal_address.
-
#responsible_coworker ⇒ Object
Returns the value of attribute responsible_coworker.
-
#source_data ⇒ Object
Returns the value of attribute source_data.
-
#visit_address ⇒ Object
Returns the value of attribute visit_address.
-
#web_site ⇒ Object
Returns the value of attribute web_site.
Instance Method Summary collapse
- #==(that) ⇒ Object
- #add_employee(val) ⇒ Object
-
#initialize ⇒ Organization
constructor
A new instance of Organization.
- #serialize_name ⇒ Object
- #serialize_variables ⇒ Object
- #to_reference ⇒ Object
- #to_s ⇒ Object
- #validate ⇒ Object
- #with_postal_address {|@postal_address| ... } ⇒ Object
- #with_source {|@source| ... } ⇒ Object
- #with_visit_address {|@visit_address| ... } ⇒ Object
Methods included from SerializeHelper
#get_import_rows, get_import_rows, #map_symbol_to_row, #map_to_row, serialize, #serialize, #serialize_to_file, serialize_to_file, serialize_variables, #symbol_to_name
Methods included from ModelHasCustomFields
Methods included from ModelHasTags
Constructor Details
#initialize ⇒ Organization
Returns a new instance of Organization.
51 52 |
# File 'lib/fruit_to_lime/model/organization.rb', line 51 def initialize() end |
Instance Attribute Details
#central_phone_number ⇒ Object
Returns the value of attribute central_phone_number.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def central_phone_number @central_phone_number end |
#email ⇒ Object
Returns the value of attribute email.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def email @email end |
#employees ⇒ Object (readonly)
Returns the value of attribute employees.
49 50 51 |
# File 'lib/fruit_to_lime/model/organization.rb', line 49 def employees @employees end |
#external_link ⇒ Object
Returns the value of attribute external_link.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def external_link @external_link end |
#id ⇒ Object
Returns the value of attribute id.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def id @id end |
#integration_id ⇒ Object
Returns the value of attribute integration_id.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def integration_id @integration_id end |
#name ⇒ Object
Returns the value of attribute name.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def name @name end |
#organization_number ⇒ Object
Returns the value of attribute organization_number.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def organization_number @organization_number end |
#postal_address ⇒ Object
Returns the value of attribute postal_address.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def postal_address @postal_address end |
#responsible_coworker ⇒ Object
Returns the value of attribute responsible_coworker.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def responsible_coworker @responsible_coworker end |
#source_data ⇒ Object
Returns the value of attribute source_data.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def source_data @source_data end |
#visit_address ⇒ Object
Returns the value of attribute visit_address.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def visit_address @visit_address end |
#web_site ⇒ Object
Returns the value of attribute web_site.
46 47 48 |
# File 'lib/fruit_to_lime/model/organization.rb', line 46 def web_site @web_site end |
Instance Method Details
#==(that) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/fruit_to_lime/model/organization.rb', line 62 def ==(that) if that.nil? return false end if that.is_a? Organization return @integration_id == that.integration_id elsif that.is_a? String return @integration_id == that end return false end |
#add_employee(val) ⇒ Object
91 92 93 94 |
# File 'lib/fruit_to_lime/model/organization.rb', line 91 def add_employee(val) @employees = [] if @employees==nil @employees.push(if val.is_a? Person then val else Person.new(val) end) end |
#serialize_name ⇒ Object
113 114 115 |
# File 'lib/fruit_to_lime/model/organization.rb', line 113 def serialize_name "Organization" end |
#serialize_variables ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/fruit_to_lime/model/organization.rb', line 96 def serialize_variables [ :id, :integration_id, :name, :organization_number, :external_link, :email, :web_site, :central_phone_number ].map { |prop| { :id => prop, :type => :string } } + [ { :id => :postal_address, :type => :address }, { :id => :visit_address, :type => :address }, { :id => :employees, :type => :persons }, { :id => :tags, :type => :tags }, { :id => :custom_fields, :type => :custom_fields }, { :id => :source, :type => :source_ref }, { :id => :responsible_coworker, :type => :coworker_reference} ] end |
#to_reference ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/fruit_to_lime/model/organization.rb', line 54 def to_reference() reference = OrganizationReference.new reference.id = @id reference.integration_id = @integration_id reference.heading = @name return reference end |
#to_s ⇒ Object
117 118 119 |
# File 'lib/fruit_to_lime/model/organization.rb', line 117 def to_s return "#{name}" end |
#validate ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/fruit_to_lime/model/organization.rb', line 121 def validate error = String.new if @name.nil? || @name.empty? error = "A name is required for organization.\n#{serialize()}" end if @employees != nil @employees.each do |person| = person.validate() if !.empty? error = "#{error}\n#{validation_message}" end end end return error end |
#with_postal_address {|@postal_address| ... } ⇒ Object
76 77 78 79 |
# File 'lib/fruit_to_lime/model/organization.rb', line 76 def with_postal_address @postal_address = Address.new yield @postal_address end |
#with_source {|@source| ... } ⇒ Object
86 87 88 89 |
# File 'lib/fruit_to_lime/model/organization.rb', line 86 def with_source @source = ReferenceToSource.new yield @source end |
#with_visit_address {|@visit_address| ... } ⇒ Object
81 82 83 84 |
# File 'lib/fruit_to_lime/model/organization.rb', line 81 def with_visit_address @visit_address = Address.new yield @visit_address end |