Class: MoxiworksPlatform::Contact

Inherits:
Resource
  • Object
show all
Defined in:
lib/moxiworks_platform/contact.rb

Overview

Moxi Works Platform Contact

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

accept_header, attr_accessor, #attributes, attributes, auth_header, content_type, headers, #initialize, #to_hash

Constructor Details

This class inherits a constructor from MoxiworksPlatform::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object (private)


650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/moxiworks_platform/contact.rb', line 650

def method_missing(meth, *args, &block)
  float_attrs = [:property_baths, :search_min_baths]
  int_attrs = [:property_beds, :property_list_price, :search_min_year_built,
               :search_min_sq_ft, :search_min_price, :search_min_beds,
               :search_max_year_built, :search_max_sq_ft, :search_max_price,
               :search_max_lot_size]
  all_attrs = float_attrs + int_attrs

  name = meth.to_sym
  if all_attrs.include? name
    return numeric_value_for(name, type: :integer) if int_attrs.include? name
    return numeric_value_for(name, type: :float) if float_attrs.include? name
  end
  super(meth, *args, &block)
end

Instance Attribute Details

#business_websiteString

the full URL of the business website to be associated with this Contact

Returns:

  • (String)

    – Default ''


34
35
36
# File 'lib/moxiworks_platform/contact.rb', line 34

def business_website
  @business_website
end

#contact_nameString

the full name of this Contact

Returns:

  • (String)

    – Default ''


40
41
42
# File 'lib/moxiworks_platform/contact.rb', line 40

def contact_name
  @contact_name
end

#genderString, Enumerated

Note:

The single character representation will be used after saving to Moxi Works Platform no matter whether the word or single character representation is passed in.

the gender of this Contact. the first initial of either gender type may be used or the full word 'male' or 'female.'

Returns:

  • (String, Enumerated)

    – a single character 'm' or 'f' or – Default ''


49
50
51
# File 'lib/moxiworks_platform/contact.rb', line 49

def gender
  @gender
end

#home_cityString

the city of the residence of this Contact

Returns:

  • (String)

    – Default ''


61
62
63
# File 'lib/moxiworks_platform/contact.rb', line 61

def home_city
  @home_city
end

#home_countryString

the country of the residence of this Contact

this can either be the country's abbreviation or the full name of the country

Returns:

  • (String)

    – Default ''


89
90
91
# File 'lib/moxiworks_platform/contact.rb', line 89

def home_country
  @home_country
end

#home_neighborhoodString

the neighborhood of the residence of this Contact

Returns:

  • (String)

    – Default ''


81
82
83
# File 'lib/moxiworks_platform/contact.rb', line 81

def home_neighborhood
  @home_neighborhood
end

#home_stateString

the state in which the residence of this Contact is located

this can either be the state's abbreviation or the full name of the state

Returns:

  • (String)

    – Default ''


69
70
71
# File 'lib/moxiworks_platform/contact.rb', line 69

def home_state
  @home_state
end

#home_street_addressString

the street address of the residence of this Contact

Returns:

  • (String)

    – Default ''


55
56
57
# File 'lib/moxiworks_platform/contact.rb', line 55

def home_street_address
  @home_street_address
end

#home_zipString

the zip code of the residence of this Contact

Returns:

  • (String)

    – Default ''


75
76
77
# File 'lib/moxiworks_platform/contact.rb', line 75

def home_zip
  @home_zip
end

#job_titleString

the specific job title this contact has; ex: 'Senior VP of Operations'

Returns:

  • (String)

    – Default ''


95
96
97
# File 'lib/moxiworks_platform/contact.rb', line 95

def job_title
  @job_title
end

#moxi_works_agent_idString

moxi_works_agent_id is the Moxi Works Platform ID of the agent which a contact is or is to be associated with.

this must be set for any Moxi Works Platform transaction

Returns:

  • (String)

    the Moxi Works Platform ID of the agent


12
13
14
# File 'lib/moxiworks_platform/contact.rb', line 12

def moxi_works_agent_id
  @moxi_works_agent_id
end

#moxi_works_contact_idString

Moxi Works Platform ID for the Contact

Returns:

  • (String)

    Moxi Works Platform ID for the contact


27
# File 'lib/moxiworks_platform/contact.rb', line 27

attr_accessor :partner_contact_id

#occupationString

the general occupation of this contact; ex: 'Software Developer'

Returns:

  • (String)

    – Default ''


101
102
103
# File 'lib/moxiworks_platform/contact.rb', line 101

def occupation
  @occupation
end

#partner_agent_idString

your system's unique identifier for the agent that this contact will be associated with

Returns:

  • (String)

    – Default ''


107
108
109
# File 'lib/moxiworks_platform/contact.rb', line 107

def partner_agent_id
  @partner_agent_id
end

#partner_contact_idObject

Returns the value of attribute partner_contact_id


20
21
22
# File 'lib/moxiworks_platform/contact.rb', line 20

def partner_contact_id
  @partner_contact_id
end

#primary_email_addressString

the email address the contact would want to be contacted via first

Returns:

  • (String)

    – Default ''


113
114
115
# File 'lib/moxiworks_platform/contact.rb', line 113

def primary_email_address
  @primary_email_address
end

#primary_phone_numberString

the phone number the contact would want to be contacted via first

Returns:

  • (String)

    – Default ''


119
120
121
# File 'lib/moxiworks_platform/contact.rb', line 119

def primary_phone_number
  @primary_phone_number
end

#property_bathsFloat

the number of bathrooms in the listing the contact has expressed interest in

Property of Interest (POI) attribute

Returns:

  • (Float)

    – Default nil


140
# File 'lib/moxiworks_platform/contact.rb', line 140

attr_writer :property_baths

#property_bedsInteger

the number of bedrooms in the listing the contact has expressed interest in

Property of Interest (POI) attribute

Returns:

  • (Integer)

    – Default nil


149
# File 'lib/moxiworks_platform/contact.rb', line 149

attr_writer :property_beds

#property_cityString

the city in which the listing the contact has expressed interest in is located

Property of Interest (POI) attribute

Returns:

  • (String)

    – Default ''


158
159
160
# File 'lib/moxiworks_platform/contact.rb', line 158

def property_city
  @property_city
end

#property_list_priceInteger

the list_price of the property the contact has expressed interest in

Property of Interest (POI) attribute

Returns:

  • (Integer)

    – Default nil


167
# File 'lib/moxiworks_platform/contact.rb', line 167

attr_writer :property_list_price

#property_listing_statusString

Property of Interest (POI) attribute

the status of the listing of the Property of Interest; ex: 'Active' or 'Sold'

Returns:

  • (String)

    – Default ''


176
177
178
# File 'lib/moxiworks_platform/contact.rb', line 176

def property_listing_status
  @property_listing_status
end

#property_mls_idString

the MLS ID of the listing that of the Property of Interest

Property of Interest (POI) attribute

Returns:

  • (String)

    – Default ''


185
186
187
# File 'lib/moxiworks_platform/contact.rb', line 185

def property_mls_id
  @property_mls_id
end

#property_photo_urlString

a full URL to a photo of the Property of Interest

Property of Interest (POI) attribute

Returns:

  • (String)

    – Default ''


194
195
196
# File 'lib/moxiworks_platform/contact.rb', line 194

def property_photo_url
  @property_photo_url
end

#property_stateString

the state in which the listing the contact has expressed interest in is located

Property of Interest (POI) attribute

Returns:

  • (String)

    – Default ''


203
204
205
# File 'lib/moxiworks_platform/contact.rb', line 203

def property_state
  @property_state
end

#property_street_addressString

the street address of the listing the contact has expressed interest in is located

Property of Interest (POI) attribute

Returns:

  • (String)

    – Default ''


212
213
214
# File 'lib/moxiworks_platform/contact.rb', line 212

def property_street_address
  @property_street_address
end

#property_urlString

a URL referencing a HTTP(S) location which has information about the listing

Property of Interest (POI) attribute

Returns:

  • (String)

    – Default ''


221
222
223
# File 'lib/moxiworks_platform/contact.rb', line 221

def property_url
  @property_url
end

#property_zipString

the zip code in which the listing the contact has expressed interest in is located

Property of Interest (POI) attribute

Returns:

  • (String)

    – Default ''


230
231
232
# File 'lib/moxiworks_platform/contact.rb', line 230

def property_zip
  @property_zip
end

#search_cityString

the city which the contact has searched for listings in

Property Search (PS) attribute

Returns:

  • (String)

    – Default ''


239
240
241
# File 'lib/moxiworks_platform/contact.rb', line 239

def search_city
  @search_city
end

#search_max_lot_sizeInteger

the maximum lot size used by the contact when searching for listings

Property Search (PS) attribute

Returns:

  • (Integer)

    – Default nil


266
# File 'lib/moxiworks_platform/contact.rb', line 266

attr_writer :search_max_lot_size

#search_max_priceInteger

the maximum price value used by the contact when searching for listings

Property Search (PS) attribute

Returns:

  • (Integer)

    – Default nil


275
# File 'lib/moxiworks_platform/contact.rb', line 275

attr_writer :search_max_price

#search_max_sq_ftInteger

the maximum listing square footage used by the contact when searching for listings

Property Search (PS) attribute

Returns:

  • (Integer)

    – Default nil


284
# File 'lib/moxiworks_platform/contact.rb', line 284

attr_writer :search_max_sq_ft

#search_max_year_builtInteger

the maximum year built used by the contact when searching for listings

Property Search (PS) attribute

Returns:

  • (Integer)

    – Default nil


293
# File 'lib/moxiworks_platform/contact.rb', line 293

attr_writer :search_max_year_built

#search_min_bathsFloat

Property Search (PS) attribute

the minimum number of bathrooms used by the contact when searching for listings

Returns:

  • (Float)

    – Default nil


302
# File 'lib/moxiworks_platform/contact.rb', line 302

attr_writer :search_min_baths

#search_min_bedsInteger

the minimum number of bedrooms used by the contact when searching for listings

Property Search (PS) attribute

Returns:

  • (Integer)

    – Default nil


311
# File 'lib/moxiworks_platform/contact.rb', line 311

attr_writer :search_min_beds

#search_min_priceInteger

the minimum price used by the contact when searching for listings

Property Search (PS) attribute

Returns:

  • (Integer)

    – Default nil


320
# File 'lib/moxiworks_platform/contact.rb', line 320

attr_writer :search_min_price

#search_min_sq_ftInteger

the minimum square footage used by the contact when searching for listings

Property Search (PS) attribute

Returns:

  • (Integer)

    – Default nil


329
# File 'lib/moxiworks_platform/contact.rb', line 329

attr_writer :search_min_sq_ft

#search_min_year_builtInteger

the minimum year built used by the contact when searching for listings

Property Search (PS) attribute

Returns:

  • (Integer)

    – Default nil


338
# File 'lib/moxiworks_platform/contact.rb', line 338

attr_writer :search_min_year_built

#search_property_typesString

the property types used by the contact when searching for listings; ex: 'Condo' 'Single-Family' 'Townhouse'

Property Search (PS) attribute

Returns:

  • (String)

    – Default nil


347
348
349
# File 'lib/moxiworks_platform/contact.rb', line 347

def search_property_types
  @search_property_types
end

#search_stateString

the state which the contact has searched for listings in

Property Search (PS) attribute

Returns:

  • (String)

    – Default ''


248
249
250
# File 'lib/moxiworks_platform/contact.rb', line 248

def search_state
  @search_state
end

#search_zipString

the zip code which the contact has searched for listings in

Property Search (PS) attribute

Returns:

  • (String)

    – Default ''


257
258
259
# File 'lib/moxiworks_platform/contact.rb', line 257

def search_zip
  @search_zip
end

#secondary_email_addressString

an additional email address the contact would want to be contacted by

Returns:

  • (String)

    – Default ''


125
126
127
# File 'lib/moxiworks_platform/contact.rb', line 125

def secondary_email_address
  @secondary_email_address
end

#secondary_phone_numberString

an additional phone number the contact would want to be contacted by

Returns:

  • (String)

    – Default ''


131
132
133
# File 'lib/moxiworks_platform/contact.rb', line 131

def secondary_phone_number
  @secondary_phone_number
end

Class Method Details

.create(opts = {}) ⇒ MoxiworksPlatform::Contact

Creates a new Contact in Moxi Works Platform

Examples:

MoxiworksPlatform::Contact.create(
  moxi_works_agent_id: '123abc',
  partner_contact_id: '1234',
  contact_name: 'george p warshington',
  home_street: '123 this way',
  home_city: 'cittyvile',
  home_state: 'HI',
  home_country: 'USA',
  home_neighborhood: 'my hood',
  job_title: 'junior bacon burner',
  occupation: 'chef',
  business_website: 'http://bear.wrass.ler',
  primary_email_address: '[email protected]',
  primary_phone_number: '123213',
  property_mls_id: '1232312abcv',
  secondary_phone_number: '1234567890')

Parameters:

  • opts (Hash) (defaults to: {})

    named parameter Hash

Options Hash (opts):

  • :moxi_works_agent_id (String)

    REQUIRED The Moxi Works Agent ID for the agent to which this contact is to be associated

  • :partner_contact_id (String)

    REQUIRED Your system's unique ID for this contact.

    optional Contact parameters

  • :business_website (String)

    full url of a website associated with this contact

  • :contact_name (String)

    full name of this contact in format “Firstname Middlename Lastname”

  • :gender (String, Enumerated)

    can be “male” or “female” or “m” or “f”

  • :home_street_address (String)

    the street address and street on which the contact lives

  • :home_city (String)

    city or township in which this contact lives

  • :home_state (String)

    state in which this contact lives; can be abbreviation or full name

  • :home_zip (String)

    zip code in which this contact lives

  • :home_neighborhood (String)

    neighborhood in which this contact lives

  • :home_country (String)

    country in which this contact lives; can be abbreviation or full name

  • :job_title (String)

    the specific job title this contact has; ex: 'Senior VP of Operations'

  • :occupation (String)

    the general occupation of this contact; ex: 'Software Developer'

  • :partner_agent_id (String)

    your system's unique ID for the agent this contact is to be associated with

  • :primary_email_address (String)

    the primary email address for this contact

  • :primary_phone_number (String)

    the primary phone number for this contact

  • :secondary_email_address (String)

    the secondary email address for this contact

  • :secondary_phone_number (String)

    the secondary phone number for this contact

    optional Property of Interest (POI) parameters:

    The POI is a property that the contact has shown interest in.
    
  • :property_baths (Float)

    the number of baths in the Property of Interest

  • :property_beds (Integer)

    the number of bedrooms in the Property of Interest

  • :property_city (String)

    the city in which the Property of Interest is located

  • :property_list_price (Integer)

    the list price of the Property of Interest

  • :property_listing_status (String)

    the status of the Property of Interest; ex: 'Active' or 'Sold'

  • :property_mls_id (String)

    the MLS ID of the listing

  • :property_photo_url (String)

    a full URL of an image of the Property of Interest

  • :property_state (String)

    the state which the Property of Interest is in

  • :property_street_address (String)

    the street address that the Property of Interest is on

  • :property_url (String)

    a URL to a page with more information about the Property of Interest

  • :property_zip (String)

    the zip code which the Property of Interest is in

    optional Search Reference parameters:

    The Search Reference parameters reflect search criteria that the contact
      has used while searching for a listing
    
  • :search_city (String)

    the city or locality which this contact has searched for a listing

  • :search_state (String)

    the state in which this contact has searched for a listing

  • :search_zip (String)

    the zip code or postal code in which this contact has searched for a listing

  • :search_max_lot_size (Integer)

    the maximum lot size that this contact has used as criteria when searching for a listing

  • :search_max_price (Integer)

    the maximum price that this contact has used as criteria when searching for a listing

  • :search_max_sq_ft (Integer)

    the maximum square feet that this contact has used as criteria when searching for a listing

  • :search_max_year_built (Integer)

    the maximum year built this contact has used as criteria when searching for a listing

  • :search_min_baths (Float)

    the minimum number of baths this contact has used as criteria when searching for a listing

  • :search_min_beds (Integer)

    the minimum number of bedrooms this contact has used as criteria when searching for a listing

  • :search_min_lot_size (Integer)

    the minimum lot size this contact has used as criteria when searching for a listing

  • :search_min_price (Integer)

    the minimum price this contact has used as criteria when searching for a listing

  • :search_min_sq_ft (Integer)

    the minimum number of square feet this contact has used as criteria when searching for a listing

  • :search_min_year_built (Integer)

    the minimum year built this contact has used as criteria when searching for a listing

  • :search_property_types (String)

    property types this contact has searched for; ex: 'Single Family, Condo, Townhouse'

Returns:


425
426
427
# File 'lib/moxiworks_platform/contact.rb', line 425

def self.create(opts={})
  self.send_request(:post, opts)
end

.delete(opts = {}) ⇒ Boolean

Delete a Contact your system has previously created in Moxi Works Platform

Examples:

success = MoxiWorksPlatform::Contact.delete(moxi_works_agent_id: '123abcd', partner_contact_id: 'myUniqueContactId' )

Parameters:

  • opts (Hash) (defaults to: {})

    named parameter Hash

    required parameters

Options Hash (opts):

  • :moxi_works_agent_id (String)

    REQUIRED The Moxi Works Agent ID for the agent to which this contact is to be associated

  • :partner_contact_id (String)

    REQUIRED Your system's unique ID for this contact.

Returns:

  • (Boolean)

    – success of the delete action


536
537
538
# File 'lib/moxiworks_platform/contact.rb', line 536

def self.delete(opts={})
  self.send_request(:delete, opts)
end

.find(opts = {}) ⇒ Object

Find a Contact your system has previously created in Moxi Works Platform

Parameters:

  • opts (Hash) (defaults to: {})

    named parameter Hash

Options Hash (opts):

  • :moxi_works_agent_id (String)

    REQUIRED The Moxi Works Agent ID for the agent to which this contact is to be associated

  • :partner_contact_id (String)

    REQUIRED Your system's unique ID for this contact.

    returns [MoxiworksPlatform::Contact]


435
436
437
# File 'lib/moxiworks_platform/contact.rb', line 435

def self.find(opts={})
  self.send_request(:get, opts)
end

.send_request(method, opts = {}, url = nil) ⇒ MoxiworksPlatform::Contact

Send our remote request to the Moxi Works Platform

Parameters:

  • method (String)

    The HTTP method to be used when connecting; ex: :put, :post, :get

  • opts (Hash) (defaults to: {})
  • url (String) (defaults to: nil)

    The full URLto connect to

Options Hash (opts):

  • :moxi_works_agent_id (String)

    REQUIRED The Moxi Works Agent ID for the agent to which this contact is to be associated

  • :partner_contact_id (String)

    REQUIRED Your system's unique ID for this contact.

    optional Contact parameters

  • :moxi_works_contact_id (String)

    Moxi Works Platform contact ID

  • :business_website (String)

    full url of a website associated with this contact

  • :contact_name (String)

    full name of this contact in format “Firstname Middlename Lastname”

  • :gender (String, Enumerated)

    can be “male” or “female” or “m” or “f”

  • :home_street_address (String)

    the street address and street on which the contact lives

  • :home_city (String)

    city or township in which this contact lives

  • :home_state (String)

    state in which this contact lives; can be abbreviation or full name

  • :home_zip (String)

    zip code in which this contact lives

  • :home_neighborhood (String)

    neighborhood in which this contact lives

  • :home_country (String)

    country in which this contact lives; can be abbreviation or full name

  • :job_title (String)

    the specific job title this contact has; ex: 'Senior VP of Operations'

  • :occupation (String)

    the general occupation of this contact; ex: 'Software Developer'

  • :partner_agent_id (String)

    your system's unique ID for the agent this contact is to be associated with

  • :primary_email_address (String)

    the primary email address for this contact

  • :primary_phone_number (String)

    the primary phone number for this contact

  • :secondary_email_address (String)

    the secondary email address for this contact

  • :secondary_phone_number (String)

    the secondary phone number for this contact

    optional Property of Interest (POI) parameters:

    The POI is a property that the contact has shown interest in.
    
  • :property_baths (Float)

    the number of baths in the Property of Interest

  • :property_beds (Integer)

    the number of bedrooms in the Property of Interest

  • :property_city (String)

    the city in which the Property of Interest is located

  • :property_list_price (Integer)

    the list price of the Property of Interest

  • :property_listing_status (String)

    the status of the Property of Interest; ex: 'Active' or 'Sold'

  • :property_mls_id (String)

    the MLS ID of the listing

  • :property_photo_url (String)

    a full URL of an image of the Property of Interest

  • :property_state (String)

    the state which the Property of Interest is in

  • :property_street_address (String)

    the street address that the Property of Interest is on

  • :property_url (String)

    a URL to a page with more information about the Property of Interest

  • :property_zip (String)

    the zip code which the Property of Interest is in

    optional Search Reference parameters:

    The Search Reference parameters reflect search criteria that the contact
      has used while searching for a listing
    
  • :search_city (String)

    the city or locality which this contact has searched for a listing

  • :search_state (String)

    the state in which this contact has searched for a listing

  • :search_zip (String)

    the zip code or postal code in which this contact has searched for a listing

  • :search_max_lot_size (Integer)

    the maximum lot size that this contact has used as criteria when searching for a listing

  • :search_max_price (Integer)

    the maximum price that this contact has used as criteria when searching for a listing

  • :search_max_sq_ft (Integer)

    the maximum square feet that this contact has used as criteria when searching for a listing

  • :search_max_year_built (Integer)

    the maximum year built this contact has used as criteria when searching for a listing

  • :search_min_baths (Float)

    the minimum number of baths this contact has used as criteria when searching for a listing

  • :search_min_beds (Integer)

    the minimum number of bedrooms this contact has used as criteria when searching for a listing

  • :search_min_lot_size (Integer)

    the minimum lot size this contact has used as criteria when searching for a listing

  • :search_min_price (Integer)

    the minimum price this contact has used as criteria when searching for a listing

  • :search_min_sq_ft (Integer)

    the minimum number of square feet this contact has used as criteria when searching for a listing

  • :search_min_year_built (Integer)

    the minimum year built this contact has used as criteria when searching for a listing

  • :search_property_types (String)

    property types this contact has searched for; ex: 'Single Family, Condo, Townhouse'

Returns:


603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/moxiworks_platform/contact.rb', line 603

def self.send_request(method, opts={}, url=nil)
  url ||= "#{MoxiworksPlatform::Config.url}/api/contacts"
  opts[:contact_id] = opts[:partner_contact_id] || opts[:moxi_works_contact_id]
  required_opts = [:moxi_works_agent_id, :contact_id]
  required_opts.each do |opt|
    message = opt == :contact_id ? 'partner_contact_id or moxi_works_contact_id required' : "#{opt} required"
    raise ::MoxiworksPlatform::Exception::ArgumentError, message if
        opts[opt].nil? or opts[opt].empty?
  end
  contact = nil
  RestClient::Request.execute(method: method,
                              url: url,
                              payload: opts, headers: self.headers) do |response|
    puts response if MoxiworksPlatform::Config.debug
    json = JSON.parse(response)
    contact = MoxiworksPlatform::Contact.new(json) unless json.nil? or json.empty?
  end
  contact
end

.update(opts = {}) ⇒ MoxiworksPlatform::Contact

Updates a previously created Contact in Moxi Works Platform

Examples:

MoxiworksPlatform::Contact.update(
  moxi_works_agent_id: '123abc',
  partner_contact_id: '1234',
  contact_name: 'george p warshington',
  home_street: '123 this way',
  home_city: 'cittyvile',
  home_state: 'HI',
  home_country: 'USA',
  home_neighborhood: 'my hood',
  job_title: 'junior bacon burner',
  occupation: 'chef',
  business_website: 'http://bear.wrass.ler',
  primary_email_address: '[email protected]',
  primary_phone_number: '123213',
  property_mls_id: '1232312abcv',
  secondary_phone_number: '1234567890')

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :moxi_works_agent_id (String)

    REQUIRED The Moxi Works Agent ID for the agent to which this contact is to be associated

  • :partner_contact_id (String)

    REQUIRED Your system's unique ID for this contact.

    optional Contact parameters

  • :moxi_works_contact_id (String)

    Moxi Works Platform contact ID

  • :business_website (String)

    full url of a website associated with this contact

  • :contact_name (String)

    full name of this contact in format “Firstname Middlename Lastname”

  • :gender (String, Enumerated)

    can be “male” or “female” or “m” or “f”

  • :home_street_address (String)

    the street address and street on which the contact lives

  • :home_city (String)

    city or township in which this contact lives

  • :home_state (String)

    state in which this contact lives; can be abbreviation or full name

  • :home_zip (String)

    zip code in which this contact lives

  • :home_neighborhood (String)

    neighborhood in which this contact lives

  • :home_country (String)

    country in which this contact lives; can be abbreviation or full name

  • :job_title (String)

    the specific job title this contact has; ex: 'Senior VP of Operations'

  • :occupation (String)

    the general occupation of this contact; ex: 'Software Developer'

  • :partner_agent_id (String)

    your system's unique ID for the agent this contact is to be associated with

  • :primary_email_address (String)

    the primary email address for this contact

  • :primary_phone_number (String)

    the primary phone number for this contact

  • :secondary_email_address (String)

    the secondary email address for this contact

  • :secondary_phone_number (String)

    the secondary phone number for this contact

    optional Property of Interest (POI) parameters:

    The POI is a property that the contact has shown interest in.
    
  • :property_baths (Float)

    the number of baths in the Property of Interest

  • :property_beds (Integer)

    the number of bedrooms in the Property of Interest

  • :property_city (String)

    the city in which the Property of Interest is located

  • :property_list_price (Integer)

    the list price of the Property of Interest

  • :property_listing_status (String)

    the status of the Property of Interest; ex: 'Active' or 'Sold'

  • :property_mls_id (String)

    the MLS ID of the listing

  • :property_photo_url (String)

    a full URL of an image of the Property of Interest

  • :property_state (String)

    the state which the Property of Interest is in

  • :property_street_address (String)

    the street address that the Property of Interest is on

  • :property_url (String)

    a URL to a page with more information about the Property of Interest

  • :property_zip (String)

    the zip code which the Property of Interest is in

    optional Search Reference parameters:

    The Search Reference parameters reflect search criteria that the contact
      has used while searching for a listing
    
  • :search_city (String)

    the city or locality which this contact has searched for a listing

  • :search_state (String)

    the state in which this contact has searched for a listing

  • :search_zip (String)

    the zip code or postal code in which this contact has searched for a listing

  • :search_max_lot_size (Integer)

    the maximum lot size that this contact has used as criteria when searching for a listing

  • :search_max_price (Integer)

    the maximum price that this contact has used as criteria when searching for a listing

  • :search_max_sq_ft (Integer)

    the maximum square feet that this contact has used as criteria when searching for a listing

  • :search_max_year_built (Integer)

    the maximum year built this contact has used as criteria when searching for a listing

  • :search_min_baths (Float)

    the minimum number of baths this contact has used as criteria when searching for a listing

  • :search_min_beds (Integer)

    the minimum number of bedrooms this contact has used as criteria when searching for a listing

  • :search_min_lot_size (Integer)

    the minimum lot size this contact has used as criteria when searching for a listing

  • :search_min_price (Integer)

    the minimum price this contact has used as criteria when searching for a listing

  • :search_min_sq_ft (Integer)

    the minimum number of square feet this contact has used as criteria when searching for a listing

  • :search_min_year_built (Integer)

    the minimum year built this contact has used as criteria when searching for a listing

  • :search_property_types (String)

    property types this contact has searched for; ex: 'Single Family, Condo, Townhouse'

Returns:


517
518
519
520
521
# File 'lib/moxiworks_platform/contact.rb', line 517

def self.update(opts={})
  opts[:contact_id] = opts[:partner_contact_id] || opts[:moxi_works_contact_id]
  url = "#{MoxiworksPlatform::Config.url}/api/contacts/#{opts[:contact_id]}"
  self.send_request(:put, opts, url)
end

Instance Method Details

#delete(opts = {}) ⇒ Boolean

Delete an instance of MoxiWorksPlatform::Contact from Moxi Works Platform

Examples:

contact = MoxiWorksPlatform::Contact.find(moxi_works_agent_id: '123abcd', partner_contact_id: 'myUniqueContactId' )
success = contact.delete

Returns:

  • (Boolean)

    – success of the delete action


645
646
647
# File 'lib/moxiworks_platform/contact.rb', line 645

def delete(opts={})
  MoxiworksPlatform::Contact.delete(opts)
end

#saveMoxiWorksPlatform::Contact

Save an instance of MoxiWorksPlatform::Contact to Moxi Works Platform

Examples:

contact = MoxiWorksPlatform::Contact.new()
contact.moxi_works_agent_id = '123abcd'
contact.partner_contact_id = 'myUniqueContactIdentifier'
contact.contact_name = 'J Jonah Jameson'
contact.primary_email_address = '[email protected]'
contact.save

Returns:

  • (MoxiWorksPlatform::Contact)

634
635
636
# File 'lib/moxiworks_platform/contact.rb', line 634

def save
  MoxiworksPlatform::Contact.create(self.to_hash)
end