Class: MoxiworksPlatform::Agent
- Defined in:
- lib/moxiworks_platform/agent.rb
Overview
Moxi Works Platform Agent
Instance Attribute Summary collapse
-
#access_level ⇒ String
If include_access_level was passed as true, this can return one of the possible access levels: company-admin, manager, office-admin, office-owner, region-admin, user.
-
#agent_id ⇒ String
The UUID of the Agent.
-
#alt_phone_number ⇒ String
Alternate phone number for agent.
-
#alternate_offices ⇒ Array
Any alternate offices the agent is associated with.
-
#altnernate_offices ⇒ Array
Alternate offices for this agent.
-
#available_mls ⇒ Array
Available MLSs for this agent.
-
#buyer_commission_rate ⇒ Hash
Buyer commission rate for this agent.
-
#client_agent_id ⇒ String
The id of the agent used by the company of the agent.
-
#client_company_id ⇒ String
The UUID of the office which the Agent is associated.
-
#client_office_id ⇒ String
The internal of the office which the Agent is associated used by the company.
-
#company_id ⇒ String
The company id of the agent.
-
#facebook ⇒ String
The agent's facebook page.
-
#fax_phone_number ⇒ String
The agent's fax phone number.
-
#first_name ⇒ String
The agent's first name.
-
#gci_goal ⇒ Integer
GCI Goal for this agent.
-
#google_plus ⇒ String
The agent's google plus acount.
-
#has_engage_access ⇒ String
Whether the agent has access to MoxiWorks Engage.
-
#home_page ⇒ String
The agent's home page url.
-
#last_name ⇒ String
The agent's last name.
-
#lead_routing_email_address ⇒ String
The lead routing email address of the agent.
-
#license ⇒ String
License number for the listing agent.
-
#main_phone_number ⇒ String
The agent's main phone number.
-
#mls_abbreviation ⇒ String
This is the standard abbreviation of the primary MLS utilized by the agent.
-
#mls_agent_id ⇒ String
MLS ID for the listing agent.
-
#mls_name ⇒ String
The name of the listing Agent's mls.
-
#mobile_phone_number ⇒ String
The agent's fax phone number.
-
#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.
-
#moxi_works_office_id ⇒ String
The UUID of the office which the Agent is associated.
-
#name ⇒ String
The agent's full name.
-
#office_address_city ⇒ String
The agent's office address, city.
-
#office_address_state ⇒ String
The agent's office address, state.
-
#office_address_street ⇒ String
The agent's office address, street and number.
-
#office_address_street2 ⇒ String
The agent's office address, suite or office number.
-
#office_address_zip ⇒ String
The agent's office address, zip code.
-
#office_id ⇒ String
The office ID of the agent.
-
#office_phone_number ⇒ String
The agent's office_phone number.
-
#primary_email_address ⇒ String
The agent's primary email address.
-
#profile_image_url ⇒ String
Url to a full size image of the agent.
-
#profile_thumb_url ⇒ String
Url to a thumb size image of the agent.
-
#region ⇒ String
Region for this agent.
-
#secondary_email_address ⇒ String
The agent's secondary email address.
-
#seller_commission_rate ⇒ Hash
Seller commission rate for this agent.
-
#string :client_agent_id(: client_agent_id) ⇒ String
The id of the agent used by the company of the agent.
-
#string agent_id(agent_id) ⇒ String
The UUID of the Agent.
-
#string alt_phone_number(alt_phone_number) ⇒ String
Alternate phone number for agent.
-
#string alternate_offices(alternate_offices) ⇒ Array
Any alternate offices the agent is associated with.
-
#string buyer_commission_rate(buyer_commission_rate) ⇒ String
The buyer commission rate of the Agent.
-
#string company_id(company_id) ⇒ String
The company id of the agent.
-
#string gci_goal(gci_goal) ⇒ String
The GCI goal of the Agent.
-
#string lead_routing_email_address(lead_routing_email_address) ⇒ String
The lead routing email address of the agent.
-
#string office_id(office_id) ⇒ String
The office ID of the agent.
-
#string seller_commission_rate(seller_commission_rate) ⇒ String
The seller commission rate of the Agent.
-
#string the id of the company used by the company of the agent(theidofthecompanyusedbythecompanyoftheagent) ⇒ String
The UUID of the office which the Agent is associated.
-
#string the id office used by the company of the agent(theidofficeusedbythecompanyoftheagent) ⇒ String
The internal of the office which the Agent is associated used by the company.
-
#string title(title) ⇒ String
The title of the Agent.
-
#string twitter(twitter) ⇒ String
The twitter handle of the agent.
-
#string uuid(uuid) ⇒ String
The UUID of the Agent.
-
#title ⇒ String
Any business related titles associated with the agent.
-
#twitter ⇒ String
The agent's twitter handle.
-
#uuid ⇒ String
identifier in determining associations between Agent objects and Listing objects.
-
#website_base_url ⇒ String
The agent's website base url.
Attributes inherited from Resource
Class Method Summary collapse
-
.find(opts = {}) ⇒ MoxiworksPlatform::Agent
Find an Agent on the Moxi Works Platform.
-
.search(opts = {}) ⇒ Hash
Search For Agents in Moxi Works Platform.
- .send_request(method, opts = {}, url = nil) ⇒ Object
Methods inherited from Resource
accept_header, attr_accessor, attributes, #attributes, auth_header, check_for_error_in_response, content_type_header, #float_attrs, headers, #init_attrs_from_hash, #initialize, #int_attrs, #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
#access_level ⇒ String
If include_access_level was passed as true, this can return one of the possible access levels: company-admin, manager, office-admin, office-owner, region-admin, user.
254 255 256 |
# File 'lib/moxiworks_platform/agent.rb', line 254 def access_level @access_level end |
#agent_id ⇒ String
Returns the UUID of the Agent.
28 29 30 |
# File 'lib/moxiworks_platform/agent.rb', line 28 def agent_id @agent_id end |
#alt_phone_number ⇒ String
Returns alternate phone number for agent.
46 47 48 |
# File 'lib/moxiworks_platform/agent.rb', line 46 def alt_phone_number @alt_phone_number end |
#alternate_offices ⇒ Array
Returns any alternate offices the agent is associated with.
94 95 96 |
# File 'lib/moxiworks_platform/agent.rb', line 94 def alternate_offices @alternate_offices end |
#altnernate_offices ⇒ Array
Returns alternate offices for this agent.
265 266 267 |
# File 'lib/moxiworks_platform/agent.rb', line 265 def altnernate_offices @altnernate_offices end |
#available_mls ⇒ Array
Returns available MLSs for this agent.
259 260 261 |
# File 'lib/moxiworks_platform/agent.rb', line 259 def available_mls @available_mls end |
#buyer_commission_rate ⇒ Hash
Returns buyer commission rate for this agent.
82 83 84 |
# File 'lib/moxiworks_platform/agent.rb', line 82 def buyer_commission_rate @buyer_commission_rate end |
#client_agent_id ⇒ String
Returns the id of the agent used by the company of the agent.
22 23 24 |
# File 'lib/moxiworks_platform/agent.rb', line 22 def client_agent_id @client_agent_id end |
#client_company_id ⇒ String
Returns the UUID of the office which the Agent is associated.
105 106 107 |
# File 'lib/moxiworks_platform/agent.rb', line 105 def client_company_id @client_company_id end |
#client_office_id ⇒ String
Returns the internal of the office which the Agent is associated used by the company.
100 101 102 |
# File 'lib/moxiworks_platform/agent.rb', line 100 def client_office_id @client_office_id end |
#company_id ⇒ String
Returns the company id of the agent.
40 41 42 |
# File 'lib/moxiworks_platform/agent.rb', line 40 def company_id @company_id end |
#facebook ⇒ String
Returns the agent's facebook page.
211 212 213 |
# File 'lib/moxiworks_platform/agent.rb', line 211 def facebook @facebook end |
#fax_phone_number ⇒ String
Returns the agent's fax phone number.
176 177 178 |
# File 'lib/moxiworks_platform/agent.rb', line 176 def fax_phone_number @fax_phone_number end |
#first_name ⇒ String
Returns the agent's first name.
156 157 158 |
# File 'lib/moxiworks_platform/agent.rb', line 156 def first_name @first_name end |
#gci_goal ⇒ Integer
Returns GCI Goal for this agent.
76 77 78 |
# File 'lib/moxiworks_platform/agent.rb', line 76 def gci_goal @gci_goal end |
#google_plus ⇒ String
Returns the agent's google plus acount.
206 207 208 |
# File 'lib/moxiworks_platform/agent.rb', line 206 def google_plus @google_plus end |
#has_engage_access ⇒ String
Returns whether the agent has access to MoxiWorks Engage.
248 249 250 |
# File 'lib/moxiworks_platform/agent.rb', line 248 def has_engage_access @has_engage_access end |
#home_page ⇒ String
Returns the agent's home page url.
216 217 218 |
# File 'lib/moxiworks_platform/agent.rb', line 216 def home_page @home_page end |
#last_name ⇒ String
Returns the agent's last name.
161 162 163 |
# File 'lib/moxiworks_platform/agent.rb', line 161 def last_name @last_name end |
#lead_routing_email_address ⇒ String
Returns the lead routing email address of the agent.
52 53 54 |
# File 'lib/moxiworks_platform/agent.rb', line 52 def lead_routing_email_address @lead_routing_email_address end |
#license ⇒ String
Returns license number for the listing agent.
115 116 117 |
# File 'lib/moxiworks_platform/agent.rb', line 115 def license @license end |
#main_phone_number ⇒ String
Returns the agent's main phone number.
181 182 183 |
# File 'lib/moxiworks_platform/agent.rb', line 181 def main_phone_number @main_phone_number end |
#mls_abbreviation ⇒ String
Returns This is the standard abbreviation of the primary MLS utilized by the agent.
125 126 127 |
# File 'lib/moxiworks_platform/agent.rb', line 125 def mls_abbreviation @mls_abbreviation end |
#mls_agent_id ⇒ String
Returns MLS ID for the listing agent.
110 111 112 |
# File 'lib/moxiworks_platform/agent.rb', line 110 def mls_agent_id @mls_agent_id end |
#mls_name ⇒ String
Returns the name of the listing Agent's mls.
120 121 122 |
# File 'lib/moxiworks_platform/agent.rb', line 120 def mls_name @mls_name end |
#mobile_phone_number ⇒ String
Returns the agent's fax phone number.
171 172 173 |
# File 'lib/moxiworks_platform/agent.rb', line 171 def mobile_phone_number @mobile_phone_number 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 must be set for any Moxi Works Platform transaction
12 13 14 |
# File 'lib/moxiworks_platform/agent.rb', line 12 def moxi_works_agent_id @moxi_works_agent_id end |
#moxi_works_office_id ⇒ String
Returns the UUID of the office which the Agent is associated.
17 18 19 |
# File 'lib/moxiworks_platform/agent.rb', line 17 def moxi_works_office_id @moxi_works_office_id end |
#name ⇒ String
Returns the agent's full name.
166 167 168 |
# File 'lib/moxiworks_platform/agent.rb', line 166 def name @name end |
#office_address_city ⇒ String
Returns the agent's office address, city.
141 142 143 |
# File 'lib/moxiworks_platform/agent.rb', line 141 def office_address_city @office_address_city end |
#office_address_state ⇒ String
Returns the agent's office address, state.
146 147 148 |
# File 'lib/moxiworks_platform/agent.rb', line 146 def office_address_state @office_address_state end |
#office_address_street ⇒ String
Returns the agent's office address, street and number.
131 132 133 |
# File 'lib/moxiworks_platform/agent.rb', line 131 def office_address_street @office_address_street end |
#office_address_street2 ⇒ String
Returns the agent's office address, suite or office number.
136 137 138 |
# File 'lib/moxiworks_platform/agent.rb', line 136 def office_address_street2 @office_address_street2 end |
#office_address_zip ⇒ String
Returns the agent's office address, zip code.
151 152 153 |
# File 'lib/moxiworks_platform/agent.rb', line 151 def office_address_zip @office_address_zip end |
#office_id ⇒ String
Returns the office ID of the agent.
34 35 36 |
# File 'lib/moxiworks_platform/agent.rb', line 34 def office_id @office_id end |
#office_phone_number ⇒ String
Returns the agent's office_phone number.
186 187 188 |
# File 'lib/moxiworks_platform/agent.rb', line 186 def office_phone_number @office_phone_number end |
#primary_email_address ⇒ String
Returns the agent's primary email address.
191 192 193 |
# File 'lib/moxiworks_platform/agent.rb', line 191 def primary_email_address @primary_email_address end |
#profile_image_url ⇒ String
Returns url to a full size image of the agent.
221 222 223 |
# File 'lib/moxiworks_platform/agent.rb', line 221 def profile_image_url @profile_image_url end |
#profile_thumb_url ⇒ String
Returns url to a thumb size image of the agent.
226 227 228 |
# File 'lib/moxiworks_platform/agent.rb', line 226 def profile_thumb_url @profile_thumb_url end |
#region ⇒ String
Returns region for this agent.
277 278 279 |
# File 'lib/moxiworks_platform/agent.rb', line 277 def region @region end |
#secondary_email_address ⇒ String
Returns the agent's secondary email address.
196 197 198 |
# File 'lib/moxiworks_platform/agent.rb', line 196 def secondary_email_address @secondary_email_address end |
#seller_commission_rate ⇒ Hash
Returns seller commission rate for this agent.
88 89 90 |
# File 'lib/moxiworks_platform/agent.rb', line 88 def seller_commission_rate @seller_commission_rate end |
#string :client_agent_id(: client_agent_id) ⇒ String
Returns the id of the agent used by the company of the agent.
22 |
# File 'lib/moxiworks_platform/agent.rb', line 22 attr_accessor :client_agent_id |
#string agent_id(agent_id) ⇒ String
Returns the UUID of the Agent.
28 |
# File 'lib/moxiworks_platform/agent.rb', line 28 attr_accessor :agent_id |
#string alt_phone_number(alt_phone_number) ⇒ String
Returns alternate phone number for agent.
46 |
# File 'lib/moxiworks_platform/agent.rb', line 46 attr_accessor :alt_phone_number |
#string alternate_offices(alternate_offices) ⇒ Array
Returns any alternate offices the agent is associated with.
94 |
# File 'lib/moxiworks_platform/agent.rb', line 94 attr_accessor :alternate_offices |
#string buyer_commission_rate(buyer_commission_rate) ⇒ String
Returns the buyer commission rate of the Agent.
82 |
# File 'lib/moxiworks_platform/agent.rb', line 82 attr_accessor :buyer_commission_rate |
#string company_id(company_id) ⇒ String
Returns the company id of the agent.
40 |
# File 'lib/moxiworks_platform/agent.rb', line 40 attr_accessor :company_id |
#string gci_goal(gci_goal) ⇒ String
Returns the GCI goal of the Agent.
76 |
# File 'lib/moxiworks_platform/agent.rb', line 76 attr_accessor :gci_goal |
#string lead_routing_email_address(lead_routing_email_address) ⇒ String
Returns the lead routing email address of the agent.
52 |
# File 'lib/moxiworks_platform/agent.rb', line 52 attr_accessor :lead_routing_email_address |
#string office_id(office_id) ⇒ String
Returns the office ID of the agent.
34 |
# File 'lib/moxiworks_platform/agent.rb', line 34 attr_accessor :office_id |
#string seller_commission_rate(seller_commission_rate) ⇒ String
Returns the seller commission rate of the Agent.
88 |
# File 'lib/moxiworks_platform/agent.rb', line 88 attr_accessor :seller_commission_rate |
#string the id of the company used by the company of the agent(theidofthecompanyusedbythecompanyoftheagent) ⇒ String
Returns the UUID of the office which the Agent is associated.
105 |
# File 'lib/moxiworks_platform/agent.rb', line 105 attr_accessor :client_company_id |
#string the id office used by the company of the agent(theidofficeusedbythecompanyoftheagent) ⇒ String
Returns the internal of the office which the Agent is associated used by the company.
100 |
# File 'lib/moxiworks_platform/agent.rb', line 100 attr_accessor :client_office_id |
#string title(title) ⇒ String
Returns the title of the Agent.
58 |
# File 'lib/moxiworks_platform/agent.rb', line 58 attr_accessor :title |
#string twitter(twitter) ⇒ String
Returns the twitter handle of the agent.
70 |
# File 'lib/moxiworks_platform/agent.rb', line 70 attr_accessor :twitter |
#string uuid(uuid) ⇒ String
Returns the UUID of the Agent.
64 |
# File 'lib/moxiworks_platform/agent.rb', line 64 attr_accessor :uuid |
#title ⇒ String
Returns any business related titles associated with the agent.
58 59 60 |
# File 'lib/moxiworks_platform/agent.rb', line 58 def title @title end |
#twitter ⇒ String
Returns the agent's twitter handle.
70 71 72 |
# File 'lib/moxiworks_platform/agent.rb', line 70 def twitter @twitter end |
#uuid ⇒ String
identifier in determining associations between Agent objects and Listing objects.
64 65 66 |
# File 'lib/moxiworks_platform/agent.rb', line 64 def uuid @uuid end |
#website_base_url ⇒ String
Returns the agent's website base url.
243 244 245 |
# File 'lib/moxiworks_platform/agent.rb', line 243 def website_base_url @website_base_url end |
Class Method Details
.find(opts = {}) ⇒ MoxiworksPlatform::Agent
Find an Agent on the Moxi Works Platform
303 304 305 306 307 308 309 310 |
# File 'lib/moxiworks_platform/agent.rb', line 303 def self.find(opts={}) agent_identifier = opts[:agent_uuid] unless(opts[:agent_uuid].nil? or opts[:agent_uuid].empty?) agent_identifier ||= opts[:moxi_works_agent_id] unless(opts[:moxi_works_agent_id].nil? or opts[:moxi_works_agent_id].empty?) raise ::MoxiworksPlatform::Exception::ArgumentError, "#agent_uuid or moxi_works_agent_id required" if agent_identifier.nil? url = "#{MoxiworksPlatform::Config.url}/api/agents/#{agent_identifier}" self.send_request(:get, opts, url) end |
.search(opts = {}) ⇒ Hash
Search For Agents in Moxi Works Platform
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/moxiworks_platform/agent.rb', line 352 def self.search(opts={}) url ||= "#{MoxiworksPlatform::Config.url}/api/agents" required_opts = [:moxi_works_company_id] required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end results = MoxiResponseArray.new() json = { 'page_number': 1, 'total_pages': 0, 'agents':[]} 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']) json['agents'].each do |r| results << MoxiworksPlatform::Agent.new(r) unless r.nil? or r.empty? end json['agents'] = results end json end |
.send_request(method, opts = {}, url = nil) ⇒ Object
312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/moxiworks_platform/agent.rb', line 312 def self.send_request(method, opts={}, url=nil) url ||= "#{MoxiworksPlatform::Config.url}/api/agents" required_opts = [:moxi_works_company_id] raise ::MoxiworksPlatform::Exception::ArgumentError, 'arguments must be passed as named parameters' unless opts.is_a? Hash required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end super(method, opts, url) end |