Class: MoxiworksPlatform::SellerTransaction
- Defined in:
- lib/moxiworks_platform/seller_transaction.rb
Instance Attribute Summary collapse
-
#address ⇒ String
Street address of property being sold.
-
#baths ⇒ Float
Number of bathrooms in property being sold.
-
#beds ⇒ Integer
Number of bedrooms in property being sold.
-
#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 SellerTransaction 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 SellerTransaction, 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 SellerTransaction, then this will represent the commission that the agent is to receive.This should be null if the SellerTransaction uses commission_flat_fee.
-
#is_mls_transaction ⇒ Boolean
Whether the property being sold is being listed on an MLS.
-
#max_price ⇒ Integer
The maximum price range for the property if using a price range rather than target price.
-
#min_price ⇒ Integer
The minimum price range for the property if using a price range rather than target price.
-
#mls_number ⇒ String
**MLS TRANSACTIONS ONLY** mls number for the listing associated with this SellerTransaction.
-
#moxi_works_agent_id ⇒ String
moxi_works_agent_id is the Moxi Works Platform ID of the agent which a SellerTransaction 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 SellerTransaction.
-
#notes ⇒ String
Brief, human readable content that is shown to the agent as notes about the SellerTransaction.
-
#partner_contact_id ⇒ String
*your system's* unique ID for the Contact.
-
#promote_transaction ⇒ Object
In order to promote a SellerTransaction to the next stage, set the promote_transaction attribute to true.
-
#sqft ⇒ Integer
Living area of property being sold.
-
#stage ⇒ Object
Each SellerTransaction 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 SellerTransaction.
-
#zip_code ⇒ String
Postal code of property being sold.
Attributes inherited from Resource
Class Method Summary collapse
-
.create(opts = {}) ⇒ MoxiworksPlatform::SellerTransaction
Creates a new SellerTransaction in Moxi Works Platform.
-
.find(opts = {}) ⇒ MoxiworksPlatform::SellerTransaction
Find a SellerTransaction using The Moxi Works Platform.
-
.search(opts = {}) ⇒ Hash
Search Agent's SellerTransactions in Moxi Works Platform.
-
.send_request(method, opts = {}, url = nil) ⇒ MoxiworksPlatform::Transaction
Send our remote request to the Moxi Works Platform.
-
.update(opts = {}) ⇒ MoxiworksPlatform::Transaction
Updates an existing SellerTransaction in Leads Gateway.
Instance Method Summary collapse
- #promote ⇒ Object
-
#save ⇒ MoxiWorksPlatform:SellerTransaction
Save an instance of MoxiWorksPlatform::SellerTransaction 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/seller_transaction.rb', line 84 def address @address end |
#baths ⇒ Float
Returns number of bathrooms in property being sold.
120 121 122 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 120 def baths @baths end |
#beds ⇒ Integer
Returns number of bedrooms in property being sold.
114 115 116 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 114 def beds @beds end |
#city ⇒ String
Returns city or township of property being sold.
90 91 92 |
# File 'lib/moxiworks_platform/seller_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 SellerTransaction is not yet in complete state.
213 214 215 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 213 def closing_price @closing_price end |
#closing_timestamp ⇒ Integer
A Unix timestamp representing the point in time when the transaction for this SellerTransaction object was completed. This should be null if the SellerTransaction is not yet in stage 5 (complete) state.
223 224 225 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 223 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 SellerTransaction, then this will represent the commission that the agent is to receive. This should be null if the SellerTransaction uses commission_percentage.
– both commission_flat_fee and commission_percentage cannot be set
171 172 173 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 171 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 SellerTransaction, then this will represent the commission that the agent is to receive.This should be null if the SellerTransaction uses commission_flat_fee.
– both commission_flat_fee and commission_percentage cannot be set
159 160 161 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 159 def commission_percentage @commission_percentage end |
#is_mls_transaction ⇒ Boolean
Returns Whether the property being sold is being listed on an MLS.
126 127 128 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 126 def is_mls_transaction @is_mls_transaction end |
#max_price ⇒ Integer
The maximum price range for the property if using a price range rather than target price.
– both target_price and max_price cannot be set
204 205 206 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 204 def max_price @max_price end |
#min_price ⇒ Integer
The minimum price range for the property if using a price range rather than target price.
– both target_price and min_price cannot be set
194 195 196 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 194 def min_price @min_price end |
#mls_number ⇒ String
**MLS TRANSACTIONS ONLY** mls number for the listing associated with this SellerTransaction
– mls_number should be populated only if is_mls_transaction is true.
136 137 138 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 136 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 SellerTransaction is or is to be associated with.
11 12 13 |
# File 'lib/moxiworks_platform/seller_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/seller_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 SellerTransaction.
16 17 18 |
# File 'lib/moxiworks_platform/seller_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 SellerTransaction. 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/seller_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/seller_transaction.rb', line 32 def partner_contact_id @partner_contact_id end |
#promote_transaction ⇒ Object
In order to promote a SellerTransaction to the next stage, set the promote_transaction attribute to true. For more information about SellerTransaction stages, see Moxi Works Platform Documentation. promote_transaction is only available for SellerTransaction updates. Newly created SellerTransaction objects will automatically be created in stage 3 (active)
233 234 235 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 233 def promote_transaction @promote_transaction end |
#sqft ⇒ Integer
Returns living area of property being sold.
108 109 110 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 108 def sqft @sqft end |
#stage ⇒ Object
Each SellerTransaction has five stages (1-5). stage displays the
stage number that the SellerTransaction is currently in.
This will be a single digit integer that can be [1,2,3,4,5].
For more information on SellerTransaction stages see
{https://moxiworks-platform.github.io/#sellertransaction-stages The Moxi Works Platform Documentation}
62 63 64 |
# File 'lib/moxiworks_platform/seller_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 SellerTransaction 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 SellerTransaction stages see
{https://moxiworks-platform.github.io/#sellertransaction-stages The Moxi Works Platform Documentation}
78 79 80 |
# File 'lib/moxiworks_platform/seller_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.
146 147 148 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 146 def @start_timestamp end |
#state ⇒ String
Returns state or province of property being sold.
96 97 98 |
# File 'lib/moxiworks_platform/seller_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
183 184 185 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 183 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 SellerTransaction.
40 41 42 |
# File 'lib/moxiworks_platform/seller_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/seller_transaction.rb', line 102 def zip_code @zip_code end |
Class Method Details
.create(opts = {}) ⇒ MoxiworksPlatform::SellerTransaction
Creates a new SellerTransaction 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 SellerTransaction parameters
296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 296 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::SellerTransaction
Find a SellerTransaction using The Moxi Works Platform
318 319 320 321 322 323 324 325 326 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 318 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/seller_transactions/#{opts[:moxi_works_transaction_id]}" self.send_request(:get, opts, url) end |
.search(opts = {}) ⇒ Hash
Search Agent's SellerTransactions in Moxi Works Platform
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 358 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/seller_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::SellerTransaction.new(r) unless r.nil? or r.empty? end json['transactions'] = results end json end |
.send_request(method, opts = {}, url = nil) ⇒ MoxiworksPlatform::Transaction
Send our remote request to the Moxi Works Platform
483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 483 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/seller_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::Transaction
Updates an existing SellerTransaction in Leads Gateway
450 451 452 453 454 455 456 457 458 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 450 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/seller_transactions/#{opts[:moxi_works_transaction_id]}" self.send_request(:put, opts, url) end |
Instance Method Details
#promote ⇒ Object
515 516 517 518 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 515 def promote self.promote_transaction = true self.save end |
#save ⇒ MoxiWorksPlatform:SellerTransaction
Save an instance of MoxiWorksPlatform::SellerTransaction to Moxi Works Platform
507 508 509 510 511 512 513 |
# File 'lib/moxiworks_platform/seller_transaction.rb', line 507 def save response = MoxiworksPlatform::SellerTransaction.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 |