Class: MoxiworksPlatform::BuyerTransaction

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

Instance Attribute Summary collapse

Attributes inherited from Resource

#headers

Class Method Summary collapse

Instance Method Summary collapse

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

#addressString

Returns street address of property being sold

Returns:

  • (String)

    street address of property being sold



84
85
86
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 84

def address
  @address
end

#area_of_interestString

Returns string representing a locality that the client is interested in purchasing a property in

Returns:

  • (String)

    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

#cityString

Returns city or township of property being sold

Returns:

  • (String)

    city or township of property being sold



90
91
92
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 90

def city
  @city
end

#closing_priceInteger

This is the closing price for the sale . This should be null if the BuyerTransaction is not yet in stage 5 (complete).

Returns:

  • (Integer)

    closing price for this BuyerTransaction



243
244
245
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 243

def closing_price
  @closing_price
end

#closing_timestampInteger

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).

Returns:

  • (Integer)

    Unix timestamp representing the date the transaction closed



253
254
255
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 253

def closing_timestamp
  @closing_timestamp
end

#commission_flat_feeInteger

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

Returns:

  • (Integer)


201
202
203
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 201

def commission_flat_fee
  @commission_flat_fee
end

#commission_percentageFloat

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

Returns:

  • (Float)


189
190
191
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 189

def commission_percentage
  @commission_percentage
end

#is_mls_transactionBoolean

Returns Whether the property is being listed on an MLS.

Returns:

  • (Boolean)

    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_bathsFloat

Returns maximum desired bathrooms in potential properties

Returns:

  • (Float)

    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_bedsInteger

Returns maximum desired bedrooms in potential properties

Returns:

  • (Integer)

    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_priceInteger

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

Returns:

  • (Integer)


234
235
236
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 234

def max_price
  @max_price
end

#max_sqftInteger

Returns maximum desired living area of potential properties

Returns:

  • (Integer)

    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_bathsFloat

Returns minimum desired bathrooms in potential properties

Returns:

  • (Float)

    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_bedsInteger

Returns minimum desired bedrooms in potential properties

Returns:

  • (Integer)

    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_priceInteger

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

Returns:

  • (Integer)


224
225
226
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 224

def min_price
  @min_price
end

#min_sqftInteger

Returns minimum desired living area of potential properties

Returns:

  • (Integer)

    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_numberString

**MLS TRANSACTIONS ONLY** mls number for the listing associated with this BuyerTransaction

– mls_number should be populated only if is_mls_transaction is true.

Returns:

  • (String)


166
167
168
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 166

def mls_number
  @mls_number
end

#moxi_works_agent_idString

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

Returns:

  • (String)

    the Moxi Works Platform ID of the agent



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_idObject

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_idString

Returns The Moxi Works Platform unique identifier for the BuyerTransaction

Returns:

  • (String)

    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

#notesString

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.

Returns:

  • (String)

    human readable notes about this BuyerTransaction



50
51
52
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 50

def notes
  @notes
end

#partner_contact_idString

*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

Returns:

  • (String)

    your system's unique ID for the contact



32
33
34
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 32

def partner_contact_id
  @partner_contact_id
end

#promote_transactionObject

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

#stageObject

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_nameObject

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_timestampObject

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
  @start_timestamp
end

#stateString

Returns state or province of property being sold

Returns:

  • (String)

    state or province of property being sold



96
97
98
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 96

def state
  @state
end

#target_priceInteger

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

Returns:

  • (Integer)


213
214
215
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 213

def target_price
  @target_price
end

#transaction_nameString

A brief, human readable title that is shown to the agent as the subject of the BuyerTransaction.

Returns:

  • (String)

    name of transaction



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

def transaction_name
  @transaction_name
end

#zip_codeString

Returns postal code of property being sold

Returns:

  • (String)

    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

Examples:

Resource::TechConnectGateway::BuyerTransaction.create(
     agent_identifier:'testis@testomatical.com',
     moxi_works_contact_id:'deadbeef-dead-beef-bad4-feedfacebad',
     notes: 'foo deeaz',
     transaction_name: 'whateverz'
     address: '1234 there ave',
     city: 'cityville'
     state:  'provinceland',
     zip_code: '12323',
     min_beds: 12,
     max_beds: 34,
     min_baths: 1.25,
     max_baths: 3.75,
     min_sqft: 12345,
     max_sqft: 34567,
     area_of_interest: 'Lake Interesting'
     is_mls_transaction: true,
     commission_flat_fee: nil,
     commission_percentage: 12.34,
     target_price: 12345,
     min_price: nil,
     max_price: nil,
     mls_number: 'abc1234'
)

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 transaction is to be associated

  • :moxi_works_contact_id (String)

    REQUIRED The unique identifier for the Contact on the Moxi Works Platform. Either moxi_works_contact_id or partner_contact_id is required when creating BuyerTransaction objects

  • :partner_contact_id (String)

    REQUIRED Your system's unique id for associated contact. should already have been created in Moxi Works Platform. If the Contact was not created by your system, use the moxi_works_contact_id attribute. Either moxi_works_contact_id or partner_contact_id is required when creating BuyerTransaction objects

  • :transaction_name (String)

    REQUIRED short description of the transaction meaningful to the agent

  • :notes (String)

    human readable notes associated with the transaction meaningful to the agent

  • :address (String)

    street address of the property associated with the transaction

  • :city (String)

    city of the property associated with the transaction

  • :state (String)

    state or province of the property associated with the transaction

  • :zip_code (String)

    postal code of the property associated with the transaction

  • :min_sqft (Integer)

    minimum desired square feet of living area in potential properties

  • :max_sqft (Integer)

    maximum desired square feet of living area in potential properties

  • :min_beds (Integer)

    minimum desired number of bedrooms in potential properties

  • :max_beds (Integer)

    maximum desired number of bedrooms in potential properties

  • :area_of_interest (String)

    string representing a locality that the client has expressed interest in purchasing a property within

  • :min_baths (Integer or Float)

    minimum desired number of bathrooms in potential properties

  • :max_baths (Integer or Float)

    maximum desired number of bathrooms in potential properties

  • :is_mls_transaction (Boolean)

    Whether the property being purchased is being listed on an MLS. This should be false for paperwork-only, for sale by owner, off-market, or pocket listing type transactions or any transactions that will not be tracked through an MLS.

  • :mls_number (String)

    mls number associated with the transaction – mls_number should be populated only if is_mls_transaction is true.

  • :start_timestamp (Integer)

    Unix timestamp representing the date the agent initiated transaction discussions with the client.

  • :commission_percentage (Float)

    what percentage the commission is if percentage based – A BuyerTransaction can only have either commission_percentage or commission_flat_fee populated. Both can not be populated.

  • :commission_flat_fee (Integer)

    how much the commission is if flat fee – A BuyerTransaction can only have either commission_percentage or commission_flat_fee populated. Both can not be populated.

  • :target_price (Integer)

    target price associated with the transaction if using a target price rather than price range

  • :min_price (Integer)

    minimum acceptable price associated with the transaction if using a price range rather than target price

  • :max_price (Integer)

    maximum price associated with the transaction if using a price range rather than target price

Returns:

Raises:

  • ::MoxiworksPlatform::Exception::ArgumentError if required named parameters aren't included



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

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 transaction is associated

  • :moxi_works_transaction_id (String)

    REQUIRED The Moxi Works Platform ID for this transaction.

Returns:

Raises:

  • ::MoxiworksPlatform::Exception::ArgumentError if required named parameters aren't included



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

Examples:

results = MoxiworksPlatform::BuyerTransaction.search(
moxi_works_agent_id: '123abc',
page_number: 2
)

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 associated

    optional Search parameters

  • :moxi_works_contact_id (String)

    The Moxi Works Contact ID for the contact whose BuyerTransactions you are searching for

  • :partner_contact_id (String)

    The partner's ID for the contact whose BuyerTransactions they are looking for

  • :page_number (Integer)

    the page of results to return

  • :include_unconfigured (Boolean)

    whether to include stage 1 transactions in response

Returns:

  • (Hash)

    with the format:

    page_number: [Integer],
    total_pages: [Integer],
    transactions:  [Array] containing MoxiworkPlatform::BuyerTransaction objects
    

Raises:

  • ::MoxiworksPlatform::Exception::ArgumentError if required named parameters aren't included



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

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 transaction is to be associated

  • :moxi_works_transaction_id (String)

    REQUIRED The Moxi Works Platform unique ID for this transaction.

  • :partner_contact_id (String)

    REQUIRED Your system's unique ID for the Contact for whom this BuyerTransaction is to be associated.

    optional BuyerTransaction parameters

  • :transaction_name (String)

    short description of the transaction

  • :description (String)

    longer description of the transaction

  • :due_at (Integer)

    Unix timestamp representing the due date

  • :duration (Integer)

    Length of time in minutes that the transaction should take

  • :completed_at (Integer)

    Unix timestamp representing the date the transaction was completed

  • :status (String)

    enumerated string representing transaction status

Returns:

Raises:

  • ::MoxiworksPlatform::Exception::ArgumentError if required named parameters aren't included



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

Examples:

Resource::TechConnectGateway::BuyerTransaction.update(
     agent_identifier:'testis@testomatical.com',
     moxi_works_transaction_id:'deadbeef-dead-beef-bad4-feedfacebad',
     notes: 'foo deeaz',
     transaction_name: 'whateverz'
     address: '1234 there ave',
     city: 'cityville'
     state:  'provinceland',
     zip_code: '12323',
     min_beds: 12,
     max_beds: 34,
     min_baths: 1.25,
     max_baths: 3.75,
     min_sqft: 12345,
     max_sqft: 34567,
     area_of_interest: 'Lake Interesting'
     is_mls_transaction: true,
     commission_flat_fee: nil,
     commission_percentage: 12.34,
     target_price: 12345,
     min_price: nil,
     max_price: nil,
     mls_number: 'abc1234'
     closing_price: 123456,
     closing_timestamp: Time.now.to_i,
     promote_transaction: true
)

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 transaction is associated

  • :moxi_works_transaction_id (String)

    REQUIRED partner system's unique ID for this transaction.

    optional BuyerTransaction parameters

  • :transaction_name (String)

    short description of the transaction meaningful to the agent

  • :notes (String)

    human readable notes associated with the transaction meaningful to the agent

  • :address (String)

    street address of the property associated with the transaction

  • :city (String)

    city of the property associated with the transaction

  • :state (String)

    state or province of the property associated with the transaction

  • :zip_code (String)

    postal code of the property associated with the transaction

  • :min_sqft (Integer)

    minimum desired square feet of living area in potential properties

  • :max_sqft (Integer)

    maximum desired square feet of living area in potential properties

  • :min_beds (Integer)

    minimum desired number of bedrooms in potential properties

  • :max_beds (Integer)

    maximum desired number of bedrooms in potential properties

  • :area_of_interest (String)

    string representing a locality that the client has expressed interest in purchasing a property within

  • :min_baths (Integer or Float)

    minimum desired number of bathrooms in potential properties

  • :max_baths (Integer or Float)

    maximum desired number of bathrooms in potential properties

  • :is_mls_transaction (Boolean)

    Whether the property being purchased is being listed on an MLS. This should be false for paperwork-only, for sale by owner, off-market, or pocket listing type transactions or any transactions that will not be tracked through an MLS.

  • :mls_number (String)

    mls number associated with the transaction – mls_number should be populated only if is_mls_transaction is true.

  • :start_timestamp (Integer)

    Unix timestamp representing the date the agent initiated transaction discussions with the client.

  • :commission_percentage (Float)

    what percentage the commission is if percentage based – A BuyerTransaction can only have either commission_percentage or commission_flat_fee populated. Both can not be populated.

  • :commission_flat_fee (Integer)

    how much the commission is if flat fee – A BuyerTransaction can only have either commission_percentage or commission_flat_fee populated. Both can not be populated.

  • :target_price (Integer)

    target price associated with the transaction if using a target price rather than price range

  • :min_price (Integer)

    minimum acceptable price associated with the transaction if using a price range rather than target price

  • :max_price (Integer)

    maximum price associated with the transaction if using a price range rather than target price

  • :closing_timestamp (Integer)

    Unix timestamp representing the date the sale of the property closed – closing_timestamp should only be used when the SellerTransaction state = 5 (complete)

  • :closing_price (Integer)

    selling price of the property – closing_price should only be used when the SellerTransaction state = 5 (complete)

  • :promote_transaction (Boolean)

    If this is set to true then The Moxi Works Platform will promote this transaction to the next stage

Returns:

Raises:

  • ::MoxiworksPlatform::Exception::ArgumentError if required named parameters aren't included



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

#promoteObject



559
560
561
562
# File 'lib/moxiworks_platform/buyer_transaction.rb', line 559

def promote
  self.promote_transaction = true
  self.save
end

#saveMoxiWorksPlatform:BuyerTransaction

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

Examples:

transaction = MoxiWorksPlatform::BuyerTransaction.new()
transaction.moxi_works_agent_id = '1234abc'
transaction.moxi_works_transaction_id = 'burbywurb'
transaction.promote_transaction = true
transaction.closing_timestamp =  Time.now.to_i
transaction.closing_price = 1234567
transaction.save

Returns:

  • (MoxiWorksPlatform:BuyerTransaction)


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