moxiworks_platform 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 412995e90bdd8e998839e4d0b8cdb22bea1f4fd3
4
- data.tar.gz: 677d8ee627b1f471d57c4bcfc68b7af14a141859
3
+ metadata.gz: 7b5b401acac755297329d154e1052471cb6825a7
4
+ data.tar.gz: 48d102c5dcec45b751f5880259b47a55d11dec1c
5
5
  SHA512:
6
- metadata.gz: f983e9bfb9da33f7df933fedc90f16391b01ac222f39bb20b1bfa5b1d98464bc376f06044a97a977a83cdebca832a68fa6fa3cd28c6da6920fc626ebb4507d7c
7
- data.tar.gz: 9dc26db95954e27a9a5193ea7a82c11eed449ebff7ed162f04131e050085791c75754caa3a012941d66e2e49678113073a25e052719a820ae772dc4f02be1684
6
+ metadata.gz: 1234822529a1438cb604a3512cda3ec93b55dd784d572613973cee1f28a7c5054507ac7691fae2e1b2bbaf07b896ab28810541d96987398785fec35c54a5a383
7
+ data.tar.gz: 6e77d0aba5cd6a3a9503e570b3ead31c30c7b4c45075ea96932b448c52158083b25832eb7589467ebffd020872004077cee8b3a2209794b71ea599266607d367
data/README.md CHANGED
@@ -31,6 +31,9 @@ MoxiworksPlatform::Credentials.new(platform_identifier, platform_secret)
31
31
  contact = MoxiworksPlatform::Contact.create(moxi_works_agent_id: '123abcd', partner_contact_id: 'my_unique_id')
32
32
  ```
33
33
 
34
+ ## Building Docs
35
+ run `./publish_docs.sh`
36
+
34
37
  ## Development
35
38
 
36
39
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -41,6 +41,11 @@ module MoxiworksPlatform
41
41
  # @return [String] the agent's office address, street and number
42
42
  attr_accessor :office_address_street
43
43
 
44
+ # @!attribute office_address_street2
45
+ #
46
+ # @return [String] the agent's office address, suite or office number
47
+ attr_accessor :office_address_street2
48
+
44
49
  # @!attribute office_address_city
45
50
  #
46
51
  # @return [String] the agent's office address, city
@@ -128,7 +133,7 @@ module MoxiworksPlatform
128
133
 
129
134
  # Find an Agent on the Moxi Works Platform
130
135
  # @param [Hash] opts named parameter Hash
131
- # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this contact is to be associated
136
+ # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent
132
137
  #
133
138
  # @return [MoxiworksPlatform::Agent]
134
139
  #
@@ -0,0 +1,563 @@
1
+ module MoxiworksPlatform
2
+ class BuyerTransaction < MoxiworksPlatform::Resource
3
+
4
+
5
+ # @!attribute moxi_works_agent_id
6
+ # moxi_works_agent_id is the Moxi Works Platform ID of the agent which a BuyerTransaction is
7
+ # or is to be associated with.
8
+ #
9
+ #
10
+ # @return [String] the Moxi Works Platform ID of the agent
11
+ attr_accessor :moxi_works_agent_id
12
+
13
+ # @!attribute moxi_works_transaction_id
14
+ #
15
+ # @return [String] The Moxi Works Platform unique identifier for the BuyerTransaction
16
+ attr_accessor :moxi_works_transaction_id
17
+
18
+ # @!attribute moxi_works_contact_id
19
+ # The Moxi Works Platform unique identifier for the Contact
20
+ # this or partner_contact_id can be used in operations that require a Contact ID
21
+ # @return [String] The Moxi Works Platform unique ID for the contact
22
+ attr_accessor :moxi_works_contact_id
23
+
24
+ # @!attribute partner_contact_id
25
+ # *your system's* unique ID for the Contact
26
+ #
27
+ # this or moxi_works_contact_id can be used in operations that require a Contact ID
28
+ #
29
+ # this will only be populated for Contact objects that your system has created on the Moxi Works Platform
30
+ #
31
+ # @return [String] your system's unique ID for the contact
32
+ attr_accessor :partner_contact_id
33
+
34
+ # @!attribute transaction_name
35
+ #
36
+ # A brief, human readable title that is shown to the agent as the
37
+ # subject of the BuyerTransaction.
38
+ #
39
+ # @return [String] name of transaction
40
+ attr_accessor :transaction_name
41
+
42
+ # @!attribute notes
43
+ #
44
+ # Brief, human readable content that is shown to the agent as notes
45
+ # about the BuyerTransaction. Use this attribute to store and display
46
+ # data to the agent that is not otherwise explicitly available via
47
+ # attributes for the entity.
48
+ #
49
+ # @return [String] human readable notes about this BuyerTransaction
50
+ attr_accessor :notes
51
+
52
+ # @!attribute stage
53
+ #
54
+ # Each BuyerTransaction has five stages (1-5). stage displays the
55
+ # stage number that the BuyerTransaction is currently in.
56
+ #
57
+ # This will be a single digit integer that can be [1,2,3,4,5].
58
+ # For more information on BuyerTransaction stages see
59
+ # <a href='https://moxiworks-platform.github.io/#buyertransaction-stages'>The Moxi Works Platform Documentation</a>
60
+ #
61
+ # @return [Integer] the stage the BuyerTransaction is in.
62
+ attr_accessor :stage
63
+
64
+ # @!attribute stage_name
65
+ #
66
+ # This attribute displays a human readable stage name that is
67
+ # associated with the current stage attribute. When created
68
+ # through the Moxi Works Platform BuyerTransaction objects
69
+ # will automatically be configured as 'active' transactions.
70
+ #
71
+ # This will be an enumerated string that can be can be
72
+ # 'initialized', 'configured' , 'active' , 'pending' or 'complete'
73
+ # For more information on BuyerTransaction stages see
74
+ # <a href='https://moxiworks-platform.github.io/#buyertransaction-stages'>The Moxi Works Platform Documentation</a>
75
+ #
76
+ #
77
+ # @return [String, enumerated] current state of BuyerTransaction
78
+ attr_accessor :stage_name
79
+
80
+ # @!attribute address
81
+ #
82
+ #
83
+ # @return [String] street address of property being sold
84
+ attr_accessor :address
85
+
86
+ # @!attribute city
87
+ #
88
+ #
89
+ # @return [String] city or township of property being sold
90
+ attr_accessor :city
91
+
92
+ # @!attribute state
93
+ #
94
+ #
95
+ # @return [String] state or province of property being sold
96
+ attr_accessor :state
97
+
98
+ # @!attribute zip_code
99
+ #
100
+ #
101
+ # @return [String] postal code of property being sold
102
+ attr_accessor :zip_code
103
+
104
+ # @!attribute min_sqft
105
+ #
106
+ #
107
+ # @return [Integer] minimum desired living area of potential properties
108
+ attr_accessor :min_sqft
109
+
110
+ # @!attribute max_sqft
111
+ #
112
+ #
113
+ # @return [Integer] maximum desired living area of potential properties
114
+ attr_accessor :max_sqft
115
+
116
+
117
+ # @!attribute min_beds
118
+ #
119
+ #
120
+ # @return [Integer] minimum desired bedrooms in potential properties
121
+ attr_accessor :min_beds
122
+
123
+
124
+ # @!attribute max_beds
125
+ #
126
+ #
127
+ # @return [Integer] maximum desired bedrooms in potential properties
128
+ attr_accessor :max_beds
129
+
130
+
131
+ # @!attribute min_baths
132
+ #
133
+ #
134
+ # @return [Float] minimum desired bathrooms in potential properties
135
+ attr_accessor :min_baths
136
+
137
+
138
+ # @!attribute max_baths
139
+ #
140
+ #
141
+ # @return [Float] maximum desired bathrooms in potential properties
142
+ attr_accessor :max_baths
143
+
144
+
145
+ # @!attribute area_of_interest
146
+ #
147
+ #
148
+ # @return [String] string representing a locality that the client is interested in purchasing a property in
149
+ attr_accessor :area_of_interest
150
+
151
+
152
+ # @!attribute is_mls_transaction
153
+ #
154
+ #
155
+ # @return [Boolean] Whether the property is being listed on an MLS.
156
+ attr_accessor :is_mls_transaction
157
+
158
+ # @!attribute mls_number
159
+ #
160
+ # **MLS TRANSACTIONS ONLY**
161
+ # mls number for the listing associated with this BuyerTransaction
162
+ #
163
+ # -- mls_number should be populated only if is_mls_transaction is true.
164
+ #
165
+ # @return [String]
166
+ attr_accessor :mls_number
167
+
168
+
169
+ # @!attribute start_timestamp
170
+ #
171
+ # **NON MLS TRANSACTIONS ONLY ** this is the Unix timestamp
172
+ # representing the date the agent initiated transaction discussions
173
+ # with the client.
174
+ #
175
+ # @return [Integer] Unix Timestamp
176
+ attr_accessor :start_timestamp
177
+
178
+
179
+ # @!attribute commission_percentage
180
+ #
181
+ # If the agent is to receive commission based on percentage of sale
182
+ # price for the property associated with this BuyerTransaction, then
183
+ # this will represent the commission that the agent is to receive.This
184
+ # should be null if the BuyerTransaction uses commission_flat_fee.
185
+ #
186
+ # -- both commission_flat_fee and commission_percentage cannot be set
187
+ #
188
+ # @return [Float]
189
+ attr_accessor :commission_percentage
190
+
191
+ # @!attribute commission_flat_fee
192
+ #
193
+ # If the agent is to receive a flat-rate commission upon sale of the
194
+ # property associated with this BuyerTransaction, then this will
195
+ # represent the commission that the agent is to receive. This should
196
+ # be null if the BuyerTransaction uses commission_percentage.
197
+ #
198
+ # -- both commission_flat_fee and commission_percentage cannot be set
199
+ #
200
+ # @return [Integer]
201
+ attr_accessor :commission_flat_fee
202
+
203
+
204
+ # @!attribute target_price
205
+ #
206
+ # The desired selling price for the property if using target rather
207
+ # than range.
208
+ #
209
+ # -- both target_price and min_price cannot be set
210
+ # -- both target_price and max_price cannot be set
211
+ #
212
+ # @return [Integer]
213
+ attr_accessor :target_price
214
+
215
+
216
+ # @!attribute min_price
217
+ #
218
+ # The minimum desired price range for potential properties if using a price range
219
+ # rather than target price.
220
+ #
221
+ # -- both target_price and min_price cannot be set
222
+ #
223
+ # @return [Integer]
224
+ attr_accessor :min_price
225
+
226
+
227
+ # @!attribute max_price
228
+ #
229
+ # The maximum desired price range for potential properties if using a price range
230
+ # rather than target price.
231
+ #
232
+ # -- both target_price and max_price cannot be set
233
+ # @return [Integer]
234
+ attr_accessor :max_price
235
+
236
+
237
+ # @!attribute closing_price
238
+ #
239
+ # This is the closing price for the sale . This should be null if the
240
+ # BuyerTransaction is not yet in stage 5 (complete).
241
+ #
242
+ # @return [Integer] closing price for this BuyerTransaction
243
+ attr_accessor :closing_price
244
+
245
+
246
+ # @!attribute closing_timestamp
247
+ #
248
+ # A Unix timestamp representing the point in time when the
249
+ # transaction for this BuyerTransaction object was completed. This
250
+ # should be null if the BuyerTransaction is not yet in stage 5 (complete).
251
+ #
252
+ # @return [Integer] Unix timestamp representing the date the transaction closed
253
+ attr_accessor :closing_timestamp
254
+
255
+ # @!attribute promote_transaction
256
+ #
257
+ # In order to promote a BuyerTransaction to the next stage, set the
258
+ # promote_transaction attribute to true. For more information about
259
+ # BuyerTransaction stages, see <a href='https://moxiworks-platform.github.io/#promoting-buyertransaction-stage>The Moxi Works Platform Documentation</a>.
260
+ # promote_transaction is only available for BuyerTransaction updates.
261
+ # Newly created BuyerTransaction objects will automatically be created in
262
+ # stage 3 (active)
263
+ attr_accessor :promote_transaction
264
+
265
+
266
+ #### CLASS METHODS ####
267
+
268
+ # Creates a new BuyerTransaction in Moxi Works Platform
269
+ #
270
+ # @param [Hash] opts named parameter Hash
271
+ # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this transaction is to be associated
272
+ # @option opts [String] :moxi_works_contact_id *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
273
+ # @option opts [String] :partner_contact_id *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
274
+ #
275
+ # -- Either moxi_works_contact_id or partner_contact_id must be
276
+ # populated; however, you should only populate one of these attributes.
277
+ #
278
+ # optional BuyerTransaction parameters
279
+ #
280
+ # @option opts [String] :name short description of the transaction meaningful to the agent
281
+ # @option opts [String] :notes human readable notes associated with the transaction meaningful to the agent
282
+ # @option opts [String] :address street address of the property associated with the transaction
283
+ # @option opts [String] :city city of the property associated with the transaction
284
+ # @option opts [String] :state state or province of the property associated with the transaction
285
+ # @option opts [String] :zip_code postal code of the property associated with the transaction
286
+ # @option opts [Integer] :min_sqft minimum desired square feet of living area in potential properties
287
+ # @option opts [Integer] :max_sqft maximum desired square feet of living area in potential properties
288
+ # @option opts [Integer] :min_beds minimum desired number of bedrooms in potential properties
289
+ # @option opts [Integer] :max_beds maximum desired number of bedrooms in potential properties
290
+ # @option opts [String] :area_of_interest string representing a locality that the client has expressed interest in purchasing a property within
291
+ # @option opts [Integer or Float] :min_baths minimum desired number of bathrooms in potential properties
292
+ # @option opts [Integer or Float] :max_baths maximum desired number of bathrooms in potential properties
293
+ # @option opts [Boolean] :is_mls_transaction 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. If is_mls_transaction is false, then start_timestamp should be populated.
294
+ # @option opts [String] :mls_number mls number associated with the transaction -- mls_number should be populated only if is_mls_transaction is true.
295
+ # @option opts [Integer] :start_timestamp Unix timestamp representing the date the property was put on sale -- start_timestamp should be populated only if is_mls_transaction is false.
296
+ # @option opts [Float] :commission_percentage 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.
297
+ # @option opts [Integer] :commission_flat_fee 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.
298
+ # @option opts [Integer] :target_price target price associated with the transaction if using a target price rather than price range
299
+ # @option opts [Integer] :min_price minimum acceptable price associated with the transaction if using a price range rather than target price
300
+ # @option opts [Integer] :max_price maximum price associated with the transaction if using a price range rather than target price
301
+ #
302
+ # @example
303
+ # Resource::TechConnectGateway::BuyerTransaction.create(
304
+ # agent_identifier:'testis@testomatical.com',
305
+ # moxi_works_contact_id:'deadbeef-dead-beef-bad4-feedfacebad',
306
+ # notes: 'foo deeaz',
307
+ # name: 'whateverz'
308
+ # address: '1234 there ave',
309
+ # city: 'cityville'
310
+ # state: 'provinceland',
311
+ # zip_code: '12323',
312
+ # min_beds: 12,
313
+ # max_beds: 34,
314
+ # min_baths: 1.25,
315
+ # max_baths: 3.75,
316
+ # min_sqft: 12345,
317
+ # max_sqft: 34567,
318
+ # area_of_interest: 'Lake Interesting'
319
+ # is_mls_transaction: true,
320
+ # commission_flat_fee: nil,
321
+ # commission_percentage: 12.34,
322
+ # target_price: 12345,
323
+ # min_price: nil,
324
+ # max_price: nil,
325
+ # mls_number: 'abc1234'
326
+ # )
327
+ #
328
+ # @return [MoxiworksPlatform::BuyerTransaction]
329
+ #
330
+ # @raise ::MoxiworksPlatform::Exception::ArgumentError if required
331
+ # named parameters aren't included
332
+ #
333
+ #
334
+ def self.create(opts={})
335
+ required_opts = [:moxi_works_agent_id]
336
+ required_opts.each do |opt|
337
+ raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
338
+ opts[opt].nil? or opts[opt].to_s.empty?
339
+ end
340
+ raise ::MoxiworksPlatform::Exception::ArgumentError,
341
+ 'moxi_works_contact_id or partner_contact_id required' unless
342
+ (opts.include?(:moxi_works_contact_id) or opts.include?(:partner_contact_id))
343
+ self.send_request(:post, opts)
344
+ end
345
+
346
+ # Find a BuyerTransaction using The Moxi Works Platform
347
+ # @param [Hash] opts named parameter Hash
348
+ # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this transaction is associated
349
+ # @option opts [String] :moxi_works_transaction_id *REQUIRED* The Moxi Works Platform ID for this transaction.
350
+ #
351
+ # @return [MoxiworksPlatform::BuyerTransaction]
352
+ #
353
+ # @raise ::MoxiworksPlatform::Exception::ArgumentError if required
354
+ # named parameters aren't included
355
+ #
356
+ def self.find(opts={})
357
+ required_opts = [:moxi_works_agent_id, :moxi_works_transaction_id]
358
+ required_opts.each do |opt|
359
+ raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
360
+ opts[opt].nil? or opts[opt].to_s.empty?
361
+ end
362
+ url = "#{MoxiworksPlatform::Config.url}/api/buyer_transactions/#{opts[:moxi_works_transaction_id]}"
363
+ self.send_request(:get, opts, url)
364
+ end
365
+
366
+
367
+ # Search Agent's BuyerTransactions in Moxi Works Platform
368
+ #
369
+ # @param [Hash] opts named parameter Hash
370
+ # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this contact is associated
371
+ #
372
+ #
373
+ # optional Search parameters
374
+ #
375
+ # @option opts [String] :moxi_works_contact_id The Moxi Works Contact ID for the contact whose BuyerTransactions you are searching for
376
+ # @option opts [String] :partner_contact_id The partner's ID for the contact whose BuyerTransactions they are looking for
377
+ # @option opts [Integer] :page_number the page of results to return
378
+ # @option opts [Boolean] :include_unconfigured whether to include stage 1 transactions in response
379
+ #
380
+ # @return [Hash] with the format:
381
+ # {
382
+ # page_number: [Integer],
383
+ # total_pages: [Integer],
384
+ # transactions: [Array] containing MoxiworkPlatform::BuyerTransaction objects
385
+ # }
386
+ #
387
+ #
388
+ # @raise ::MoxiworksPlatform::Exception::ArgumentError if required
389
+ # named parameters aren't included
390
+ #
391
+ # @example
392
+ # results = MoxiworksPlatform::BuyerTransaction.search(
393
+ # moxi_works_agent_id: '123abc',
394
+ # page_number: 2
395
+ # )
396
+ #
397
+ def self.search(opts={})
398
+ raise ::MoxiworksPlatform::Exception::ArgumentError,
399
+ 'arguments must be passed as named parameters' unless opts.is_a? Hash
400
+ url ||= "#{MoxiworksPlatform::Config.url}/api/buyer_transactions"
401
+ required_opts = [:moxi_works_agent_id]
402
+ required_opts.each do |opt|
403
+ raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
404
+ opts[opt].nil? or opts[opt].to_s.empty?
405
+ end
406
+ results = []
407
+ json = { 'page_number': 1, 'total_pages': 0, 'transactions':[]}
408
+ RestClient::Request.execute(method: :get,
409
+ url: url,
410
+ payload: opts, headers: self.headers) do |response|
411
+ puts response if MoxiworksPlatform::Config.debug
412
+ self.check_for_error_in_response(response)
413
+ json = JSON.parse(response)
414
+ json['transactions'].each do |r|
415
+ results << MoxiworksPlatform::BuyerTransaction.new(r) unless r.nil? or r.empty?
416
+ end
417
+ json['transactions'] = results
418
+ end
419
+ json
420
+ end
421
+
422
+ # Updates an existing BuyerTransaction in Leads Gateway
423
+ #
424
+ # @param [Hash] opts named parameter Hash
425
+ # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this transaction is associated
426
+ # @option opts [String] :moxi_works_transaction_id *REQUIRED* partner system's unique ID for this transaction.
427
+ #
428
+ # optional BuyerTransaction parameters
429
+ #
430
+ # @option opts [String] :name short description of the transaction meaningful to the agent
431
+ # @option opts [String] :notes human readable notes associated with the transaction meaningful to the agent
432
+ # @option opts [String] :address street address of the property associated with the transaction
433
+ # @option opts [String] :city city of the property associated with the transaction
434
+ # @option opts [String] :state state or province of the property associated with the transaction
435
+ # @option opts [String] :zip_code postal code of the property associated with the transaction
436
+ # @option opts [Integer] :min_sqft minimum desired square feet of living area in potential properties
437
+ # @option opts [Integer] :max_sqft maximum desired square feet of living area in potential properties
438
+ # @option opts [Integer] :min_beds minimum desired number of bedrooms in potential properties
439
+ # @option opts [Integer] :max_beds maximum desired number of bedrooms in potential properties
440
+ # @option opts [String] :area_of_interest string representing a locality that the client has expressed interest in purchasing a property within
441
+ # @option opts [Integer or Float] :min_baths minimum desired number of bathrooms in potential properties
442
+ # @option opts [Integer or Float] :max_baths maximum desired number of bathrooms in potential properties
443
+ # @option opts [Boolean] :is_mls_transaction 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. If is_mls_transaction is false, then start_timestamp should be populated.
444
+ # @option opts [String] :mls_number mls number associated with the transaction -- mls_number should be populated only if is_mls_transaction is true.
445
+ # @option opts [Integer] :start_timestamp Unix timestamp representing the date the property was put on sale -- start_timestamp should be populated only if is_mls_transaction is false.
446
+ # @option opts [Float] :commission_percentage 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.
447
+ # @option opts [Integer] :commission_flat_fee 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.
448
+ # @option opts [Integer] :target_price target price associated with the transaction if using a target price rather than price range
449
+ # @option opts [Integer] :min_price minimum acceptable price associated with the transaction if using a price range rather than target price
450
+ # @option opts [Integer] :max_price maximum price associated with the transaction if using a price range rather than target price
451
+ # @option opts [Integer] :closing_timestamp Unix timestamp representing the date the sale of the property closed -- closing_timestamp should only be used when the SellerTransaction state = 5 (complete)
452
+ # @option opts [Integer] :closing_price selling price of the property -- closing_price should only be used when the SellerTransaction state = 5 (complete)
453
+ # @option opts [Boolean] :promote_transaction If this is set to true then The Moxi Works Platform will promote this transaction to the next stage
454
+ #
455
+ # @example
456
+ # Resource::TechConnectGateway::BuyerTransaction.update(
457
+ # agent_identifier:'testis@testomatical.com',
458
+ # moxi_works_transaction_id:'deadbeef-dead-beef-bad4-feedfacebad',
459
+ # notes: 'foo deeaz',
460
+ # name: 'whateverz'
461
+ # address: '1234 there ave',
462
+ # city: 'cityville'
463
+ # state: 'provinceland',
464
+ # zip_code: '12323',
465
+ # min_beds: 12,
466
+ # max_beds: 34,
467
+ # min_baths: 1.25,
468
+ # max_baths: 3.75,
469
+ # min_sqft: 12345,
470
+ # max_sqft: 34567,
471
+ # area_of_interest: 'Lake Interesting'
472
+ # is_mls_transaction: true,
473
+ # commission_flat_fee: nil,
474
+ # commission_percentage: 12.34,
475
+ # target_price: 12345,
476
+ # min_price: nil,
477
+ # max_price: nil,
478
+ # mls_number: 'abc1234'
479
+ # closing_price: 123456,
480
+ # closing_timestamp: Time.now.to_i,
481
+ # promote_transaction: true
482
+ # )
483
+ #
484
+ # @return [MoxiworksPlatform::BuyerTransaction]
485
+ #
486
+ # @raise ::MoxiworksPlatform::Exception::ArgumentError if required
487
+ # named parameters aren't included
488
+ #
489
+ #
490
+ def self.update(opts={})
491
+ required_opts = [:moxi_works_agent_id, :moxi_works_transaction_id]
492
+ required_opts.each do |opt|
493
+ raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
494
+ opts[opt].nil? or opts[opt].to_s.empty?
495
+ end
496
+ url = "#{MoxiworksPlatform::Config.url}/api/buyer_transactions/#{opts[:moxi_works_transaction_id]}"
497
+ self.send_request(:put, opts, url)
498
+ end
499
+
500
+
501
+ # Send our remote request to the Moxi Works Platform
502
+ #
503
+ # @param [Hash] opts named parameter Hash
504
+ # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this transaction is to be associated
505
+ # @option opts [String] :moxi_works_transaction_id *REQUIRED* The Moxi Works Platform unique ID for this transaction.
506
+ # @option opts [String] :partner_contact_id *REQUIRED* Your system's unique ID for the Contact for whom this BuyerTransaction is to be associated.
507
+ #
508
+ # optional BuyerTransaction parameters
509
+ #
510
+ # @option opts [String] :name short description of the transaction
511
+ # @option opts [String] :description longer description of the transaction
512
+ # @option opts [Integer] :due_at Unix timestamp representing the due date
513
+ # @option opts [Integer] :duration Length of time in minutes that the transaction should take
514
+ # @option opts [Integer] :completed_at Unix timestamp representing the date the transaction was completed
515
+ # @option opts [String] :status enumerated string representing transaction status
516
+ #
517
+ # @return [MoxiworksPlatform::BuyerTransaction]
518
+ #
519
+ # @raise ::MoxiworksPlatform::Exception::ArgumentError if required
520
+ # named parameters aren't included
521
+ #
522
+ def self.send_request(method, opts={}, url=nil)
523
+ raise ::MoxiworksPlatform::Exception::ArgumentError,
524
+ 'arguments must be passed as named parameters' unless opts.is_a? Hash
525
+ url ||= "#{MoxiworksPlatform::Config.url}/api/buyer_transactions"
526
+ required_opts = [:moxi_works_agent_id]
527
+ required_opts.each do |opt|
528
+ raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
529
+ opts[opt].nil? or opts[opt].to_s.empty?
530
+ end
531
+ super(method, opts, url)
532
+ end
533
+
534
+ # Save an instance of MoxiWorksPlatform::BuyerTransaction to Moxi Works Platform
535
+ #
536
+ # @return [MoxiWorksPlatform:BuyerTransaction]
537
+ #
538
+ # @example
539
+ # transaction = MoxiWorksPlatform::BuyerTransaction.new()
540
+ # transaction.moxi_works_agent_id = '1234abc'
541
+ # transaction.moxi_works_transaction_id = 'burbywurb'
542
+ # transaction.promote_transaction = true
543
+ # transaction.closing_timestamp = Time.now.to_i
544
+ # transaction.closing_price = 1234567
545
+ # transaction.save
546
+ def save
547
+ response = MoxiworksPlatform::BuyerTransaction.update(self.to_hash)
548
+ return if response.nil? or response.moxi_works_transaction_id.nil? or response.moxi_works_transaction_id.empty?
549
+ response.attributes.each {|r| self.send("#{r}=", response.send(r))}
550
+ self.promote_transaction = false
551
+ self
552
+ end
553
+
554
+ def promote
555
+ self.promote_transaction = true
556
+ self.save
557
+ end
558
+
559
+
560
+ end
561
+
562
+ end
563
+
@@ -77,7 +77,7 @@ module MoxiworksPlatform
77
77
 
78
78
  # @!attribute bathrooms_total_integer
79
79
  #
80
- # @return [Integer|nil] number partial bathrooms | nil if no data available
80
+ # @return [Integer|nil] number of rooms that are bathrooms | nil if no data available
81
81
  attr_accessor :bathrooms_total_integer
82
82
 
83
83
  # @!attribute bathrooms_three_quarter
@@ -90,7 +90,7 @@ module MoxiworksPlatform
90
90
  # @return [Integer|nil] number bathrooms | nil if no data available
91
91
  attr_accessor :bathrooms_total
92
92
 
93
- # @!attribute bedrooms
93
+ # @!attribute bedrooms_total
94
94
  #
95
95
  # @return [Integer] number of bedrooms
96
96
  attr_accessor :bedrooms_total
@@ -225,11 +225,6 @@ module MoxiworksPlatform
225
225
  # @return [Integer] square footage of the building
226
226
  attr_accessor :living_area
227
227
 
228
- # @!attribute title
229
- #
230
- # @return [String] a short description of the property
231
- attr_accessor :title
232
-
233
228
  # @!attribute view_yn
234
229
  #
235
230
  # @return [Boolean] whether the property has a view