Module: ActsAsIcontact::Rails::ClassMethods::Mappings
- Included in:
- ActiveRecord::Base
- Defined in:
- lib/acts_as_icontact/rails/mappings.rb
Constant Summary collapse
- ICONTACT_DEFAULT_MAPPINGS =
{ :contactId => [:icontact_id, :icontactId], :email => [:email, :email_address, :eMail, :emailAddress], :firstName => [:firstName, :first_name, :fname], :lastName => [:lastName, :last_name, :lname], :street => [:street, :street1, :address, :address1], :street2 => [:street2, :address2], :city => [:city], :state => [:state, :province, :state_or_province], :postalCode => [:postalCode, :postal_code, :zipCode, :zip_code, :zip], :phone => [:phone, :phoneNumber, :phone_number], :fax => [:fax, :faxNumber, :fax_number], :business => [:business, :company, :companyName, :company_name, :businessName, :business_name], :status => [:icontact_status, :icontactStatus], :createDate => [:icontact_created, :icontactCreated, :icontact_create_date, :icontactCreateDate], :bounceCount => [:icontact_bounces, :icontactBounces, :icontact_bounce_count, :icontactBounceCount] }
Instance Method Summary collapse
-
#icontact_identity_map ⇒ Object
A two-element array indicating the association used to uniquely identify this record between Rails and iContact.
-
#icontact_mappings ⇒ Object
A hash containing the final list of iContact-to-Rails mappings.
Instance Method Details
#icontact_identity_map ⇒ Object
A two-element array indicating the association used to uniquely identify this record between Rails and iContact. The first element is the Rails field; the second element is the iContact field. First uses whatever field maps the contactId; if none, looks for a mapping from the Rails ID. Uses the email address mapping (which is required) as a last resort.
34 35 36 |
# File 'lib/acts_as_icontact/rails/mappings.rb', line 34 def icontact_identity_map icontact_mappings.rassoc(:contactId) or icontact_mappings.assoc(:id) or icontact_mappings.rassoc(:email) end |
#icontact_mappings ⇒ Object
A hash containing the final list of iContact-to-Rails mappings. The mappings take into account both analysis of existing field names and explicit mappings on the ‘acts_as_icontact` macro line.
26 27 28 |
# File 'lib/acts_as_icontact/rails/mappings.rb', line 26 def icontact_mappings @icontact_mappings end |