Class: MoxiworksPlatform::Contact
- Defined in:
- lib/moxiworks_platform/contact.rb
Overview
Moxi Works Platform Contact
Instance Attribute Summary collapse
-
#agent_uuid ⇒ String
The UUID of the agent the that the contact is to be associated with.
-
#anniversary ⇒ Integer
Anniversary of the contact represented as a Unix Timestamp.
-
#birthday ⇒ Integer
Birthday of the contact represented as a Unix Timestamp.
-
#contact_name ⇒ String
the full name of this Contact.
-
#gender ⇒ String, Enumerated
the gender of this Contact.
-
#home_city ⇒ String
the city of the residence of this Contact.
-
#home_country ⇒ String
the country of the residence of this Contact.
-
#home_neighborhood ⇒ String
the neighborhood of the residence of this Contact.
-
#home_purchase_anniversary ⇒ Integer
Anniversary of the contact's home purchase represented as a Unix Timestamp.
-
#home_state ⇒ String
the state in which the residence of this Contact is located.
-
#home_street_address ⇒ String
the street address of the residence of this Contact.
-
#home_zip ⇒ String
the zip code of the residence of this Contact.
-
#is_new_contact ⇒ Boolean
Whether the contact was recently added to the Agent's database.
-
#job_title ⇒ String
the specific job title this contact has; ex: 'Senior VP of Operations'.
-
#moxi_works_agent_id ⇒ String
moxi_works_agent_id is the Moxi Works Platform ID of the agent which a contact is or is to be associated with.
-
#note ⇒ String
more detailed information about the Contact.
-
#occupation ⇒ String
the general occupation of this contact; ex: 'Software Developer'.
-
#partner_agent_id ⇒ String
your system's unique identifier for the agent that this contact will be associated with.
-
#partner_contact_id ⇒ String
*your system's* unique ID for the Contact.
-
#primary_email_address ⇒ String
the email address the contact would want to be contacted via first.
-
#primary_phone_number ⇒ String
the phone number the contact would want to be contacted via first.
-
#property_baths ⇒ Float
the number of bathrooms in the listing the contact has expressed interest in.
-
#property_beds ⇒ Integer
the number of bedrooms in the listing the contact has expressed interest in.
-
#property_city ⇒ String
the city in which the listing the contact has expressed interest in is located.
-
#property_list_price ⇒ Integer
the list_price of the property the contact has expressed interest in.
-
#property_listing_status ⇒ String
Property of Interest (POI) attribute.
-
#property_mls_id ⇒ String
the MLS ID of the listing that of the Property of Interest.
-
#property_photo_url ⇒ String
a full URL to a photo of the Property of Interest.
-
#property_state ⇒ String
the state in which the listing the contact has expressed interest in is located.
-
#property_street_address ⇒ String
the street address of the listing the contact has expressed interest in is located.
-
#property_url ⇒ String
a URL referencing a HTTP(S) location which has information about the listing.
-
#property_zip ⇒ String
the zip code in which the listing the contact has expressed interest in is located.
-
#search_city ⇒ String
the city which the contact has searched for listings in.
-
#search_max_lot_size ⇒ Integer
the maximum lot size used by the contact when searching for listings.
-
#search_max_price ⇒ Integer
the maximum price value used by the contact when searching for listings.
-
#search_max_sq_ft ⇒ Integer
the maximum listing square footage used by the contact when searching for listings.
-
#search_max_year_built ⇒ Integer
the maximum year built used by the contact when searching for listings.
-
#search_min_baths ⇒ Float
Property Search (PS) attribute.
-
#search_min_beds ⇒ Integer
the minimum number of bedrooms used by the contact when searching for listings.
-
#search_min_lot_size ⇒ Integer
the minimum lot size used by the contact when searching for listings.
-
#search_min_price ⇒ Integer
the minimum price used by the contact when searching for listings.
-
#search_min_sq_ft ⇒ Integer
the minimum square footage used by the contact when searching for listings.
-
#search_min_year_built ⇒ Integer
the minimum year built used by the contact when searching for listings.
-
#search_property_types ⇒ String
the property types used by the contact when searching for listings; ex: 'Condo' 'Single-Family' 'Townhouse'.
-
#search_state ⇒ String
the state which the contact has searched for listings in.
-
#search_zip ⇒ String
the zip code which the contact has searched for listings in.
-
#secondary_email_address ⇒ String
an additional email address the contact would want to be contacted by.
-
#secondary_phone_number ⇒ String
an additional phone number the contact would want to be contacted by.
-
#social_media_profiles ⇒ Object
URLs to any social media profiles that the agent has defined.
Attributes inherited from Resource
Class Method Summary collapse
-
.create(opts = {}) ⇒ MoxiworksPlatform::Contact
Creates a new Contact in Moxi Works Platform.
-
.delete(opts = {}) ⇒ Boolean
Delete a Contact your system has previously created in Moxi Works Platform.
-
.find(opts = {}) ⇒ MoxiworksPlatform::Contact
Find a Contact your system has previously created in Moxi Works Platform.
-
.search(opts = {}) ⇒ Array
Search an Agent's Contacts in Moxi Works Platform.
-
.send_request(method, opts = {}, url = nil) ⇒ MoxiworksPlatform::Contact
Send our remote request to the Moxi Works Platform.
-
.update(opts = {}) ⇒ MoxiworksPlatform::Contact
Updates a previously created Contact in Moxi Works Platform.
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete an instance of MoxiWorksPlatform::Contact from Moxi Works Platform that your system has previously created.
-
#save ⇒ MoxiWorksPlatform::Contact
Save an instance of MoxiWorksPlatform::Contact to Moxi Works Platform.
Methods inherited from Resource
accept_header, attr_accessor, #attributes, attributes, auth_header, check_for_error_in_response, content_type_header, headers, #init_attrs_from_hash, #initialize, #method_missing, #numeric_attrs, #numeric_value_for, #to_hash, underscore, underscore_array, underscore_attribute_names, underscore_hash, user_agent_header
Constructor Details
This class inherits a constructor from MoxiworksPlatform::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MoxiworksPlatform::Resource
Instance Attribute Details
#agent_uuid ⇒ String
The UUID of the agent the that the contact is to be associated with.
this or moxi_works_agent_id must be set for any Moxi Works Platform transaction
28 29 30 |
# File 'lib/moxiworks_platform/contact.rb', line 28 def agent_uuid @agent_uuid end |
#anniversary ⇒ Integer
Anniversary of the contact represented as a Unix Timestamp.
35 36 37 |
# File 'lib/moxiworks_platform/contact.rb', line 35 def anniversary @anniversary end |
#birthday ⇒ Integer
Birthday of the contact represented as a Unix Timestamp.
41 42 43 |
# File 'lib/moxiworks_platform/contact.rb', line 41 def birthday @birthday end |
#contact_name ⇒ String
the full name of this Contact
47 48 49 |
# File 'lib/moxiworks_platform/contact.rb', line 47 def contact_name @contact_name end |
#gender ⇒ String, Enumerated
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.'
56 57 58 |
# File 'lib/moxiworks_platform/contact.rb', line 56 def gender @gender end |
#home_city ⇒ String
the city of the residence of this Contact
68 69 70 |
# File 'lib/moxiworks_platform/contact.rb', line 68 def home_city @home_city end |
#home_country ⇒ String
the country of the residence of this Contact
this can either be the country's abbreviation or the full name of the country
102 103 104 |
# File 'lib/moxiworks_platform/contact.rb', line 102 def home_country @home_country end |
#home_neighborhood ⇒ String
the neighborhood of the residence of this Contact
94 95 96 |
# File 'lib/moxiworks_platform/contact.rb', line 94 def home_neighborhood @home_neighborhood end |
#home_purchase_anniversary ⇒ Integer
Anniversary of the contact's home purchase represented as a Unix Timestamp.
74 75 76 |
# File 'lib/moxiworks_platform/contact.rb', line 74 def home_purchase_anniversary @home_purchase_anniversary end |
#home_state ⇒ String
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
82 83 84 |
# File 'lib/moxiworks_platform/contact.rb', line 82 def home_state @home_state end |
#home_street_address ⇒ String
the street address of the residence of this Contact
62 63 64 |
# File 'lib/moxiworks_platform/contact.rb', line 62 def home_street_address @home_street_address end |
#home_zip ⇒ String
the zip code of the residence of this Contact
88 89 90 |
# File 'lib/moxiworks_platform/contact.rb', line 88 def home_zip @home_zip end |
#is_new_contact ⇒ Boolean
Whether the contact was recently added to the Agent's database.
108 109 110 |
# File 'lib/moxiworks_platform/contact.rb', line 108 def is_new_contact @is_new_contact end |
#job_title ⇒ String
the specific job title this contact has; ex: 'Senior VP of Operations'
114 115 116 |
# File 'lib/moxiworks_platform/contact.rb', line 114 def job_title @job_title end |
#moxi_works_agent_id ⇒ String
moxi_works_agent_id is the Moxi Works Platform ID of the agent which a contact is or is to be associated with.
this or agent_uuid must be set for any Moxi Works Platform transaction
12 13 14 |
# File 'lib/moxiworks_platform/contact.rb', line 12 def moxi_works_agent_id @moxi_works_agent_id end |
#note ⇒ String
more detailed information about the Contact
120 121 122 |
# File 'lib/moxiworks_platform/contact.rb', line 120 def note @note end |
#occupation ⇒ String
the general occupation of this contact; ex: 'Software Developer'
126 127 128 |
# File 'lib/moxiworks_platform/contact.rb', line 126 def occupation @occupation end |
#partner_agent_id ⇒ String
your system's unique identifier for the agent that this contact will be associated with
167 168 169 |
# File 'lib/moxiworks_platform/contact.rb', line 167 def partner_agent_id @partner_agent_id end |
#partner_contact_id ⇒ String
*your system's* unique ID for the Contact
this must be set for any Moxi Works Platform transaction
20 21 22 |
# File 'lib/moxiworks_platform/contact.rb', line 20 def partner_contact_id @partner_contact_id end |
#primary_email_address ⇒ String
the email address the contact would want to be contacted via first
173 174 175 |
# File 'lib/moxiworks_platform/contact.rb', line 173 def primary_email_address @primary_email_address end |
#primary_phone_number ⇒ String
the phone number the contact would want to be contacted via first
179 180 181 |
# File 'lib/moxiworks_platform/contact.rb', line 179 def primary_phone_number @primary_phone_number end |
#property_baths ⇒ Float
the number of bathrooms in the listing the contact has expressed interest in
Property of Interest (POI) attribute
200 |
# File 'lib/moxiworks_platform/contact.rb', line 200 attr_writer :property_baths |
#property_beds ⇒ Integer
the number of bedrooms in the listing the contact has expressed interest in
Property of Interest (POI) attribute
209 |
# File 'lib/moxiworks_platform/contact.rb', line 209 attr_writer :property_beds |
#property_city ⇒ String
the city in which the listing the contact has expressed interest in is located
Property of Interest (POI) attribute
218 219 220 |
# File 'lib/moxiworks_platform/contact.rb', line 218 def property_city @property_city end |
#property_list_price ⇒ Integer
the list_price of the property the contact has expressed interest in
Property of Interest (POI) attribute
227 |
# File 'lib/moxiworks_platform/contact.rb', line 227 attr_writer :property_list_price |
#property_listing_status ⇒ String
Property of Interest (POI) attribute
the status of the listing of the Property of Interest; ex: 'Active' or 'Sold'
236 237 238 |
# File 'lib/moxiworks_platform/contact.rb', line 236 def property_listing_status @property_listing_status end |
#property_mls_id ⇒ String
the MLS ID of the listing that of the Property of Interest
Property of Interest (POI) attribute
245 246 247 |
# File 'lib/moxiworks_platform/contact.rb', line 245 def property_mls_id @property_mls_id end |
#property_photo_url ⇒ String
a full URL to a photo of the Property of Interest
Property of Interest (POI) attribute
254 255 256 |
# File 'lib/moxiworks_platform/contact.rb', line 254 def property_photo_url @property_photo_url end |
#property_state ⇒ String
the state in which the listing the contact has expressed interest in is located
Property of Interest (POI) attribute
263 264 265 |
# File 'lib/moxiworks_platform/contact.rb', line 263 def property_state @property_state end |
#property_street_address ⇒ String
the street address of the listing the contact has expressed interest in is located
Property of Interest (POI) attribute
272 273 274 |
# File 'lib/moxiworks_platform/contact.rb', line 272 def property_street_address @property_street_address end |
#property_url ⇒ String
a URL referencing a HTTP(S) location which has information about the listing
Property of Interest (POI) attribute
281 282 283 |
# File 'lib/moxiworks_platform/contact.rb', line 281 def property_url @property_url end |
#property_zip ⇒ String
the zip code in which the listing the contact has expressed interest in is located
Property of Interest (POI) attribute
290 291 292 |
# File 'lib/moxiworks_platform/contact.rb', line 290 def property_zip @property_zip end |
#search_city ⇒ String
the city which the contact has searched for listings in
Property Search (PS) attribute
299 300 301 |
# File 'lib/moxiworks_platform/contact.rb', line 299 def search_city @search_city end |
#search_max_lot_size ⇒ Integer
the maximum lot size used by the contact when searching for listings
Property Search (PS) attribute
326 |
# File 'lib/moxiworks_platform/contact.rb', line 326 attr_writer :search_max_lot_size |
#search_max_price ⇒ Integer
the maximum price value used by the contact when searching for listings
Property Search (PS) attribute
335 |
# File 'lib/moxiworks_platform/contact.rb', line 335 attr_writer :search_max_price |
#search_max_sq_ft ⇒ Integer
the maximum listing square footage used by the contact when searching for listings
Property Search (PS) attribute
344 |
# File 'lib/moxiworks_platform/contact.rb', line 344 attr_writer :search_max_sq_ft |
#search_max_year_built ⇒ Integer
the maximum year built used by the contact when searching for listings
Property Search (PS) attribute
353 |
# File 'lib/moxiworks_platform/contact.rb', line 353 attr_writer :search_max_year_built |
#search_min_baths ⇒ Float
Property Search (PS) attribute
the minimum number of bathrooms used by the contact when searching for listings
362 |
# File 'lib/moxiworks_platform/contact.rb', line 362 attr_writer :search_min_baths |
#search_min_beds ⇒ Integer
the minimum number of bedrooms used by the contact when searching for listings
Property Search (PS) attribute
371 |
# File 'lib/moxiworks_platform/contact.rb', line 371 attr_writer :search_min_beds |
#search_min_lot_size ⇒ Integer
the minimum lot size used by the contact when searching for listings
Property Search (PS) attribute
380 |
# File 'lib/moxiworks_platform/contact.rb', line 380 attr_writer :search_min_lot_size |
#search_min_price ⇒ Integer
the minimum price used by the contact when searching for listings
Property Search (PS) attribute
389 |
# File 'lib/moxiworks_platform/contact.rb', line 389 attr_writer :search_min_price |
#search_min_sq_ft ⇒ Integer
the minimum square footage used by the contact when searching for listings
Property Search (PS) attribute
398 |
# File 'lib/moxiworks_platform/contact.rb', line 398 attr_writer :search_min_sq_ft |
#search_min_year_built ⇒ Integer
the minimum year built used by the contact when searching for listings
Property Search (PS) attribute
407 |
# File 'lib/moxiworks_platform/contact.rb', line 407 attr_writer :search_min_year_built |
#search_property_types ⇒ String
the property types used by the contact when searching for listings; ex: 'Condo' 'Single-Family' 'Townhouse'
Property Search (PS) attribute
416 417 418 |
# File 'lib/moxiworks_platform/contact.rb', line 416 def search_property_types @search_property_types end |
#search_state ⇒ String
the state which the contact has searched for listings in
Property Search (PS) attribute
308 309 310 |
# File 'lib/moxiworks_platform/contact.rb', line 308 def search_state @search_state end |
#search_zip ⇒ String
the zip code which the contact has searched for listings in
Property Search (PS) attribute
317 318 319 |
# File 'lib/moxiworks_platform/contact.rb', line 317 def search_zip @search_zip end |
#secondary_email_address ⇒ String
an additional email address the contact would want to be contacted by
185 186 187 |
# File 'lib/moxiworks_platform/contact.rb', line 185 def secondary_email_address @secondary_email_address end |
#secondary_phone_number ⇒ String
an additional phone number the contact would want to be contacted by
191 192 193 |
# File 'lib/moxiworks_platform/contact.rb', line 191 def secondary_phone_number @secondary_phone_number end |
#social_media_profiles ⇒ Object
URLs to any social media profiles that the agent has defined.
161 162 163 |
# File 'lib/moxiworks_platform/contact.rb', line 161 def @social_media_profiles end |
Class Method Details
.create(opts = {}) ⇒ MoxiworksPlatform::Contact
Creates a new Contact in Moxi Works Platform
497 498 499 |
# File 'lib/moxiworks_platform/contact.rb', line 497 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
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
# File 'lib/moxiworks_platform/contact.rb', line 669 def self.delete(opts={}) url = "#{MoxiworksPlatform::Config.url}/api/contacts/#{opts[:partner_contact_id]}" required_opts = [:moxi_works_agent_id, :partner_contact_id] required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end RestClient::Request.execute(method: :delete, url: url, payload: opts, headers: self.headers) do |response| puts response if MoxiworksPlatform::Config.debug json = JSON.parse(response) json['status'] == 'success' end end |
.find(opts = {}) ⇒ MoxiworksPlatform::Contact
Find a Contact your system has previously created in Moxi Works Platform
511 512 513 514 |
# File 'lib/moxiworks_platform/contact.rb', line 511 def self.find(opts={}) url = "#{MoxiworksPlatform::Config.url}/api/contacts/#{opts[:partner_contact_id]}" self.send_request(:get, opts, url) end |
.search(opts = {}) ⇒ Array
Search an Agent's Contacts in Moxi Works Platform
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/moxiworks_platform/contact.rb', line 539 def self.search(opts={}) url ||= "#{MoxiworksPlatform::Config.url}/api/contacts" agent_identifier = opts[:moxi_works_agent_id] || opts[:agent_uuid] raise ::MoxiworksPlatform::Exception::ArgumentError, "#agent_uuid or moxi_works_agent_id required" if agent_identifier.blank? results = MoxiResponseArray.new() RestClient::Request.execute(method: :get, url: url, payload: opts, headers: self.headers) do |response| puts response if MoxiworksPlatform::Config.debug results.headers = response.headers self.check_for_error_in_response(response) json = JSON.parse(response) results.page_number = json['page_number'] if(json.is_a?(Hash) && json['page_number']) results.total_pages = json['total_pages'] if(json.is_a?(Hash) && json['total_pages']) if json and json['contacts'] json['contacts'].each do |r| results << MoxiworksPlatform::Contact.new(r) unless r.nil? or r.empty? end end end results end |
.send_request(method, opts = {}, url = nil) ⇒ MoxiworksPlatform::Contact
Send our remote request to the Moxi Works Platform
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 |
# File 'lib/moxiworks_platform/contact.rb', line 748 def self.send_request(method, opts={}, url=nil) raise ::MoxiworksPlatform::Exception::ArgumentError, 'arguments must be passed as named parameters' unless opts.is_a? Hash url ||= "#{MoxiworksPlatform::Config.url}/api/contacts" required_opts = [:partner_contact_id] required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end raise ::MoxiworksPlatform::Exception::ArgumentError, "#{:moxi_works_agent_id} required" if (opts[:moxi_works_agent_id].nil? or opts[:moxi_works_agent_id].to_s.empty?) and (opts[:agent_uuid].nil? or opts[:agent_uuid].to_s.empty?) opts[:contact_id] = opts[:partner_contact_id] super(method, opts, url) end |
.update(opts = {}) ⇒ MoxiworksPlatform::Contact
Updates a previously created Contact in Moxi Works Platform
647 648 649 650 651 |
# File 'lib/moxiworks_platform/contact.rb', line 647 def self.update(opts={}) opts[:contact_id] = opts[:partner_contact_id] url = "#{MoxiworksPlatform::Config.url}/api/contacts/#{opts[:partner_contact_id]}" self.send_request(:put, opts, url) end |
Instance Method Details
#delete ⇒ Boolean
Delete an instance of MoxiWorksPlatform::Contact from Moxi Works Platform that your system has previously created
790 791 792 |
# File 'lib/moxiworks_platform/contact.rb', line 790 def delete MoxiworksPlatform::Contact.delete(self.to_hash) end |
#save ⇒ MoxiWorksPlatform::Contact
Save an instance of MoxiWorksPlatform::Contact to Moxi Works Platform
778 779 780 |
# File 'lib/moxiworks_platform/contact.rb', line 778 def save MoxiworksPlatform::Contact.update(self.to_hash) end |