Class: MoxiworksPlatform::BuyerTransaction
- Defined in:
- lib/moxiworks_platform/buyer_transaction.rb
Instance Attribute Summary collapse
-
#address ⇒ String
Street address of property being sold.
-
#area_of_interest ⇒ String
String representing a locality that the client is interested in purchasing a property in.
-
#city ⇒ String
City or township of property being sold.
-
#closing_price ⇒ Integer
This is the closing price for the sale .
-
#closing_timestamp ⇒ Integer
A Unix timestamp representing the point in time when the transaction for this BuyerTransaction object was completed.
-
#commission_flat_fee ⇒ Integer
If the agent is to receive a flat-rate commission upon sale of the property associated with this BuyerTransaction, then this will represent the commission that the agent is to receive.
-
#commission_percentage ⇒ Float
If the agent is to receive commission based on percentage of sale price for the property associated with this BuyerTransaction, then this will represent the commission that the agent is to receive.This should be null if the BuyerTransaction uses commission_flat_fee.
-
#is_mls_transaction ⇒ Boolean
Whether the property is being listed on an MLS.
-
#max_baths ⇒ Float
Maximum desired bathrooms in potential properties.
-
#max_beds ⇒ Integer
Maximum desired bedrooms in potential properties.
-
#max_price ⇒ Integer
The maximum desired price range for potential properties if using a price range rather than target price.
-
#max_sqft ⇒ Integer
Maximum desired living area of potential properties.
-
#min_baths ⇒ Float
Minimum desired bathrooms in potential properties.
-
#min_beds ⇒ Integer
Minimum desired bedrooms in potential properties.
-
#min_price ⇒ Integer
The minimum desired price range for potential properties if using a price range rather than target price.
-
#min_sqft ⇒ Integer
Minimum desired living area of potential properties.
-
#mls_number ⇒ String
**MLS TRANSACTIONS ONLY** mls number for the listing associated with this BuyerTransaction.
-
#moxi_works_agent_id ⇒ String
moxi_works_agent_id is the Moxi Works Platform ID of the agent which a BuyerTransaction is or is to be associated with.
-
#moxi_works_contact_id ⇒ Object
The Moxi Works Platform unique identifier for the Contact.
-
#moxi_works_transaction_id ⇒ String
The Moxi Works Platform unique identifier for the BuyerTransaction.
-
#notes ⇒ String
Brief, human readable content that is shown to the agent as notes about the BuyerTransaction.
-
#partner_contact_id ⇒ String
*your system's* unique ID for the Contact.
-
#promote_transaction ⇒ Object
In order to promote a BuyerTransaction to the next stage, set the promote_transaction attribute to true.
-
#stage ⇒ Object
Each BuyerTransaction has five stages (1-5).
-
#stage_name ⇒ Object
This attribute displays a human readable stage name that is associated with the current stage attribute.
-
#start_timestamp ⇒ Object
this is the Unix timestamp representing the date the agent initiated transaction discussions with the client.
-
#state ⇒ String
State or province of property being sold.
-
#target_price ⇒ Integer
The desired selling price for the property if using target rather than range.
-
#transaction_name ⇒ String
A brief, human readable title that is shown to the agent as the subject of the BuyerTransaction.
-
#zip_code ⇒ String
Postal code of property being sold.
Attributes inherited from Resource
Class Method Summary collapse
-
.create(opts = {}) ⇒ MoxiworksPlatform::BuyerTransaction
Creates a new BuyerTransaction in Moxi Works Platform.
-
.find(opts = {}) ⇒ MoxiworksPlatform::BuyerTransaction
Find a BuyerTransaction using The Moxi Works Platform.
-
.search(opts = {}) ⇒ Hash
Search Agent's BuyerTransactions in Moxi Works Platform.
-
.send_request(method, opts = {}, url = nil) ⇒ MoxiworksPlatform::BuyerTransaction
Send our remote request to the Moxi Works Platform.
-
.update(opts = {}) ⇒ MoxiworksPlatform::BuyerTransaction
Updates an existing BuyerTransaction in Leads Gateway.
Instance Method Summary collapse
- #promote ⇒ Object
-
#save ⇒ MoxiWorksPlatform:BuyerTransaction
Save an instance of MoxiWorksPlatform::BuyerTransaction to Moxi Works Platform.
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
#address ⇒ String
Returns street address of property being sold.
84 85 86 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 84 def address @address end |
#area_of_interest ⇒ String
Returns string representing a locality that the client is interested in purchasing a property in.
149 150 151 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 149 def area_of_interest @area_of_interest end |
#city ⇒ String
Returns city or township of property being sold.
90 91 92 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 90 def city @city end |
#closing_price ⇒ Integer
This is the closing price for the sale . This should be null if the BuyerTransaction is not yet in stage 5 (complete).
243 244 245 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 243 def closing_price @closing_price end |
#closing_timestamp ⇒ Integer
A Unix timestamp representing the point in time when the transaction for this BuyerTransaction object was completed. This should be null if the BuyerTransaction is not yet in stage 5 (complete).
253 254 255 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 253 def @closing_timestamp end |
#commission_flat_fee ⇒ Integer
If the agent is to receive a flat-rate commission upon sale of the property associated with this BuyerTransaction, then this will represent the commission that the agent is to receive. This should be null if the BuyerTransaction uses commission_percentage.
– both commission_flat_fee and commission_percentage cannot be set
201 202 203 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 201 def commission_flat_fee @commission_flat_fee end |
#commission_percentage ⇒ Float
If the agent is to receive commission based on percentage of sale price for the property associated with this BuyerTransaction, then this will represent the commission that the agent is to receive.This should be null if the BuyerTransaction uses commission_flat_fee.
– both commission_flat_fee and commission_percentage cannot be set
189 190 191 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 189 def commission_percentage @commission_percentage end |
#is_mls_transaction ⇒ Boolean
Returns Whether the property is being listed on an MLS.
156 157 158 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 156 def is_mls_transaction @is_mls_transaction end |
#max_baths ⇒ Float
Returns maximum desired bathrooms in potential properties.
142 143 144 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 142 def max_baths @max_baths end |
#max_beds ⇒ Integer
Returns maximum desired bedrooms in potential properties.
128 129 130 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 128 def max_beds @max_beds end |
#max_price ⇒ Integer
The maximum desired price range for potential properties if using a price range rather than target price.
– both target_price and max_price cannot be set
234 235 236 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 234 def max_price @max_price end |
#max_sqft ⇒ Integer
Returns maximum desired living area of potential properties.
114 115 116 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 114 def max_sqft @max_sqft end |
#min_baths ⇒ Float
Returns minimum desired bathrooms in potential properties.
135 136 137 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 135 def min_baths @min_baths end |
#min_beds ⇒ Integer
Returns minimum desired bedrooms in potential properties.
121 122 123 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 121 def min_beds @min_beds end |
#min_price ⇒ Integer
The minimum desired price range for potential properties if using a price range rather than target price.
– both target_price and min_price cannot be set
224 225 226 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 224 def min_price @min_price end |
#min_sqft ⇒ Integer
Returns minimum desired living area of potential properties.
108 109 110 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 108 def min_sqft @min_sqft end |
#mls_number ⇒ String
**MLS TRANSACTIONS ONLY** mls number for the listing associated with this BuyerTransaction
– mls_number should be populated only if is_mls_transaction is true.
166 167 168 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 166 def mls_number @mls_number end |
#moxi_works_agent_id ⇒ String
moxi_works_agent_id is the Moxi Works Platform ID of the agent which a BuyerTransaction is or is to be associated with.
11 12 13 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 11 def moxi_works_agent_id @moxi_works_agent_id end |
#moxi_works_contact_id ⇒ Object
The Moxi Works Platform unique identifier for the Contact
22 23 24 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 22 def moxi_works_contact_id @moxi_works_contact_id end |
#moxi_works_transaction_id ⇒ String
Returns The Moxi Works Platform unique identifier for the BuyerTransaction.
16 17 18 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 16 def moxi_works_transaction_id @moxi_works_transaction_id end |
#notes ⇒ String
Brief, human readable content that is shown to the agent as notes about the BuyerTransaction. Use this attribute to store and display data to the agent that is not otherwise explicitly available via attributes for the entity.
50 51 52 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 50 def notes @notes end |
#partner_contact_id ⇒ String
*your system's* unique ID for the Contact
this or moxi_works_contact_id can be used in operations that require a Contact ID
this will only be populated for Contact objects that your system has created on the Moxi Works Platform
32 33 34 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 32 def partner_contact_id @partner_contact_id end |
#promote_transaction ⇒ Object
In order to promote a BuyerTransaction to the next stage, set the promote_transaction attribute to true. For more information about BuyerTransaction stages, see The Moxi Works Platform Documentation. promote_transaction is only available for BuyerTransaction updates. Newly created BuyerTransaction objects will automatically be created in stage 3 (active)
263 264 265 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 263 def promote_transaction @promote_transaction end |
#stage ⇒ Object
Each BuyerTransaction has five stages (1-5). stage displays the
stage number that the BuyerTransaction is currently in.
This will be a single digit integer that can be [1,2,3,4,5].
For more information on BuyerTransaction stages see
{https://moxiworks-platform.github.io/#buyertransaction-stages The Moxi Works Platform Documentation}
62 63 64 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 62 def stage @stage end |
#stage_name ⇒ Object
This attribute displays a human readable stage name that is associated with the current stage attribute. When created through the Moxi Works Platform BuyerTransaction objects will automatically be configured as 'active' transactions.
This will be an enumerated string that can be can be 'initialized', 'configured' , 'active' , 'pending' or 'complete' For more information on BuyerTransaction stages see
{https://moxiworks-platform.github.io/#buyertransaction-stages The Moxi Works Platform Documentation}
78 79 80 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 78 def stage_name @stage_name end |
#start_timestamp ⇒ Object
this is the Unix timestamp
representing the date the agent initiated transaction discussions
with the client.
176 177 178 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 176 def @start_timestamp end |
#state ⇒ String
Returns state or province of property being sold.
96 97 98 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 96 def state @state end |
#target_price ⇒ Integer
The desired selling price for the property if using target rather than range.
– both target_price and min_price cannot be set – both target_price and max_price cannot be set
213 214 215 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 213 def target_price @target_price end |
#transaction_name ⇒ String
A brief, human readable title that is shown to the agent as the subject of the BuyerTransaction.
40 41 42 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 40 def transaction_name @transaction_name end |
#zip_code ⇒ String
Returns postal code of property being sold.
102 103 104 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 102 def zip_code @zip_code end |
Class Method Details
.create(opts = {}) ⇒ MoxiworksPlatform::BuyerTransaction
Creates a new BuyerTransaction in Moxi Works Platform
– Either moxi_works_contact_id or partner_contact_id must be
populated; however, you should only populate one of these attributes.
optional BuyerTransaction parameters
334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 334 def self.create(opts={}) required_opts = [:moxi_works_agent_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_contact_id or partner_contact_id required' unless (opts.include?(:moxi_works_contact_id) or opts.include?(:partner_contact_id)) self.send_request(:post, opts) end |
.find(opts = {}) ⇒ MoxiworksPlatform::BuyerTransaction
Find a BuyerTransaction using The Moxi Works Platform
356 357 358 359 360 361 362 363 364 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 356 def self.find(opts={}) required_opts = [:moxi_works_agent_id, :moxi_works_transaction_id] required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end url = "#{MoxiworksPlatform::Config.url}/api/buyer_transactions/#{opts[:moxi_works_transaction_id]}" self.send_request(:get, opts, url) end |
.search(opts = {}) ⇒ Hash
Search Agent's BuyerTransactions in Moxi Works Platform
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 397 def self.search(opts={}) raise ::MoxiworksPlatform::Exception::ArgumentError, 'arguments must be passed as named parameters' unless opts.is_a? Hash url ||= "#{MoxiworksPlatform::Config.url}/api/buyer_transactions" required_opts = [:moxi_works_agent_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, 'transactions':[]} 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['transactions'].each do |r| results << MoxiworksPlatform::BuyerTransaction.new(r) unless r.nil? or r.empty? end json['transactions'] = results end json end |
.send_request(method, opts = {}, url = nil) ⇒ MoxiworksPlatform::BuyerTransaction
Send our remote request to the Moxi Works Platform
527 528 529 530 531 532 533 534 535 536 537 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 527 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/buyer_transactions" required_opts = [:moxi_works_agent_id] 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 |
.update(opts = {}) ⇒ MoxiworksPlatform::BuyerTransaction
Updates an existing BuyerTransaction in Leads Gateway
495 496 497 498 499 500 501 502 503 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 495 def self.update(opts={}) required_opts = [:moxi_works_agent_id, :moxi_works_transaction_id] required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end url = "#{MoxiworksPlatform::Config.url}/api/buyer_transactions/#{opts[:moxi_works_transaction_id]}" self.send_request(:put, opts, url) end |
Instance Method Details
#promote ⇒ Object
559 560 561 562 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 559 def promote self.promote_transaction = true self.save end |
#save ⇒ MoxiWorksPlatform:BuyerTransaction
Save an instance of MoxiWorksPlatform::BuyerTransaction to Moxi Works Platform
551 552 553 554 555 556 557 |
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 551 def save response = MoxiworksPlatform::BuyerTransaction.update(self.to_hash) return if response.nil? or response.moxi_works_transaction_id.nil? or response.moxi_works_transaction_id.empty? response.attributes.each {|r| self.send("#{r}=", response.send(r))} self.promote_transaction = false self end |