Class: MOCO::Contact
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::Contact
- Defined in:
- lib/moco/entities/contact.rb
Overview
Represents a MOCO contact (person/Ansprechpartner) Contacts are people associated with companies
Required attributes for create:
lastname - String, last name (e.g., "Muster")
gender - String, one of: "F" (female), "M" (male), "U" (unknown/diverse)
Optional attributes:
firstname - String, first name
company_id - Integer, associated company ID
user_id - Integer, responsible user ID (default: current user)
title - String, title (e.g., "Dr.", "Prof.")
job_position - String, job title (e.g., "Account Manager")
mobile_phone - String, mobile phone number
work_phone - String, work phone number
work_fax - String, work fax number
work_email - String, work email address
work_address - String, work address (use \n for line breaks)
home_email - String, personal email
home_address - String, home address
birthday - String, "YYYY-MM-DD" format (e.g., "1990-05-22")
info - String, additional notes
tags - Array of Strings, e.g., ["VIP", "Newsletter"]
Read-only attributes (returned by API):
id, avatar_url, company (Hash), created_at, updated_at
Example:
moco.contacts.create(
firstname: "John",
lastname: "Doe",
gender: "M",
company_id: 123456,
work_email: "john.doe@example.com",
job_position: "CTO"
)
Instance Attribute Summary
Attributes inherited from BaseEntity
Class Method Summary collapse
-
.entity_path ⇒ Object
Override entity_path to match API path.
Instance Method Summary collapse
-
#company ⇒ Object
Associations.
- #to_s ⇒ Object
Methods inherited from BaseEntity
#==, #association, #destroy, #eql?, #has_many, #hash, #id, #initialize, #inspect, #reload, #save, #to_h, #to_json, #update
Constructor Details
This class inherits a constructor from MOCO::BaseEntity
Class Method Details
.entity_path ⇒ Object
Override entity_path to match API path
43 44 45 |
# File 'lib/moco/entities/contact.rb', line 43 def self.entity_path "contacts/people" end |
Instance Method Details
#company ⇒ Object
Associations
48 49 50 |
# File 'lib/moco/entities/contact.rb', line 48 def company association(:company) end |
#to_s ⇒ Object
52 53 54 |
# File 'lib/moco/entities/contact.rb', line 52 def to_s "#{firstname} #{lastname}" end |