moxiworks_platform 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/moxiworks_platform/agent.rb +6 -1
- data/lib/moxiworks_platform/buyer_transaction.rb +563 -0
- data/lib/moxiworks_platform/listing.rb +2 -7
- data/lib/moxiworks_platform/office.rb +165 -0
- data/lib/moxiworks_platform/resource.rb +5 -1
- data/lib/moxiworks_platform/seller_transaction.rb +520 -0
- data/lib/moxiworks_platform/task.rb +1 -1
- data/lib/moxiworks_platform/version.rb +1 -1
- data/lib/moxiworks_platform.rb +3 -0
- data/publish_docs.sh +26 -0
- metadata +6 -2
@@ -0,0 +1,520 @@
|
|
1
|
+
module MoxiworksPlatform
|
2
|
+
class SellerTransaction < 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 SellerTransaction 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 SellerTransaction
|
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 SellerTransaction.
|
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 SellerTransaction. 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 SellerTransaction
|
50
|
+
attr_accessor :notes
|
51
|
+
|
52
|
+
# @!attribute stage
|
53
|
+
#
|
54
|
+
# Each SellerTransaction has five stages (1-5). stage displays the
|
55
|
+
# stage number that the SellerTransaction 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 SellerTransaction stages see
|
59
|
+
# <a href='https://moxiworks-platform.github.io/#sellertransaction-stages'>The Moxi Works Platform Documentation</a>
|
60
|
+
#
|
61
|
+
# @return [Integer] the stage the SellerTransaction 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 SellerTransaction 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 SellerTransaction stages see
|
74
|
+
# <a href='https://moxiworks-platform.github.io/#sellertransaction-stages'>The Moxi Works Platform Documentation</a>
|
75
|
+
#
|
76
|
+
#
|
77
|
+
# @return [String, enumerated] current state of SellerTransaction
|
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 sqft
|
105
|
+
#
|
106
|
+
#
|
107
|
+
# @return [Integer] living area of property being sold
|
108
|
+
attr_accessor :sqft
|
109
|
+
|
110
|
+
# @!attribute beds
|
111
|
+
#
|
112
|
+
#
|
113
|
+
# @return [Integer] number of bedrooms in property being sold
|
114
|
+
attr_accessor :beds
|
115
|
+
|
116
|
+
# @!attribute baths
|
117
|
+
#
|
118
|
+
#
|
119
|
+
# @return [Float] number of bathrooms in property being sold
|
120
|
+
attr_accessor :baths
|
121
|
+
|
122
|
+
# @!attribute is_mls_transaction
|
123
|
+
#
|
124
|
+
#
|
125
|
+
# @return [Boolean] Whether the property being sold is being listed on an MLS.
|
126
|
+
attr_accessor :is_mls_transaction
|
127
|
+
|
128
|
+
# @!attribute mls_number
|
129
|
+
#
|
130
|
+
# **MLS TRANSACTIONS ONLY**
|
131
|
+
# mls number for the listing associated with this SellerTransaction
|
132
|
+
#
|
133
|
+
# -- mls_number should be populated only if is_mls_transaction is true.
|
134
|
+
#
|
135
|
+
# @return [String]
|
136
|
+
attr_accessor :mls_number
|
137
|
+
|
138
|
+
|
139
|
+
# @!attribute start_timestamp
|
140
|
+
#
|
141
|
+
# **NON MLS TRANSACTIONS ONLY ** this is the Unix timestamp
|
142
|
+
# representing the date the agent initiated transaction discussions
|
143
|
+
# with the client.
|
144
|
+
#
|
145
|
+
# @return [Integer] Unix Timestamp
|
146
|
+
attr_accessor :start_timestamp
|
147
|
+
|
148
|
+
|
149
|
+
# @!attribute commission_percentage
|
150
|
+
#
|
151
|
+
# If the agent is to receive commission based on percentage of sale
|
152
|
+
# price for the property associated with this SellerTransaction, then
|
153
|
+
# this will represent the commission that the agent is to receive.This
|
154
|
+
# should be null if the SellerTransaction uses commission_flat_fee.
|
155
|
+
#
|
156
|
+
# -- both commission_flat_fee and commission_percentage cannot be set
|
157
|
+
#
|
158
|
+
# @return [Float]
|
159
|
+
attr_accessor :commission_percentage
|
160
|
+
|
161
|
+
# @!attribute commission_flat_fee
|
162
|
+
#
|
163
|
+
# If the agent is to receive a flat-rate commission upon sale of the
|
164
|
+
# property associated with this SellerTransaction, then this will
|
165
|
+
# represent the commission that the agent is to receive. This should
|
166
|
+
# be null if the SellerTransaction uses commission_percentage.
|
167
|
+
#
|
168
|
+
# -- both commission_flat_fee and commission_percentage cannot be set
|
169
|
+
#
|
170
|
+
# @return [Integer]
|
171
|
+
attr_accessor :commission_flat_fee
|
172
|
+
|
173
|
+
|
174
|
+
# @!attribute target_price
|
175
|
+
#
|
176
|
+
# The desired selling price for the property if using target rather
|
177
|
+
# than range.
|
178
|
+
#
|
179
|
+
# -- both target_price and min_price cannot be set
|
180
|
+
# -- both target_price and max_price cannot be set
|
181
|
+
#
|
182
|
+
# @return [Integer]
|
183
|
+
attr_accessor :target_price
|
184
|
+
|
185
|
+
|
186
|
+
# @!attribute min_price
|
187
|
+
#
|
188
|
+
# The minimum price range for the property if using a price range
|
189
|
+
# rather than target price.
|
190
|
+
#
|
191
|
+
# -- both target_price and min_price cannot be set
|
192
|
+
#
|
193
|
+
# @return [Integer]
|
194
|
+
attr_accessor :min_price
|
195
|
+
|
196
|
+
|
197
|
+
# @!attribute max_price
|
198
|
+
#
|
199
|
+
# The maximum price range for the property if using a price range
|
200
|
+
# rather than target price.
|
201
|
+
#
|
202
|
+
# -- both target_price and max_price cannot be set
|
203
|
+
# @return [Integer]
|
204
|
+
attr_accessor :max_price
|
205
|
+
|
206
|
+
|
207
|
+
# @!attribute closing_price
|
208
|
+
#
|
209
|
+
# This is the closing price for the sale . This should be null if the
|
210
|
+
# SellerTransaction is not yet in complete state.
|
211
|
+
#
|
212
|
+
# @return [Integer] closing price for this SellerTransaction
|
213
|
+
attr_accessor :closing_price
|
214
|
+
|
215
|
+
|
216
|
+
# @!attribute closing_timestamp
|
217
|
+
#
|
218
|
+
# A Unix timestamp representing the point in time when the
|
219
|
+
# transaction for this SellerTransaction object was completed. This
|
220
|
+
# should be null if the SellerTransaction is not yet in stage 5 (complete) state.
|
221
|
+
#
|
222
|
+
# @return [Integer] Unix timestamp representing the date the transaction closed
|
223
|
+
attr_accessor :closing_timestamp
|
224
|
+
|
225
|
+
# @!attribute promote_transaction
|
226
|
+
#
|
227
|
+
# In order to promote a SellerTransaction to the next stage, set the
|
228
|
+
# promote_transaction attribute to true. For more information about
|
229
|
+
# SellerTransaction stages, see <a href='https://moxiworks-platform.github.io/#promoting-sellertransaction-stage>The Moxi Works Platform Documentation</a>.
|
230
|
+
# promote_transaction is only available for SellerTransaction updates.
|
231
|
+
# Newly created SellerTransaction objects will automatically be created in
|
232
|
+
# stage 3 (active)
|
233
|
+
attr_accessor :promote_transaction
|
234
|
+
|
235
|
+
|
236
|
+
#### CLASS METHODS ####
|
237
|
+
|
238
|
+
# Creates a new SellerTransaction in Moxi Works Platform
|
239
|
+
#
|
240
|
+
# @param [Hash] opts named parameter Hash
|
241
|
+
# @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this transaction is to be associated
|
242
|
+
# @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 SellerTransaction objects
|
243
|
+
# @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 SellerTransaction objects
|
244
|
+
#
|
245
|
+
# -- Either moxi_works_contact_id or partner_contact_id must be
|
246
|
+
# populated; however, you should only populate one of these attributes.
|
247
|
+
#
|
248
|
+
# optional SellerTransaction parameters
|
249
|
+
#
|
250
|
+
# @option opts [String] :name short description of the transaction meaningful to the agent
|
251
|
+
# @option opts [String] :notes human readable notes associated with the transaction meaningful to the agent
|
252
|
+
# @option opts [String] :address street address of the property associated with the transaction
|
253
|
+
# @option opts [String] :city city of the property associated with the transaction
|
254
|
+
# @option opts [String] :state state or province of the property associated with the transaction
|
255
|
+
# @option opts [String] :zip_code postal code of the property associated with the transaction
|
256
|
+
# @option opts [Integer] :sqft square feet of living area in the property being sold
|
257
|
+
# @option opts [Integer] :beds number of bedrooms in the property being sold
|
258
|
+
# @option opts [Integer or Float] :baths number of bathrooms in the property being sold
|
259
|
+
# @option opts [Boolean] :is_mls_transaction Whether the property being sold 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.
|
260
|
+
# @option opts [String] :mls_number mls number associated with the transaction -- mls_number should be populated only if is_mls_transaction is true.
|
261
|
+
# @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.
|
262
|
+
# @option opts [Float] :commission_percentage what percentage the commission is if percentage based -- A SellerTransaction can only have either commission_percentage or commission_flat_fee populated. Both can not be populated.
|
263
|
+
# @option opts [Integer] :commission_flat_fee how much the commission is if flat fee -- A SellerTransaction can only have either commission_percentage or commission_flat_fee populated. Both can not be populated.
|
264
|
+
# @option opts [Integer] :target_price target price associated with the transaction if using a target price rather than price range
|
265
|
+
# @option opts [Integer] :min_price minimum acceptable price associated with the transaction if using a price range rather than target price
|
266
|
+
# @option opts [Integer] :max_price maximum price associated with the transaction if using a price range rather than target price
|
267
|
+
#
|
268
|
+
# @example
|
269
|
+
# Resource::TechConnectGateway::SellerTransaction.create(
|
270
|
+
# agent_identifier:'testis@testomatical.com',
|
271
|
+
# moxi_works_contact_id:'deadbeef-dead-beef-bad4-feedfacebad',
|
272
|
+
# notes: 'foo deeaz',
|
273
|
+
# name: 'whateverz'
|
274
|
+
# address: '1234 there ave',
|
275
|
+
# city: 'cityville'
|
276
|
+
# state: 'provinceland',
|
277
|
+
# zip_code: '12323',
|
278
|
+
# beds: 12,
|
279
|
+
# baths: 34.5,
|
280
|
+
# sqft: 12345,
|
281
|
+
# is_mls_transaction: true,
|
282
|
+
# commission_flat_fee: nil,
|
283
|
+
# commission_percentage: 12.34,
|
284
|
+
# target_price: 12345,
|
285
|
+
# min_price: nil,
|
286
|
+
# max_price: nil,
|
287
|
+
# mls_number: 'abc1234'
|
288
|
+
# )
|
289
|
+
#
|
290
|
+
# @return [MoxiworksPlatform::SellerTransaction]
|
291
|
+
#
|
292
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
293
|
+
# named parameters aren't included
|
294
|
+
#
|
295
|
+
#
|
296
|
+
def self.create(opts={})
|
297
|
+
required_opts = [:moxi_works_agent_id]
|
298
|
+
required_opts.each do |opt|
|
299
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
300
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
301
|
+
end
|
302
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError,
|
303
|
+
'moxi_works_contact_id or partner_contact_id required' unless
|
304
|
+
(opts.include?(:moxi_works_contact_id) or opts.include?(:partner_contact_id))
|
305
|
+
self.send_request(:post, opts)
|
306
|
+
end
|
307
|
+
|
308
|
+
# Find a SellerTransaction using The Moxi Works Platform
|
309
|
+
# @param [Hash] opts named parameter Hash
|
310
|
+
# @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this transaction is associated
|
311
|
+
# @option opts [String] :moxi_works_transaction_id *REQUIRED* The Moxi Works Platform ID for this transaction.
|
312
|
+
#
|
313
|
+
# @return [MoxiworksPlatform::SellerTransaction]
|
314
|
+
#
|
315
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
316
|
+
# named parameters aren't included
|
317
|
+
#
|
318
|
+
def self.find(opts={})
|
319
|
+
required_opts = [:moxi_works_agent_id, :moxi_works_transaction_id]
|
320
|
+
required_opts.each do |opt|
|
321
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
322
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
323
|
+
end
|
324
|
+
url = "#{MoxiworksPlatform::Config.url}/api/seller_transactions/#{opts[:moxi_works_transaction_id]}"
|
325
|
+
self.send_request(:get, opts, url)
|
326
|
+
end
|
327
|
+
|
328
|
+
|
329
|
+
# Search Agent's SellerTransactions in Moxi Works Platform
|
330
|
+
#
|
331
|
+
# @param [Hash] opts named parameter Hash
|
332
|
+
# @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this contact is associated
|
333
|
+
#
|
334
|
+
#
|
335
|
+
# optional Search parameters
|
336
|
+
#
|
337
|
+
# @option opts [String] :moxi_works_contact_id The Moxi Works Contact ID for the contact whose SellerTransactions you are searching for
|
338
|
+
# @option opts [String] :partner_contact_id The partner's ID for the contact whose SellerTransactions they are looking for
|
339
|
+
# @option opts [Integer] :page_number the page of results to return
|
340
|
+
#
|
341
|
+
# @return [Hash] with the format:
|
342
|
+
# {
|
343
|
+
# page_number: [Integer],
|
344
|
+
# total_pages: [Integer],
|
345
|
+
# transactions: [Array] containing MoxiworkPlatform::SellerTransaction objects
|
346
|
+
# }
|
347
|
+
#
|
348
|
+
#
|
349
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
350
|
+
# named parameters aren't included
|
351
|
+
#
|
352
|
+
# @example
|
353
|
+
# results = MoxiworksPlatform::Transaction.search(
|
354
|
+
# moxi_works_agent_id: '123abc',
|
355
|
+
# page_number: 2
|
356
|
+
# )
|
357
|
+
#
|
358
|
+
def self.search(opts={})
|
359
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError,
|
360
|
+
'arguments must be passed as named parameters' unless opts.is_a? Hash
|
361
|
+
url ||= "#{MoxiworksPlatform::Config.url}/api/seller_transactions"
|
362
|
+
required_opts = [:moxi_works_agent_id]
|
363
|
+
required_opts.each do |opt|
|
364
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
365
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
366
|
+
end
|
367
|
+
results = []
|
368
|
+
json = { 'page_number': 1, 'total_pages': 0, 'transactions':[]}
|
369
|
+
RestClient::Request.execute(method: :get,
|
370
|
+
url: url,
|
371
|
+
payload: opts, headers: self.headers) do |response|
|
372
|
+
puts response if MoxiworksPlatform::Config.debug
|
373
|
+
self.check_for_error_in_response(response)
|
374
|
+
json = JSON.parse(response)
|
375
|
+
json['transactions'].each do |r|
|
376
|
+
results << MoxiworksPlatform::SellerTransaction.new(r) unless r.nil? or r.empty?
|
377
|
+
end
|
378
|
+
json['transactions'] = results
|
379
|
+
end
|
380
|
+
json
|
381
|
+
end
|
382
|
+
|
383
|
+
|
384
|
+
# Updates an existing SellerTransaction in Leads Gateway
|
385
|
+
#
|
386
|
+
# @param [Hash] opts named parameter Hash
|
387
|
+
# @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this transaction is associated
|
388
|
+
# @option opts [String] :moxi_works_transaction_id *REQUIRED* partner system's unique ID for this transaction.
|
389
|
+
#
|
390
|
+
# optional SellerTransaction parameters
|
391
|
+
#
|
392
|
+
# @option opts [String] :name short description of the transaction meaningful to the agent
|
393
|
+
# @option opts [String] :notes human readable notes associated with the transaction meaningful to the agent
|
394
|
+
# @option opts [String] :address street address of the property associated with the transaction
|
395
|
+
# @option opts [String] :city city of the property associated with the transaction
|
396
|
+
# @option opts [String] :state state or province of the property associated with the transaction
|
397
|
+
# @option opts [String] :zip_code postal code of the property associated with the transaction
|
398
|
+
# @option opts [Integer] :sqft square feet of living area in the property being sold
|
399
|
+
# @option opts [Integer] :beds number of bedrooms in the property being sold
|
400
|
+
# @option opts [Integer or Float] :baths number of bathrooms in the property being sold
|
401
|
+
# @option opts [Boolean] :is_mls_transaction Whether the property being sold 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.
|
402
|
+
# @option opts [String] :mls_number mls number associated with the transaction -- mls_number should be populated only if is_mls_transaction is true.
|
403
|
+
# @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.
|
404
|
+
# @option opts [Float] :commission_percentage what percentage the commission is if percentage based -- A SellerTransaction can only have either commission_percentage or commission_flat_fee populated. Both can not be populated.
|
405
|
+
# @option opts [Integer] :commission_flat_fee how much the commission is if flat fee -- A SellerTransaction can only have either commission_percentage or commission_flat_fee populated. Both can not be populated.
|
406
|
+
# @option opts [Integer] :target_price target price associated with the transaction if using a target price rather than price range
|
407
|
+
# @option opts [Integer] :min_price minimum acceptable price associated with the transaction if using a price range rather than target price
|
408
|
+
# @option opts [Integer] :max_price maximum price associated with the transaction if using a price range rather than target price
|
409
|
+
# @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)
|
410
|
+
# @option opts [Integer] :closing_price selling price of the property -- closing_price should only be used when the SellerTransaction state = 5 (complete)
|
411
|
+
# @option opts [Boolean] :promote_transaction If this is set to true then The Moxi Works Platform will promote this transaction to the next stage
|
412
|
+
#
|
413
|
+
#
|
414
|
+
# @example
|
415
|
+
# Resource::TechConnectGateway::SellerTransaction.update(
|
416
|
+
# agent_identifier:'testis@testomatical.com',
|
417
|
+
# moxi_works_transaction_id:'deadbeef-dead-beef-bad4-feedfacebad',
|
418
|
+
# notes: 'foo deeaz',
|
419
|
+
# name: 'whateverz'
|
420
|
+
# address: '1234 there ave',
|
421
|
+
# city: 'cityville'
|
422
|
+
# state: 'provinceland',
|
423
|
+
# zip_code: '12323',
|
424
|
+
# beds: 12,
|
425
|
+
# baths: 34.5,
|
426
|
+
# sqft: 12345,
|
427
|
+
# is_mls_transaction: true,
|
428
|
+
# commission_flat_fee: nil,
|
429
|
+
# commission_percentage: 12.34,
|
430
|
+
# target_price: 12345,
|
431
|
+
# min_price: nil,
|
432
|
+
# max_price: nil,
|
433
|
+
# mls_number: 'abc1234',
|
434
|
+
# closing_price: 123456,
|
435
|
+
# closing_timestamp: Time.now.to_i,
|
436
|
+
# promote_transaction: true
|
437
|
+
# )
|
438
|
+
#
|
439
|
+
# @return [MoxiworksPlatform::Transaction]
|
440
|
+
#
|
441
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
442
|
+
# named parameters aren't included
|
443
|
+
#
|
444
|
+
#
|
445
|
+
def self.update(opts={})
|
446
|
+
required_opts = [:moxi_works_agent_id, :moxi_works_transaction_id]
|
447
|
+
required_opts.each do |opt|
|
448
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
449
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
450
|
+
end
|
451
|
+
url = "#{MoxiworksPlatform::Config.url}/api/seller_transactions/#{opts[:moxi_works_transaction_id]}"
|
452
|
+
self.send_request(:put, opts, url)
|
453
|
+
end
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
# Send our remote request to the Moxi Works Platform
|
458
|
+
#
|
459
|
+
# @param [Hash] opts named parameter Hash
|
460
|
+
# @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this transaction is to be associated
|
461
|
+
# @option opts [String] :moxi_works_transaction_id *REQUIRED* The Moxi Works Platform unique ID for this transaction.
|
462
|
+
# @option opts [String] :partner_contact_id *REQUIRED* Your system's unique ID for the Contact for whom this SellerTransaction is to be associated.
|
463
|
+
#
|
464
|
+
# optional SellerTransaction parameters
|
465
|
+
#
|
466
|
+
# @option opts [String] :name short description of the transaction
|
467
|
+
# @option opts [String] :description longer description of the transaction
|
468
|
+
# @option opts [Integer] :due_at Unix timestamp representing the due date
|
469
|
+
# @option opts [Integer] :duration Length of time in minutes that the transaction should take
|
470
|
+
# @option opts [Integer] :completed_at Unix timestamp representing the date the transaction was completed
|
471
|
+
# @option opts [String] :status enumerated string representing transaction status
|
472
|
+
#
|
473
|
+
# @return [MoxiworksPlatform::Transaction]
|
474
|
+
#
|
475
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
476
|
+
# named parameters aren't included
|
477
|
+
#
|
478
|
+
def self.send_request(method, opts={}, url=nil)
|
479
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError,
|
480
|
+
'arguments must be passed as named parameters' unless opts.is_a? Hash
|
481
|
+
url ||= "#{MoxiworksPlatform::Config.url}/api/seller_transactions"
|
482
|
+
required_opts = [:moxi_works_agent_id]
|
483
|
+
required_opts.each do |opt|
|
484
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
485
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
486
|
+
end
|
487
|
+
super(method, opts, url)
|
488
|
+
end
|
489
|
+
|
490
|
+
# Save an instance of MoxiWorksPlatform::SellerTransaction to Moxi Works Platform
|
491
|
+
#
|
492
|
+
# @return [MoxiWorksPlatform:SellerTransaction]
|
493
|
+
#
|
494
|
+
# @example
|
495
|
+
# transaction = MoxiWorksPlatform::SellerTransaction.new()
|
496
|
+
# transaction.moxi_works_agent_id = '1234abc'
|
497
|
+
# transaction.moxi_works_transaction_id = 'burbywurb'
|
498
|
+
# transaction.promote_transaction = true
|
499
|
+
# transaction.closing_timestamp = Time.now.to_i
|
500
|
+
# transaction.closing_price = 1234567
|
501
|
+
# transaction.save
|
502
|
+
def save
|
503
|
+
response = MoxiworksPlatform::SellerTransaction.update(self.to_hash)
|
504
|
+
return if response.nil? or response.moxi_works_transaction_id.nil? or response.moxi_works_transaction_id.empty?
|
505
|
+
response.attributes.each {|r| self.send("#{r}=", response.send(r))}
|
506
|
+
self.promote_transaction = false
|
507
|
+
self
|
508
|
+
end
|
509
|
+
|
510
|
+
def promote
|
511
|
+
self.promote_transaction = true
|
512
|
+
self.save
|
513
|
+
end
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
end
|
518
|
+
|
519
|
+
end
|
520
|
+
|
@@ -164,7 +164,7 @@ module MoxiworksPlatform
|
|
164
164
|
# named parameters aren't included
|
165
165
|
#
|
166
166
|
# @example
|
167
|
-
# results = MoxiworksPlatform::
|
167
|
+
# results = MoxiworksPlatform::Task.search(
|
168
168
|
# moxi_works_agent_id: '123abc',
|
169
169
|
# due_date_start: Time.now.to_i - 1296000,
|
170
170
|
# due_date_end: Time.now.to_i,
|
data/lib/moxiworks_platform.rb
CHANGED
@@ -12,6 +12,9 @@ require 'moxiworks_platform/task'
|
|
12
12
|
require 'moxiworks_platform/email_campaign'
|
13
13
|
require 'moxiworks_platform/company'
|
14
14
|
require 'moxiworks_platform/listing'
|
15
|
+
require 'moxiworks_platform/office'
|
16
|
+
require 'moxiworks_platform/buyer_transaction'
|
17
|
+
require 'moxiworks_platform/seller_transaction'
|
15
18
|
|
16
19
|
|
17
20
|
module MoxiworksPlatform
|
data/publish_docs.sh
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
mv doc /tmp/doc/
|
4
|
+
|
5
|
+
git checkout master
|
6
|
+
|
7
|
+
yard doc
|
8
|
+
|
9
|
+
git checkout gh-pages
|
10
|
+
|
11
|
+
cd doc
|
12
|
+
|
13
|
+
for i in `ls`
|
14
|
+
do
|
15
|
+
mv ../$i /tmp/$i
|
16
|
+
mv $i ../$i
|
17
|
+
done
|
18
|
+
|
19
|
+
cd -
|
20
|
+
git add MoxiworksPlatform
|
21
|
+
|
22
|
+
git commit -a -m "Documentation Update"
|
23
|
+
|
24
|
+
git checkout master
|
25
|
+
|
26
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moxiworks_platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tres Wong-Godfrey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/moxiworks_platform.rb
|
86
86
|
- lib/moxiworks_platform/action_log.rb
|
87
87
|
- lib/moxiworks_platform/agent.rb
|
88
|
+
- lib/moxiworks_platform/buyer_transaction.rb
|
88
89
|
- lib/moxiworks_platform/company.rb
|
89
90
|
- lib/moxiworks_platform/config.rb
|
90
91
|
- lib/moxiworks_platform/contact.rb
|
@@ -94,10 +95,13 @@ files:
|
|
94
95
|
- lib/moxiworks_platform/exception.rb
|
95
96
|
- lib/moxiworks_platform/group.rb
|
96
97
|
- lib/moxiworks_platform/listing.rb
|
98
|
+
- lib/moxiworks_platform/office.rb
|
97
99
|
- lib/moxiworks_platform/resource.rb
|
100
|
+
- lib/moxiworks_platform/seller_transaction.rb
|
98
101
|
- lib/moxiworks_platform/task.rb
|
99
102
|
- lib/moxiworks_platform/version.rb
|
100
103
|
- moxiworks_platform.gemspec
|
104
|
+
- publish_docs.sh
|
101
105
|
homepage: https://github.com/moxiworks-platform/moxiworks-ruby
|
102
106
|
licenses: []
|
103
107
|
metadata: {}
|