moxiworks_platform 0.11.3 → 0.12.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/lib/moxiworks_platform.rb +5 -0
- data/lib/moxiworks_platform/agent.rb +8 -3
- data/lib/moxiworks_platform/gallery.rb +107 -0
- data/lib/moxiworks_platform/presentation_log.rb +158 -0
- data/lib/moxiworks_platform/sold_listing.rb +409 -0
- data/lib/moxiworks_platform/team.rb +208 -0
- data/lib/moxiworks_platform/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec4c41788c2815f64aab1734e99120f0df9ed25e
|
4
|
+
data.tar.gz: 57eb6780ceebce6f9b9b79a350906c00cec174bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ba19076c5f10ba8e819a895d2b0a5b6bc60cd86f369fbe6fb40ec056a0126a9e059c8bf2d6991277f2b589661ed2673413ccbe7b57dea559c4f7f01a1c077d8
|
7
|
+
data.tar.gz: 39828052e7381fe31b5b9037511c681dc592c90eee9af97817f22f6131e18981d4afb277c8f5721643a6117956d3f72f71f155bf22ebdbbabf5c4865a1ee2d5f
|
data/lib/moxiworks_platform.rb
CHANGED
@@ -17,6 +17,11 @@ require 'moxiworks_platform/office'
|
|
17
17
|
require 'moxiworks_platform/buyer_transaction'
|
18
18
|
require 'moxiworks_platform/seller_transaction'
|
19
19
|
require 'moxiworks_platform/brand'
|
20
|
+
require 'moxiworks_platform/gallery'
|
21
|
+
require 'moxiworks_platform/presentation_log'
|
22
|
+
require 'moxiworks_platform/sold_listing'
|
23
|
+
require 'moxiworks_platform/team'
|
24
|
+
|
20
25
|
|
21
26
|
|
22
27
|
module MoxiworksPlatform
|
@@ -158,7 +158,8 @@ module MoxiworksPlatform
|
|
158
158
|
|
159
159
|
# Find an Agent on the Moxi Works Platform
|
160
160
|
# @param [Hash] opts named parameter Hash
|
161
|
-
# @option opts [String] :moxi_works_agent_id
|
161
|
+
# @option opts [String] :moxi_works_agent_id *REQUIRED* -- either :moxi_works_agent_id or :agent_uuid is required -- The Moxi Works Agent ID for the agent
|
162
|
+
# @option opts [String] :agent_uuid *REQUIRED* -- either :moxi_works_agent_id or :agent_uuid is required -- The Moxi Works Agent ID for the agent
|
162
163
|
#
|
163
164
|
# @return [MoxiworksPlatform::Agent]
|
164
165
|
#
|
@@ -166,13 +167,17 @@ module MoxiworksPlatform
|
|
166
167
|
# named parameters aren't included
|
167
168
|
#
|
168
169
|
def self.find(opts={})
|
169
|
-
|
170
|
+
agent_identifier = opts[:agent_uuid] unless(opts[:agent_uuid].nil? or opts[:agent_uuid].empty?)
|
171
|
+
agent_identifier ||= opts[:moxi_works_agent_id] unless(opts[:moxi_works_agent_id].nil? or opts[:moxi_works_agent_id].empty?)
|
172
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#agent_uuid or moxi_works_agent_id required" if
|
173
|
+
agent_identifier.nil?
|
174
|
+
url = "#{MoxiworksPlatform::Config.url}/api/agents/#{agent_identifier}"
|
170
175
|
self.send_request(:get, opts, url)
|
171
176
|
end
|
172
177
|
|
173
178
|
def self.send_request(method, opts={}, url=nil)
|
174
179
|
url ||= "#{MoxiworksPlatform::Config.url}/api/agents"
|
175
|
-
required_opts = [:
|
180
|
+
required_opts = [:moxi_works_company_id]
|
176
181
|
raise ::MoxiworksPlatform::Exception::ArgumentError,
|
177
182
|
'arguments must be passed as named parameters' unless opts.is_a? Hash
|
178
183
|
required_opts.each do |opt|
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module MoxiworksPlatform
|
2
|
+
# = Moxi Works Platform Gallery
|
3
|
+
class Gallery < MoxiworksPlatform::Resource
|
4
|
+
|
5
|
+
# @!attribute list_office_aor
|
6
|
+
#
|
7
|
+
# @return [String] MLS the listing is listed with
|
8
|
+
attr_accessor :list_office_aor
|
9
|
+
|
10
|
+
# @!attribute listing_id
|
11
|
+
#
|
12
|
+
# @return [String] the mls number associated with the listing
|
13
|
+
attr_accessor :listing_id
|
14
|
+
|
15
|
+
|
16
|
+
# @!attribute listing_images
|
17
|
+
#
|
18
|
+
# @return [Array] array of image Hashes in the format
|
19
|
+
# {
|
20
|
+
# thumb_url: [String] url to thumbail size image (smallest),
|
21
|
+
# small_url: [String] url to small size image (small),
|
22
|
+
# full_url: [String] url to full size image (medium),
|
23
|
+
# gallery_url: [String] url to gallery size image (large),
|
24
|
+
# raw_url: [String] url to raw image (largest)
|
25
|
+
# title: [String] human readable title of image
|
26
|
+
# is_main_listing_image: [Boolean] whether the image is the main image for the listing
|
27
|
+
# caption: [String] human readable caption for the image
|
28
|
+
# description: [String] human readable description of the image
|
29
|
+
# width: [Integer] width of the raw image
|
30
|
+
# height: [Integer] height of the raw image
|
31
|
+
# mime_type: [String] MIME or media type of the image
|
32
|
+
#
|
33
|
+
# }
|
34
|
+
attr_accessor :gallery_images
|
35
|
+
|
36
|
+
|
37
|
+
# Search For Galleries in Moxi Works Platform
|
38
|
+
# @param [Hash] opts named parameter Hash
|
39
|
+
# @option opts [String] :moxi_works_company_id *REQUIRED* The Moxi Works Company ID For the search (use Company.search to determine available moxi_works_company_id)
|
40
|
+
# @option opts [String] :moxi_works_agent_id The Moxi Works Agent ID For the search (use Agent.search to determine available moxi_works_agent_id) -- only agent_uuid or moxi_works_agent_id are needed when searching for galleries by agent
|
41
|
+
# @option opts [String] :agent_uuid The Agent UUID For the search (use Agent.search to determine available agent_uuid) -- only agent_uuid or moxi_works_agent_id are needed when searching for galleries by agent
|
42
|
+
#
|
43
|
+
#
|
44
|
+
# optional Search parameters
|
45
|
+
#
|
46
|
+
#
|
47
|
+
# @return [Hash] with the format:
|
48
|
+
# {
|
49
|
+
# last_page: [Boolean],
|
50
|
+
# galleries: [Array] containing MoxiworkPlatform::Gallery objects
|
51
|
+
# }
|
52
|
+
#
|
53
|
+
#
|
54
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
55
|
+
# named parameters aren't included
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
# results = MoxiworksPlatform::Gallery.search(
|
59
|
+
# moxi_works_company_id: 'the_company',
|
60
|
+
# moxi_works_agent_id: 'abc123'
|
61
|
+
# )
|
62
|
+
#
|
63
|
+
#
|
64
|
+
# @block |Array|
|
65
|
+
# if you pass a block with the logic you want to perform on all galleries,
|
66
|
+
# you can have all galleries processed in a single call
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# MoxiworksPlatform::Gallery.search(
|
70
|
+
# moxi_works_company_id: 'the_company',
|
71
|
+
# moxi_works_agent_id: 'abc123'
|
72
|
+
# agent_uuid: 'abc123') { |galleries| puts galleries.count }
|
73
|
+
#
|
74
|
+
def self.find(opts={})
|
75
|
+
required_opts = [:moxi_works_company_id]
|
76
|
+
required_opts.each do |opt|
|
77
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
78
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
79
|
+
end
|
80
|
+
agent_identifier = opts[:agent_uuid] unless(opts[:agent_uuid].nil? or opts[:agent_uuid].empty?)
|
81
|
+
agent_identifier ||= opts[:moxi_works_agent_id] unless(opts[:moxi_works_agent_id].nil? or opts[:moxi_works_agent_id].empty?)
|
82
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#agent_uuid or moxi_works_agent_id required" if
|
83
|
+
agent_identifier.nil?
|
84
|
+
|
85
|
+
url = "#{MoxiworksPlatform::Config.url}/api/galleries/#{agent_identifier}"
|
86
|
+
|
87
|
+
results = []
|
88
|
+
json = {'galleries': []}
|
89
|
+
RestClient::Request.execute(method: :get,
|
90
|
+
url: url,
|
91
|
+
payload: opts, headers: self.headers) do |response|
|
92
|
+
puts response if MoxiworksPlatform::Config.debug
|
93
|
+
self.check_for_error_in_response(response)
|
94
|
+
json = JSON.parse(response)
|
95
|
+
json = self.underscore_attribute_names json
|
96
|
+
json['galleries'].each do |r|
|
97
|
+
results << MoxiworksPlatform::Gallery.new(r) unless r.nil? or r.empty?
|
98
|
+
end
|
99
|
+
json['galleries'] = results
|
100
|
+
end
|
101
|
+
if block_given?
|
102
|
+
yield(json['galleries'])
|
103
|
+
end
|
104
|
+
json
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
module MoxiworksPlatform
|
2
|
+
# = Moxi Works Platform PresentationLog
|
3
|
+
class PresentationLog < MoxiworksPlatform::Resource
|
4
|
+
|
5
|
+
# @!attribute agent_uuid
|
6
|
+
#
|
7
|
+
# @return [string] This is the Moxi Works Platform ID of the presentation_log which an ActionLog entry is associated with. This will be an RFC 4122 compliant UUID.
|
8
|
+
#
|
9
|
+
attr_accessor :agent_uuid
|
10
|
+
|
11
|
+
# @!attribute agent_fname
|
12
|
+
#
|
13
|
+
# @return [string] First name of agent. This can be null if there is no data for this attribute.
|
14
|
+
#
|
15
|
+
attr_accessor :agent_fname
|
16
|
+
|
17
|
+
|
18
|
+
# @!attribute agent_lname
|
19
|
+
#
|
20
|
+
# @return [string] Last name of agent. This can be null if there is no data for this attribute.
|
21
|
+
#
|
22
|
+
attr_accessor :agent_lname
|
23
|
+
|
24
|
+
|
25
|
+
# @!attribute title
|
26
|
+
#
|
27
|
+
# @return [string] The title of the presentation. This can be null if there is no data for this attribute.
|
28
|
+
#
|
29
|
+
attr_accessor :title
|
30
|
+
|
31
|
+
|
32
|
+
# @!attribute created
|
33
|
+
#
|
34
|
+
# @return [string] This is the Unix timestamp for the creation time of the presentation.
|
35
|
+
#
|
36
|
+
attr_accessor :created
|
37
|
+
|
38
|
+
|
39
|
+
# @!attribute edited
|
40
|
+
#
|
41
|
+
# @return [string] This is the Unix timestamp for the last time the presentation was edited.
|
42
|
+
#
|
43
|
+
attr_accessor :edited
|
44
|
+
|
45
|
+
|
46
|
+
# @!attribute agent_office_id
|
47
|
+
#
|
48
|
+
# @return [string] This is the ID of the office for the Agent associated with the presentation. This will be an integer.
|
49
|
+
#
|
50
|
+
attr_accessor :agent_office_id
|
51
|
+
|
52
|
+
|
53
|
+
# @!attribute type
|
54
|
+
#
|
55
|
+
# @return [string] Whether the presentation is for a buyer or seller.
|
56
|
+
#
|
57
|
+
attr_accessor :type
|
58
|
+
|
59
|
+
|
60
|
+
# @!attribute sent_by_agent
|
61
|
+
#
|
62
|
+
# @return [string] The UUID of the agent that sent the presentation to the client. This will be an RFC 4122 compliant UUID.
|
63
|
+
#
|
64
|
+
attr_accessor :sent_by_agent
|
65
|
+
|
66
|
+
|
67
|
+
# @!attribute pdf_requested
|
68
|
+
#
|
69
|
+
# @return [string] The number of PDF documents requested.
|
70
|
+
#
|
71
|
+
attr_accessor :pdf_requested
|
72
|
+
|
73
|
+
|
74
|
+
# @!attribute pres_requested
|
75
|
+
#
|
76
|
+
# @return [string] The number of Online presentations requested.
|
77
|
+
#
|
78
|
+
attr_accessor :pres_requested
|
79
|
+
|
80
|
+
|
81
|
+
# @!attribute external_identifier
|
82
|
+
#
|
83
|
+
# @return [string] This is the ID of the Agent utilized by their company.
|
84
|
+
#
|
85
|
+
attr_accessor :external_identifier
|
86
|
+
|
87
|
+
|
88
|
+
# @!attribute external_office_id
|
89
|
+
#
|
90
|
+
# @return [string] This is the ID of the office for this Agent utilized by their company.
|
91
|
+
#
|
92
|
+
attr_accessor :external_office_id
|
93
|
+
|
94
|
+
|
95
|
+
# @!attribute moxi_works_presentation_id
|
96
|
+
#
|
97
|
+
# @return [string] The unique UUID of the presentation. This will be an RFC 4122 compliant UUID.
|
98
|
+
#
|
99
|
+
attr_accessor :moxi_works_presentation_id
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
# Search For Agents in Moxi Works Platform
|
104
|
+
# @param [Hash] opts named parameter Hash
|
105
|
+
# @option opts [String] :moxi_works_company_id *REQUIRED* The Moxi Works Company ID For the search (use Company.search to determine available moxi_works_company_id)
|
106
|
+
#
|
107
|
+
#
|
108
|
+
# optional Search parameters
|
109
|
+
#
|
110
|
+
# @option opts [Integer] :updated_after Unix timestamp representing the start time for the search. If no updated_after parameter is included in the request, only presentations updated in the last seven days will be included in the response.
|
111
|
+
# @option opts [Integer] :updated_before Unix timestamp representing the end time for the search. If no updated_before parameter is included in the request, only presentations updated in the seven days following updated_after will be included in the response.
|
112
|
+
# @option opts [Integer] :created_after Unix timestamp representing the start time for the search.
|
113
|
+
# @option opts [Integer] :created_after Unix timestamp representing the end time for the search. If no created_before parameter is included in the request, only presentations updated in the seven days following created_after will be included in the response.
|
114
|
+
#
|
115
|
+
# @return [Hash] with the format:
|
116
|
+
# {
|
117
|
+
# presentations: [Array] containing MoxiworkPlatform::PresentationLog objects
|
118
|
+
# }
|
119
|
+
#
|
120
|
+
#
|
121
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
122
|
+
# named parameters aren't included
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# results = MoxiworksPlatform::PresentationLog.search(
|
126
|
+
# moxi_works_company_id: 'the_company',
|
127
|
+
# updated_after: Time.now.to_i - 1296000,
|
128
|
+
# )
|
129
|
+
#
|
130
|
+
def self.search(opts={})
|
131
|
+
url ||= "#{MoxiworksPlatform::Config.url}/api/presentation_logs"
|
132
|
+
required_opts = [:moxi_works_company_id]
|
133
|
+
required_opts.each do |opt|
|
134
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
135
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
results = []
|
140
|
+
json = { 'presentations':[]}
|
141
|
+
RestClient::Request.execute(method: :get,
|
142
|
+
url: url,
|
143
|
+
payload: opts, headers: self.headers) do |response|
|
144
|
+
puts response if MoxiworksPlatform::Config.debug
|
145
|
+
self.check_for_error_in_response(response)
|
146
|
+
json = JSON.parse(response)
|
147
|
+
json['presentations'].each do |r|
|
148
|
+
results << MoxiworksPlatform::PresentationLog.new(r) unless r.nil? or r.empty?
|
149
|
+
end
|
150
|
+
json['presentations'] = results
|
151
|
+
end
|
152
|
+
json
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,409 @@
|
|
1
|
+
module MoxiworksPlatform
|
2
|
+
# = Moxi Works Platform Listing
|
3
|
+
class SoldListing < MoxiworksPlatform::Resource
|
4
|
+
|
5
|
+
# @!attribute address
|
6
|
+
#
|
7
|
+
# @return [String] street address of property
|
8
|
+
attr_accessor :address
|
9
|
+
|
10
|
+
# @!attribute address2
|
11
|
+
#
|
12
|
+
# @return [String] a second line for street address if needed
|
13
|
+
attr_accessor :address2
|
14
|
+
|
15
|
+
# @!attribute agent_created_listing
|
16
|
+
#
|
17
|
+
# @return [Boolean] whether the agent created the listing
|
18
|
+
attr_accessor :agent_created_listing
|
19
|
+
|
20
|
+
# @!attribute association_fee
|
21
|
+
#
|
22
|
+
# @return [Integer] HOA fees for property
|
23
|
+
attr_accessor :association_fee
|
24
|
+
|
25
|
+
# @!attribute bathrooms_full
|
26
|
+
#
|
27
|
+
# @return [Integer|nil] number full bathrooms | nil if no data available
|
28
|
+
attr_accessor :bathrooms_full
|
29
|
+
|
30
|
+
# @!attribute bathrooms_half
|
31
|
+
#
|
32
|
+
# @return [Integer|nil] number half bathrooms | nil if no data available
|
33
|
+
attr_accessor :bathrooms_half
|
34
|
+
|
35
|
+
# @!attribute bathrooms_one_quarter
|
36
|
+
#
|
37
|
+
# @return [Integer|nil] number quarter bathrooms | nil if no data available
|
38
|
+
attr_accessor :bathrooms_one_quarter
|
39
|
+
|
40
|
+
# @!attribute bathrooms_partial
|
41
|
+
#
|
42
|
+
# @return [Integer|nil] number partial bathrooms | nil if no data available
|
43
|
+
attr_accessor :bathrooms_partial
|
44
|
+
|
45
|
+
# @!attribute bathrooms_total_integer
|
46
|
+
#
|
47
|
+
# @return [Integer|nil] number of rooms that are bathrooms | nil if no data available
|
48
|
+
attr_accessor :bathrooms_total_integer
|
49
|
+
|
50
|
+
# @!attribute bathrooms_three_quarter
|
51
|
+
#
|
52
|
+
# @return [Integer|nil] number three-quarter bathrooms | nil if no data available
|
53
|
+
attr_accessor :bathrooms_three_quarter
|
54
|
+
|
55
|
+
# @!attribute bathrooms_total
|
56
|
+
#
|
57
|
+
# @return [Integer|nil] number bathrooms | nil if no data available
|
58
|
+
attr_accessor :bathrooms_total
|
59
|
+
|
60
|
+
# @!attribute bedrooms_total
|
61
|
+
#
|
62
|
+
# @return [Integer] number of bedrooms
|
63
|
+
attr_accessor :bedrooms_total
|
64
|
+
|
65
|
+
# @!attribute city
|
66
|
+
#
|
67
|
+
# @return [String] city of property address
|
68
|
+
attr_accessor :city
|
69
|
+
|
70
|
+
# @!attribute county_or_parish
|
71
|
+
#
|
72
|
+
# @return [String] county of property address
|
73
|
+
attr_accessor :county_or_parish
|
74
|
+
|
75
|
+
# @!attribute created_date
|
76
|
+
#
|
77
|
+
# @return [String] string representing date in format 'MM/DD/YYYY'
|
78
|
+
attr_accessor :created_date
|
79
|
+
|
80
|
+
# @!attribute days_on_market
|
81
|
+
#
|
82
|
+
# @return [Integer] days listing has been on market
|
83
|
+
attr_accessor :days_on_market
|
84
|
+
|
85
|
+
# @!attribute elementary_school
|
86
|
+
#
|
87
|
+
# @return [String] elementary school for the property
|
88
|
+
attr_accessor :elementary_school
|
89
|
+
|
90
|
+
# @!attribute garage_spaces
|
91
|
+
#
|
92
|
+
# @return [Integer] garage spaces for the property
|
93
|
+
attr_accessor :garage_spaces
|
94
|
+
|
95
|
+
# @!attribute high_school
|
96
|
+
#
|
97
|
+
# @return [String] High school for property
|
98
|
+
attr_accessor :high_school
|
99
|
+
|
100
|
+
# @!attribute internet_address_display_yn
|
101
|
+
#
|
102
|
+
# @return [Boolean] whether to display the address publicly
|
103
|
+
attr_accessor :internet_address_display_yn
|
104
|
+
|
105
|
+
# @!attribute internet_entire_listing_display_yn
|
106
|
+
#
|
107
|
+
# @return [Boolean] whether to display listing on internet
|
108
|
+
attr_accessor :internet_entire_listing_display_yn
|
109
|
+
|
110
|
+
# @!attribute latitude
|
111
|
+
#
|
112
|
+
# @return [String] latitude of the property
|
113
|
+
attr_accessor :latitude
|
114
|
+
|
115
|
+
# @!attribute list_agent_full_name
|
116
|
+
#
|
117
|
+
# @return [String] name of listing agent
|
118
|
+
attr_accessor :list_agent_full_name
|
119
|
+
|
120
|
+
# @!attribute list_office_name
|
121
|
+
#
|
122
|
+
# @return [String] name office responsible for listing
|
123
|
+
attr_accessor :list_office_name
|
124
|
+
|
125
|
+
# @!attribute list_price
|
126
|
+
#
|
127
|
+
# @return [Integer] listed price
|
128
|
+
attr_accessor :list_price
|
129
|
+
|
130
|
+
# @!attribute list_office_aor
|
131
|
+
#
|
132
|
+
# @return [String] MLS the listing is listed with
|
133
|
+
attr_accessor :list_office_aor
|
134
|
+
|
135
|
+
# @!attribute listing_contract_date
|
136
|
+
#
|
137
|
+
# @return [String] string representing date in format 'MM/DD/YYYY'
|
138
|
+
attr_accessor :listing_contract_date
|
139
|
+
|
140
|
+
# @!attribute listing_id
|
141
|
+
#
|
142
|
+
# @return [String] the mls number associated with the listing
|
143
|
+
attr_accessor :listing_id
|
144
|
+
|
145
|
+
# @!attribute listing_images
|
146
|
+
#
|
147
|
+
# @return [Array] array of image Hashes in the format
|
148
|
+
# {
|
149
|
+
# thumb_url: [String] url to thumbail size image (smallest),
|
150
|
+
# small_url: [String] url to small size image (small),
|
151
|
+
# full_url: [String] url to full size image (medium),
|
152
|
+
# gallery_url: [String] url to gallery size image (large),
|
153
|
+
# raw_url: [String] url to raw image (largest)
|
154
|
+
# title: [String] human readable title of image
|
155
|
+
# is_main_listing_image: [Boolean] whether the image is the main image for the listing
|
156
|
+
# caption: [String] human readable caption for the image
|
157
|
+
# description: [String] human readable description of the image
|
158
|
+
# width: [Integer] width of the raw image
|
159
|
+
# height: [Integer] height of the raw image
|
160
|
+
# mime_type: [String] MIME or media type of the image
|
161
|
+
#
|
162
|
+
# }
|
163
|
+
attr_accessor :listing_images
|
164
|
+
|
165
|
+
# @!attribute living_area
|
166
|
+
#
|
167
|
+
# @return [Integer] square footage of the building
|
168
|
+
attr_accessor :living_area
|
169
|
+
|
170
|
+
# @!attribute longitude
|
171
|
+
#
|
172
|
+
# @return [String] longitude of the property
|
173
|
+
attr_accessor :longitude
|
174
|
+
|
175
|
+
# @!attribute lot_size_acres
|
176
|
+
#
|
177
|
+
# @return [float] the property acreage of the listing
|
178
|
+
attr_accessor :lot_size_acres
|
179
|
+
|
180
|
+
# @!attribute lot_size_square_feet
|
181
|
+
#
|
182
|
+
# @return [Integer] square footage of lot
|
183
|
+
attr_accessor :lot_size_square_feet
|
184
|
+
|
185
|
+
# @!attribute middle_or_junior_school
|
186
|
+
#
|
187
|
+
# @return [String] Middle school for property
|
188
|
+
attr_accessor :middle_or_junior_school
|
189
|
+
|
190
|
+
# @!attribute moxi_works_listing_id
|
191
|
+
# moxi_works_listing_id is the Moxi Works Platform ID of the listing
|
192
|
+
#
|
193
|
+
# this must be set for any Moxi Works Platform transaction
|
194
|
+
#
|
195
|
+
# @return [String] the Moxi Works Platform ID of the listing
|
196
|
+
attr_accessor :moxi_works_listing_id
|
197
|
+
|
198
|
+
# @!attribute modification_timestamp
|
199
|
+
#
|
200
|
+
# @return [String] string representing date in format 'MM/DD/YYYY'
|
201
|
+
attr_accessor :modification_timestamp
|
202
|
+
|
203
|
+
# @!attribute on_market
|
204
|
+
#
|
205
|
+
# @return [Boolean] whether the listing is on market
|
206
|
+
attr_accessor :on_market
|
207
|
+
|
208
|
+
# @!attribute pool_yn
|
209
|
+
#
|
210
|
+
# @return [Boolean] whether there is a pool
|
211
|
+
attr_accessor :pool_yn
|
212
|
+
|
213
|
+
# @!attribute postal_code
|
214
|
+
#
|
215
|
+
# @return [String] zip code of property address
|
216
|
+
attr_accessor :postal_code
|
217
|
+
|
218
|
+
# @!attribute property_features
|
219
|
+
#
|
220
|
+
# @return [Hash] property features associated with this listing
|
221
|
+
attr_accessor :property_features
|
222
|
+
|
223
|
+
# @!attribute property_type
|
224
|
+
#
|
225
|
+
# @return [String] type of property, could be 'Rental' 'Residential' 'Condo-Coop' 'Townhouse' 'Land' 'Multifamily'
|
226
|
+
attr_accessor :property_type
|
227
|
+
|
228
|
+
# @!attribute public_remarks
|
229
|
+
#
|
230
|
+
# @return [String] agent generated comments regarding the property
|
231
|
+
attr_accessor :public_remarks
|
232
|
+
|
233
|
+
# @!attribute single_story
|
234
|
+
#
|
235
|
+
# @return [Boolean] whether the building is single story
|
236
|
+
attr_accessor :single_story
|
237
|
+
|
238
|
+
# @!attribute state
|
239
|
+
#
|
240
|
+
# @return [String] state of property address
|
241
|
+
attr_accessor :state_or_province
|
242
|
+
|
243
|
+
# @!attribute tax_annual_amount
|
244
|
+
#
|
245
|
+
# @return [Integer] Annual property tax for the property
|
246
|
+
attr_accessor :tax_annual_amount
|
247
|
+
|
248
|
+
# @!attribute tax_year
|
249
|
+
#
|
250
|
+
# @return [Integer] assessment year that property_tax reflects
|
251
|
+
attr_accessor :tax_year
|
252
|
+
|
253
|
+
# @!attribute view_yn
|
254
|
+
#
|
255
|
+
# @return [Boolean] whether the property has a view
|
256
|
+
attr_accessor :view_yn
|
257
|
+
|
258
|
+
# @!attribute waterfront_yn
|
259
|
+
#
|
260
|
+
# @return [Boolean|nil] whether the property has waterfront acreage
|
261
|
+
attr_accessor :waterfront_yn
|
262
|
+
|
263
|
+
# @!attribute year_built
|
264
|
+
#
|
265
|
+
# @return [Integer] year the building was built
|
266
|
+
attr_accessor :year_built
|
267
|
+
|
268
|
+
# @!attribute sold_date
|
269
|
+
#
|
270
|
+
# @return [String] year the building was built
|
271
|
+
attr_accessor :sold_date
|
272
|
+
|
273
|
+
# @!attribute sold_price
|
274
|
+
#
|
275
|
+
# @return [Integer] price listing was sold for
|
276
|
+
attr_accessor :sold_price
|
277
|
+
|
278
|
+
|
279
|
+
# Find a listing on the Moxi Works Platform
|
280
|
+
# @param [Hash] opts named parameter Hash
|
281
|
+
# @option opts [String] :moxi_works_listing_id *REQUIRED* The Moxi Works Listing ID for the listing
|
282
|
+
# @option opts [String] :moxi_works_company_id *REQUIRED* The Moxi Works Company ID For the search (use Company.search to determine available moxi_works_company_id)
|
283
|
+
#
|
284
|
+
# @return [MoxiworksPlatform::Listing]
|
285
|
+
#
|
286
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
287
|
+
# named parameters aren't included
|
288
|
+
#
|
289
|
+
def self.find(opts={})
|
290
|
+
url = "#{MoxiworksPlatform::Config.url}/api/sold_listings/#{opts[:moxi_works_listing_id]}"
|
291
|
+
self.send_request(:get, opts, url)
|
292
|
+
end
|
293
|
+
|
294
|
+
def self.send_request(method, opts={}, url=nil)
|
295
|
+
url ||= "#{MoxiworksPlatform::Config.url}/api/sold_listings"
|
296
|
+
required_opts = [:moxi_works_listing_id, :moxi_works_company_id]
|
297
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError,
|
298
|
+
'arguments must be passed as named parameters' unless opts.is_a? Hash
|
299
|
+
required_opts.each do |opt|
|
300
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
301
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
302
|
+
end
|
303
|
+
|
304
|
+
RestClient::Request.execute(method: method,
|
305
|
+
url: url,
|
306
|
+
payload: opts, headers: self.headers) do |response|
|
307
|
+
puts response if MoxiworksPlatform::Config.debug
|
308
|
+
self.check_for_error_in_response(response)
|
309
|
+
json = JSON.parse(response)
|
310
|
+
json = self.underscore_attribute_names json
|
311
|
+
return false if not json['status'].nil? and json['status'] =='fail'
|
312
|
+
self.new(json) unless json.nil? or json.empty?
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
# Search For Listings in Moxi Works Platform
|
317
|
+
# @param [Hash] opts named parameter Hash
|
318
|
+
# @option opts [String] :moxi_works_company_id *REQUIRED* The Moxi Works Company ID For the search (use Company.search to determine available moxi_works_company_id)
|
319
|
+
# @option opts [Integer] :sold_since *REQUIRED* Unix timestamp; Only Listings updated after this date will be returned
|
320
|
+
# @option opts [String] :moxi_works_agent_id The Moxi Works Agent ID For the search (use Agent.search to determine available moxi_works_agent_id) -- only agent_uuid or moxi_works_agent_id are needed when searching for listings by agent
|
321
|
+
# @option opts [String] :agent_uuid The Agent UUID For the search (use Agent.search to determine available agent_uuid) -- only agent_uuid or moxi_works_agent_id are needed when searching for listings by agent
|
322
|
+
# @option opts [String] :moxi_works_office_id The Moxi Works Office ID For the search (use Office.search or Agent response to determine available moxi_works_office_id)
|
323
|
+
#
|
324
|
+
#
|
325
|
+
# optional Search parameters
|
326
|
+
#
|
327
|
+
# @option opts [String] :last_moxi_works_listing_id For multi-page responses (where the response value 'last_page' is false), send the listing ID of the last Listing in the previous page.
|
328
|
+
# @option opts [Hash] :previous_page For multi-page responses (where the response value 'last_page' is false), send the entire response from the previous page.
|
329
|
+
#
|
330
|
+
# @return [Hash] with the format:
|
331
|
+
# {
|
332
|
+
# last_page: [Boolean],
|
333
|
+
# listings: [Array] containing MoxiworkPlatform::Listing objects
|
334
|
+
# }
|
335
|
+
#
|
336
|
+
#
|
337
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
338
|
+
# named parameters aren't included
|
339
|
+
#
|
340
|
+
# @example
|
341
|
+
# results = MoxiworksPlatform::Listing.search(
|
342
|
+
# moxi_works_company_id: 'the_company',
|
343
|
+
# sold_since: Time.now.to_i - 1296000,
|
344
|
+
# moxi_works_agent_id: 'abc123'
|
345
|
+
# )
|
346
|
+
#
|
347
|
+
# next_page = MoxiworksPlatform::Listing.search(
|
348
|
+
# moxi_works_company_id: 'the_company',
|
349
|
+
# sold_since: Time.now.to_i - 1296000,
|
350
|
+
# moxi_works_agent_id: 'abc123',
|
351
|
+
# previous_page: results
|
352
|
+
# )
|
353
|
+
#
|
354
|
+
# @block |Array|
|
355
|
+
# if you pass a block with the logic you want to perform on all listings,
|
356
|
+
# you can have all listings processed in a single call
|
357
|
+
#
|
358
|
+
# @example
|
359
|
+
# MoxiworksPlatform::Listing.search(
|
360
|
+
# moxi_works_company_id: 'the_company',
|
361
|
+
# sold_since: Time.now.to_i - 131297832) { |page_of_listings| puts page_of_listings.count }
|
362
|
+
#
|
363
|
+
def self.search(opts={}, &block)
|
364
|
+
url ||= "#{MoxiworksPlatform::Config.url}/api/sold_listings"
|
365
|
+
required_opts = [:moxi_works_company_id, :sold_since]
|
366
|
+
|
367
|
+
required_opts.each do |opt|
|
368
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
369
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
370
|
+
end
|
371
|
+
|
372
|
+
prev_page = opts[:previous_page] || opts['previous_page']
|
373
|
+
unless(prev_page.nil? or
|
374
|
+
prev_page.empty? or
|
375
|
+
not prev_page.is_a?(Hash) or
|
376
|
+
prev_page['listings'].nil? or
|
377
|
+
prev_page['listings'].empty? or
|
378
|
+
not prev_page['listings'].is_a?(Array))
|
379
|
+
opts[:last_moxi_works_listing_id] ||= prev_page['listings'].last.moxi_works_listing_id
|
380
|
+
end
|
381
|
+
|
382
|
+
results = []
|
383
|
+
json = {'listings' => [], 'last_page' => true}
|
384
|
+
RestClient::Request.execute(method: :get,
|
385
|
+
url: url,
|
386
|
+
payload: opts, headers: self.headers) do |response|
|
387
|
+
puts response if MoxiworksPlatform::Config.debug
|
388
|
+
self.check_for_error_in_response(response)
|
389
|
+
json = JSON.parse(response)
|
390
|
+
json = self.underscore_attribute_names json
|
391
|
+
json['listings'].each do |r|
|
392
|
+
results << MoxiworksPlatform::Listing.new(r) unless r.nil? or r.empty?
|
393
|
+
end
|
394
|
+
json['listings'] = results
|
395
|
+
end
|
396
|
+
if block_given?
|
397
|
+
yield(json['listings'])
|
398
|
+
unless json['final_page']
|
399
|
+
last_listing = json['listings'].last
|
400
|
+
last_listing_id = (last_listing.nil?) ? nil : last_listing.moxi_works_listing_id
|
401
|
+
MoxiworksPlatform::Listing.search(opts.merge(last_moxi_works_listing_id: last_listing_id), &block) if last_listing_id
|
402
|
+
end
|
403
|
+
end
|
404
|
+
json
|
405
|
+
end
|
406
|
+
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
@@ -0,0 +1,208 @@
|
|
1
|
+
module MoxiworksPlatform
|
2
|
+
# = Moxi Works Platform Teams
|
3
|
+
class Team < MoxiworksPlatform::Resource
|
4
|
+
|
5
|
+
|
6
|
+
# @!attribute uuid
|
7
|
+
#
|
8
|
+
# @return string The unique ID of the Team
|
9
|
+
#
|
10
|
+
attr_accessor :uuid
|
11
|
+
|
12
|
+
|
13
|
+
# @!attribute name
|
14
|
+
#
|
15
|
+
# @return string The human readable name of the team
|
16
|
+
#
|
17
|
+
attr_accessor :name
|
18
|
+
|
19
|
+
|
20
|
+
# @!attribute email
|
21
|
+
#
|
22
|
+
# @return string Contact email address for the team
|
23
|
+
#
|
24
|
+
attr_accessor :email
|
25
|
+
|
26
|
+
|
27
|
+
# @!attribute address1
|
28
|
+
#
|
29
|
+
# @return string First line of contact address for the team
|
30
|
+
#
|
31
|
+
attr_accessor :address1
|
32
|
+
|
33
|
+
|
34
|
+
# @!attribute address2
|
35
|
+
#
|
36
|
+
# @return string Second line of contact address for the team
|
37
|
+
#
|
38
|
+
attr_accessor :address2
|
39
|
+
|
40
|
+
|
41
|
+
# @!attribute city
|
42
|
+
#
|
43
|
+
# @return string City portion of contact address for the team
|
44
|
+
#
|
45
|
+
attr_accessor :city
|
46
|
+
|
47
|
+
|
48
|
+
# @!attribute state
|
49
|
+
#
|
50
|
+
# @return string State portion of contact address for the team
|
51
|
+
#
|
52
|
+
attr_accessor :state
|
53
|
+
|
54
|
+
|
55
|
+
# @!attribute zipcode
|
56
|
+
#
|
57
|
+
# @return string Postal Code portion of the contact address for the team
|
58
|
+
#
|
59
|
+
attr_accessor :zipcode
|
60
|
+
|
61
|
+
|
62
|
+
# @!attribute phone
|
63
|
+
#
|
64
|
+
# @return string contact phone number for the team
|
65
|
+
#
|
66
|
+
attr_accessor :phone
|
67
|
+
|
68
|
+
|
69
|
+
# @!attribute fax
|
70
|
+
#
|
71
|
+
# @return string fax number for the team
|
72
|
+
#
|
73
|
+
attr_accessor :fax
|
74
|
+
|
75
|
+
|
76
|
+
# @!attribute logo_url
|
77
|
+
#
|
78
|
+
# @return string URL to a logo image for the team
|
79
|
+
#
|
80
|
+
attr_accessor :logo_url
|
81
|
+
|
82
|
+
|
83
|
+
# @!attribute photo_url
|
84
|
+
#
|
85
|
+
# @return string First URL to a image representing the team
|
86
|
+
#
|
87
|
+
attr_accessor :photo_url
|
88
|
+
|
89
|
+
|
90
|
+
# @!attribute description
|
91
|
+
#
|
92
|
+
# @return string Description of the team. can contain embedded HTML
|
93
|
+
#
|
94
|
+
attr_accessor :description
|
95
|
+
|
96
|
+
|
97
|
+
# @!attribute social_media_urls
|
98
|
+
#
|
99
|
+
# @return array Social media URLs associated with the team
|
100
|
+
#
|
101
|
+
attr_accessor :social_media_urls
|
102
|
+
|
103
|
+
|
104
|
+
# @!attribute alt_phone
|
105
|
+
#
|
106
|
+
# @return string Alternate contact phone number for the team
|
107
|
+
#
|
108
|
+
attr_accessor :alt_phone
|
109
|
+
|
110
|
+
|
111
|
+
# @!attribute alt_email
|
112
|
+
#
|
113
|
+
# @return string Alternate contact email address for the team
|
114
|
+
#
|
115
|
+
attr_accessor :alt_email
|
116
|
+
|
117
|
+
|
118
|
+
# @!attribute website_url
|
119
|
+
#
|
120
|
+
# @return string URL to the website for the team
|
121
|
+
#
|
122
|
+
attr_accessor :website_url
|
123
|
+
|
124
|
+
|
125
|
+
# @!attribute active
|
126
|
+
#
|
127
|
+
# @return boolean Whether the team is active or not
|
128
|
+
#
|
129
|
+
attr_accessor :active
|
130
|
+
|
131
|
+
# Find a Team by ID in Moxi Works Platform
|
132
|
+
# @param [Hash] opts named parameter Hash
|
133
|
+
# @option opts [String] :moxi_works_team_id *REQUIRED* The Moxi Works TEam ID
|
134
|
+
#
|
135
|
+
# @return [MoxiworksPlatform::Team]
|
136
|
+
#
|
137
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
138
|
+
# named parameters aren't included
|
139
|
+
#
|
140
|
+
def self.find(opts={})
|
141
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError,
|
142
|
+
'arguments must be passed as named parameters' unless opts.is_a? Hash
|
143
|
+
required_opts = [:moxi_works_team_id]
|
144
|
+
required_opts.each do |opt|
|
145
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
146
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
147
|
+
end
|
148
|
+
url = "#{MoxiworksPlatform::Config.url}/api/teams/#{opts[:moxi_works_team_id]}"
|
149
|
+
self.send_request(:get, opts, url)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Search For Teams in Moxi Works Platform
|
153
|
+
# @param [Hash] opts named parameter Hash
|
154
|
+
# @option opts [String] :moxi_works_company_id *REQUIRED* The Moxi Works Company ID For the search (use Company.search to determine available moxi_works_company_id)
|
155
|
+
#
|
156
|
+
#
|
157
|
+
# optional Search parameters
|
158
|
+
#
|
159
|
+
#
|
160
|
+
# @return [Array] with the format:
|
161
|
+
#
|
162
|
+
#
|
163
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
164
|
+
# named parameters aren't included
|
165
|
+
#
|
166
|
+
# @example
|
167
|
+
# results = MoxiworksPlatform::Team.search(
|
168
|
+
# moxi_works_company_id: 'the_company',
|
169
|
+
# )
|
170
|
+
#
|
171
|
+
#
|
172
|
+
# @block |Array|
|
173
|
+
# if you pass a block with the logic you want to perform on all teams,
|
174
|
+
# you can have all teams processed in a single call
|
175
|
+
#
|
176
|
+
# @example
|
177
|
+
# MoxiworksPlatform::Team.search(
|
178
|
+
# moxi_works_company_id: 'the_company') { |teams| puts teams.count }
|
179
|
+
#
|
180
|
+
def self.search(opts={})
|
181
|
+
required_opts = [:moxi_works_company_id]
|
182
|
+
required_opts.each do |opt|
|
183
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
184
|
+
opts[opt].nil? or opts[opt].to_s.empty?
|
185
|
+
end
|
186
|
+
|
187
|
+
url = "#{MoxiworksPlatform::Config.url}/api/teams"
|
188
|
+
|
189
|
+
results = []
|
190
|
+
RestClient::Request.execute(method: :get,
|
191
|
+
url: url,
|
192
|
+
payload: opts, headers: self.headers) do |response|
|
193
|
+
puts response if MoxiworksPlatform::Config.debug
|
194
|
+
self.check_for_error_in_response(response)
|
195
|
+
json = JSON.parse(response)
|
196
|
+
json = self.underscore_attribute_names json
|
197
|
+
json.each do |r|
|
198
|
+
results << MoxiworksPlatform::Team.new(r) unless r.nil? or r.empty?
|
199
|
+
end
|
200
|
+
end
|
201
|
+
if block_given?
|
202
|
+
yield(results)
|
203
|
+
end
|
204
|
+
results
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
end
|
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.12.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:
|
11
|
+
date: 2018-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,13 +94,17 @@ files:
|
|
94
94
|
- lib/moxiworks_platform/email_campaign.rb
|
95
95
|
- lib/moxiworks_platform/event.rb
|
96
96
|
- lib/moxiworks_platform/exception.rb
|
97
|
+
- lib/moxiworks_platform/gallery.rb
|
97
98
|
- lib/moxiworks_platform/group.rb
|
98
99
|
- lib/moxiworks_platform/listing.rb
|
99
100
|
- lib/moxiworks_platform/office.rb
|
101
|
+
- lib/moxiworks_platform/presentation_log.rb
|
100
102
|
- lib/moxiworks_platform/resource.rb
|
101
103
|
- lib/moxiworks_platform/seller_transaction.rb
|
102
104
|
- lib/moxiworks_platform/session.rb
|
105
|
+
- lib/moxiworks_platform/sold_listing.rb
|
103
106
|
- lib/moxiworks_platform/task.rb
|
107
|
+
- lib/moxiworks_platform/team.rb
|
104
108
|
- lib/moxiworks_platform/version.rb
|
105
109
|
- moxiworks_platform.gemspec
|
106
110
|
- publish_docs.sh
|