Class: MoxiworksPlatform::Listing
- Defined in:
- lib/moxiworks_platform/listing.rb
Overview
Moxi Works Platform Listing
Instance Attribute Summary collapse
-
#address ⇒ String
Street address of property.
-
#address2 ⇒ String
A second line for street address if needed.
-
#agent_created_listing ⇒ Boolean
Whether the agent created the listing.
-
#association_fee ⇒ Integer
HOA fees for property.
-
#bathrooms_full ⇒ Integer|nil
Number full bathrooms | nil if no data available.
-
#bathrooms_half ⇒ Integer|nil
Number half bathrooms | nil if no data available.
-
#bathrooms_one_quarter ⇒ Integer|nil
Number quarter bathrooms | nil if no data available.
-
#bathrooms_partial ⇒ Integer|nil
Number partial bathrooms | nil if no data available.
-
#bathrooms_three_quarter ⇒ Integer|nil
Number three-quarter bathrooms | nil if no data available.
-
#bathrooms_total ⇒ Integer|nil
Number bathrooms | nil if no data available.
-
#bathrooms_total_integer ⇒ Integer|nil
Number of rooms that are bathrooms | nil if no data available.
-
#bedrooms_total ⇒ Integer
Number of bedrooms.
-
#city ⇒ String
City of property address.
-
#community ⇒ String
The community the property is located in.
-
#company_listing_attributes ⇒ Array
Company specific attributes.
-
#county_or_parish ⇒ String
County of property address.
-
#created_date ⇒ String
String representing date in format 'MM/DD/YYYY'.
-
#days_on_market ⇒ Integer
Days listing has been on market.
-
#elementary_school ⇒ String
Elementary school for the property.
-
#garage_spaces ⇒ Integer
Garage spaces for the property.
-
#high_school ⇒ String
High school for property.
-
#images_last_modified ⇒ Integer
Timestamp representing when the images associated with the listing were last updated.
-
#internet_address_display_yn ⇒ Boolean
Whether to display the address publicly.
-
#internet_entire_listing_display_yn ⇒ Boolean
Whether to display listing on internet.
-
#latitude ⇒ String
Latitude of the property.
-
#list_agent_full_name ⇒ String
Name of listing agent.
-
#list_agent_moxi_works_office_id ⇒ String
MoxiWorks ID of listing agent office.
-
#list_agent_office_id ⇒ String
ID of listing agent office.
-
#list_agent_uuid ⇒ String
UUID of listing agent.
-
#list_office_aor ⇒ String
MLS area the listing is listed with.
-
#list_office_aor_area ⇒ String
MLS area the listing is listed with.
-
#list_office_name ⇒ String
Name office responsible for listing.
-
#list_price ⇒ Integer
Listed price.
-
#listing_contract_date ⇒ String
String representing date in format 'MM/DD/YYYY'.
-
#listing_id ⇒ String
The mls number associated with the listing.
-
#listing_images ⇒ Array
Array of image Hashes in the format { thumb_url: [String] url to thumbail size image (smallest), small_url: [String] url to small size image (small), full_url: [String] url to full size image (medium), gallery_url: [String] url to gallery size image (large), raw_url: [String] url to raw image (largest) title: [String] human readable title of image is_main_listing_image: [Boolean] whether the image is the main image for the listing caption: [String] human readable caption for the image description: [String] human readable description of the image width: [Integer] width of the raw image height: [Integer] height of the raw image mime_type: [String] MIME or media type of the image.
-
#listing_url ⇒ String
The URL of the listing.
-
#living_area ⇒ Integer
Square footage of the building.
-
#longitude ⇒ String
Longitude of the property.
-
#lot_size_acres ⇒ float
The property acreage of the listing.
-
#lot_size_square_feet ⇒ Integer
Square footage of lot.
-
#middle_or_junior_school ⇒ String
Middle school for property.
-
#modification_timestamp ⇒ String
String representing date in format 'MM/DD/YYYY'.
-
#moxi_works_listing_id ⇒ String
moxi_works_listing_id is the Moxi Works Platform ID of the listing.
-
#on_market ⇒ Boolean
Whether the listing is on market.
-
#open_house ⇒ Array
Open house Hashes associated with the listing in the format { “date” => “(string) YYYY-MM-DD formatted string representing the date of the open house” “start_time” => “(string) HH:MM:SS formatted string representing the time when the open house starts. This is expressed in the local time where the listing is located.” “end_time” => “(string) HH:MM:SS formatted string representing the time when the open house ends. This is expressed in the local time where the listing is located.” }.
-
#pool_yn ⇒ Boolean
Whether there is a pool.
-
#postal_code ⇒ String
Zip code of property address.
-
#property_features ⇒ Hash
Property features associated with this listing.
-
#property_type ⇒ String
Type of property, could be 'Rental' 'Residential' 'Condo-Coop' 'Townhouse' 'Land' 'Multifamily'.
-
#public_remarks ⇒ String
Agent generated comments regarding the property.
-
#public_title ⇒ String
Title of the listing.
-
#secondary_list_agent_full_name ⇒ String
If there is a second listing agent, the name of the second listing agent.
-
#secondary_list_agent_uuid ⇒ String
If there is a second listing agent, the unique identifier for the second listing agent.
-
#single_story ⇒ Boolean
Whether the building is single story.
-
#state ⇒ String
State of property address.
-
#state_or_province ⇒ String
State of property address.
-
#status ⇒ String
Status of listing.
-
#tax_annual_amount ⇒ Integer
Annual property tax for the property.
-
#tax_year ⇒ Integer
Assessment year that property_tax reflects.
-
#title ⇒ String
Title of the listing.
-
#view_yn ⇒ Boolean
Whether the property has a view.
-
#virtual_tour_url ⇒ String
Virtual tour URL for this listing.
-
#waterfront_yn ⇒ Boolean|nil
Whether the property has waterfront acreage.
-
#year_built ⇒ Integer
Year the building was built.
Attributes inherited from Resource
Class Method Summary collapse
-
.find(opts = {}) ⇒ MoxiworksPlatform::Listing
Find a listing on the Moxi Works Platform.
-
.search(opts = {}, &block) ⇒ Hash
Search For Listings in Moxi Works Platform.
- .send_request(method, opts = {}, url = nil) ⇒ Object
Methods inherited from Resource
accept_header, attr_accessor, attributes, #attributes, auth_header, check_for_error_in_response, content_type_header, #float_attrs, headers, #init_attrs_from_hash, #initialize, #int_attrs, #method_missing, #numeric_attrs, #numeric_value_for, #to_hash, underscore, underscore_array, underscore_attribute_names, underscore_hash, user_agent_header
Constructor Details
This class inherits a constructor from MoxiworksPlatform::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MoxiworksPlatform::Resource
Instance Attribute Details
#address ⇒ String
Returns street address of property.
8 9 10 |
# File 'lib/moxiworks_platform/listing.rb', line 8 def address @address end |
#address2 ⇒ String
Returns a second line for street address if needed.
13 14 15 |
# File 'lib/moxiworks_platform/listing.rb', line 13 def address2 @address2 end |
#agent_created_listing ⇒ Boolean
Returns whether the agent created the listing.
18 19 20 |
# File 'lib/moxiworks_platform/listing.rb', line 18 def agent_created_listing @agent_created_listing end |
#association_fee ⇒ Integer
Returns HOA fees for property.
23 24 25 |
# File 'lib/moxiworks_platform/listing.rb', line 23 def association_fee @association_fee end |
#bathrooms_full ⇒ Integer|nil
Returns number full bathrooms | nil if no data available.
28 29 30 |
# File 'lib/moxiworks_platform/listing.rb', line 28 def bathrooms_full @bathrooms_full end |
#bathrooms_half ⇒ Integer|nil
Returns number half bathrooms | nil if no data available.
33 34 35 |
# File 'lib/moxiworks_platform/listing.rb', line 33 def bathrooms_half @bathrooms_half end |
#bathrooms_one_quarter ⇒ Integer|nil
Returns number quarter bathrooms | nil if no data available.
38 39 40 |
# File 'lib/moxiworks_platform/listing.rb', line 38 def bathrooms_one_quarter @bathrooms_one_quarter end |
#bathrooms_partial ⇒ Integer|nil
Returns number partial bathrooms | nil if no data available.
43 44 45 |
# File 'lib/moxiworks_platform/listing.rb', line 43 def bathrooms_partial @bathrooms_partial end |
#bathrooms_three_quarter ⇒ Integer|nil
Returns number three-quarter bathrooms | nil if no data available.
53 54 55 |
# File 'lib/moxiworks_platform/listing.rb', line 53 def bathrooms_three_quarter @bathrooms_three_quarter end |
#bathrooms_total ⇒ Integer|nil
Returns number bathrooms | nil if no data available.
58 59 60 |
# File 'lib/moxiworks_platform/listing.rb', line 58 def bathrooms_total @bathrooms_total end |
#bathrooms_total_integer ⇒ Integer|nil
Returns number of rooms that are bathrooms | nil if no data available.
48 49 50 |
# File 'lib/moxiworks_platform/listing.rb', line 48 def bathrooms_total_integer @bathrooms_total_integer end |
#bedrooms_total ⇒ Integer
Returns number of bedrooms.
63 64 65 |
# File 'lib/moxiworks_platform/listing.rb', line 63 def bedrooms_total @bedrooms_total end |
#city ⇒ String
Returns city of property address.
68 69 70 |
# File 'lib/moxiworks_platform/listing.rb', line 68 def city @city end |
#community ⇒ String
Returns the community the property is located in.
73 74 75 |
# File 'lib/moxiworks_platform/listing.rb', line 73 def community @community end |
#company_listing_attributes ⇒ Array
Returns company specific attributes.
73 |
# File 'lib/moxiworks_platform/listing.rb', line 73 attr_accessor :community |
#county_or_parish ⇒ String
Returns county of property address.
83 84 85 |
# File 'lib/moxiworks_platform/listing.rb', line 83 def county_or_parish @county_or_parish end |
#created_date ⇒ String
Returns string representing date in format 'MM/DD/YYYY'.
88 89 90 |
# File 'lib/moxiworks_platform/listing.rb', line 88 def created_date @created_date end |
#days_on_market ⇒ Integer
Returns days listing has been on market.
93 94 95 |
# File 'lib/moxiworks_platform/listing.rb', line 93 def days_on_market @days_on_market end |
#elementary_school ⇒ String
Returns elementary school for the property.
98 99 100 |
# File 'lib/moxiworks_platform/listing.rb', line 98 def elementary_school @elementary_school end |
#garage_spaces ⇒ Integer
Returns garage spaces for the property.
103 104 105 |
# File 'lib/moxiworks_platform/listing.rb', line 103 def garage_spaces @garage_spaces end |
#high_school ⇒ String
Returns High school for property.
108 109 110 |
# File 'lib/moxiworks_platform/listing.rb', line 108 def high_school @high_school end |
#images_last_modified ⇒ Integer
Returns timestamp representing when the images associated with the listing were last updated.
185 186 187 |
# File 'lib/moxiworks_platform/listing.rb', line 185 def images_last_modified @images_last_modified end |
#internet_address_display_yn ⇒ Boolean
Returns whether to display the address publicly.
113 114 115 |
# File 'lib/moxiworks_platform/listing.rb', line 113 def internet_address_display_yn @internet_address_display_yn end |
#internet_entire_listing_display_yn ⇒ Boolean
Returns whether to display listing on internet.
118 119 120 |
# File 'lib/moxiworks_platform/listing.rb', line 118 def internet_entire_listing_display_yn @internet_entire_listing_display_yn end |
#latitude ⇒ String
Returns latitude of the property.
123 124 125 |
# File 'lib/moxiworks_platform/listing.rb', line 123 def latitude @latitude end |
#list_agent_full_name ⇒ String
Returns name of listing agent.
128 129 130 |
# File 'lib/moxiworks_platform/listing.rb', line 128 def list_agent_full_name @list_agent_full_name end |
#list_agent_moxi_works_office_id ⇒ String
Returns MoxiWorks ID of listing agent office.
133 134 135 |
# File 'lib/moxiworks_platform/listing.rb', line 133 def list_agent_moxi_works_office_id @list_agent_moxi_works_office_id end |
#list_agent_office_id ⇒ String
Returns ID of listing agent office.
138 139 140 |
# File 'lib/moxiworks_platform/listing.rb', line 138 def list_agent_office_id @list_agent_office_id end |
#list_agent_uuid ⇒ String
Returns UUID of listing agent.
143 144 145 |
# File 'lib/moxiworks_platform/listing.rb', line 143 def list_agent_uuid @list_agent_uuid end |
#list_office_aor ⇒ String
Returns MLS area the listing is listed with.
158 159 160 |
# File 'lib/moxiworks_platform/listing.rb', line 158 def list_office_aor @list_office_aor end |
#list_office_aor_area ⇒ String
Returns MLS area the listing is listed with.
163 164 165 |
# File 'lib/moxiworks_platform/listing.rb', line 163 def list_office_aor_area @list_office_aor_area end |
#list_office_name ⇒ String
Returns name office responsible for listing.
148 149 150 |
# File 'lib/moxiworks_platform/listing.rb', line 148 def list_office_name @list_office_name end |
#list_price ⇒ Integer
Returns listed price.
153 154 155 |
# File 'lib/moxiworks_platform/listing.rb', line 153 def list_price @list_price end |
#listing_contract_date ⇒ String
Returns string representing date in format 'MM/DD/YYYY'.
168 169 170 |
# File 'lib/moxiworks_platform/listing.rb', line 168 def listing_contract_date @listing_contract_date end |
#listing_id ⇒ String
Returns the mls number associated with the listing.
173 174 175 |
# File 'lib/moxiworks_platform/listing.rb', line 173 def listing_id @listing_id end |
#listing_images ⇒ Array
Returns array of image Hashes in the format
thumb_url: [String] url to thumbail size image (smallest),
small_url: [String] url to small size image (small),
full_url: [String] url to full size image (medium),
gallery_url: [String] url to gallery size image (large),
raw_url: [String] url to raw image (largest)
title: [String] human readable title of image
is_main_listing_image: [Boolean] whether the image is the main image for the listing
caption: [String] human readable caption for the image
description: [String] human readable description of the image
width: [Integer] width of the raw image
height: [Integer] height of the raw image
mime_type: [String] MIME or media type of the image
.
205 206 207 |
# File 'lib/moxiworks_platform/listing.rb', line 205 def listing_images @listing_images end |
#listing_url ⇒ String
Returns the URL of the listing.
178 179 180 |
# File 'lib/moxiworks_platform/listing.rb', line 178 def listing_url @listing_url end |
#living_area ⇒ Integer
Returns square footage of the building.
210 211 212 |
# File 'lib/moxiworks_platform/listing.rb', line 210 def living_area @living_area end |
#longitude ⇒ String
Returns longitude of the property.
215 216 217 |
# File 'lib/moxiworks_platform/listing.rb', line 215 def longitude @longitude end |
#lot_size_acres ⇒ float
Returns the property acreage of the listing.
220 221 222 |
# File 'lib/moxiworks_platform/listing.rb', line 220 def lot_size_acres @lot_size_acres end |
#lot_size_square_feet ⇒ Integer
Returns square footage of lot.
225 226 227 |
# File 'lib/moxiworks_platform/listing.rb', line 225 def lot_size_square_feet @lot_size_square_feet end |
#middle_or_junior_school ⇒ String
Returns Middle school for property.
230 231 232 |
# File 'lib/moxiworks_platform/listing.rb', line 230 def middle_or_junior_school @middle_or_junior_school end |
#modification_timestamp ⇒ String
Returns string representing date in format 'MM/DD/YYYY'.
243 244 245 |
# File 'lib/moxiworks_platform/listing.rb', line 243 def @modification_timestamp end |
#moxi_works_listing_id ⇒ String
moxi_works_listing_id is the Moxi Works Platform ID of the listing
this must be set for any Moxi Works Platform transaction
238 239 240 |
# File 'lib/moxiworks_platform/listing.rb', line 238 def moxi_works_listing_id @moxi_works_listing_id end |
#on_market ⇒ Boolean
Returns whether the listing is on market.
248 249 250 |
# File 'lib/moxiworks_platform/listing.rb', line 248 def on_market @on_market end |
#open_house ⇒ Array
Returns open house Hashes associated with the listing in the format
"date" => "(string) YYYY-MM-DD formatted string representing the date of the open house"
"start_time" => "(string) HH:MM:SS formatted string representing the time when the open house starts. This is expressed in the local time where the listing is located."
"end_time" => "(string) HH:MM:SS formatted string representing the time when the open house ends. This is expressed in the local time where the listing is located."
.
328 329 330 |
# File 'lib/moxiworks_platform/listing.rb', line 328 def open_house @open_house end |
#pool_yn ⇒ Boolean
Returns whether there is a pool.
253 254 255 |
# File 'lib/moxiworks_platform/listing.rb', line 253 def pool_yn @pool_yn end |
#postal_code ⇒ String
Returns zip code of property address.
258 259 260 |
# File 'lib/moxiworks_platform/listing.rb', line 258 def postal_code @postal_code end |
#property_features ⇒ Hash
Returns property features associated with this listing.
263 264 265 |
# File 'lib/moxiworks_platform/listing.rb', line 263 def property_features @property_features end |
#property_type ⇒ String
Returns type of property, could be 'Rental' 'Residential' 'Condo-Coop' 'Townhouse' 'Land' 'Multifamily'.
268 269 270 |
# File 'lib/moxiworks_platform/listing.rb', line 268 def property_type @property_type end |
#public_remarks ⇒ String
Returns agent generated comments regarding the property.
273 274 275 |
# File 'lib/moxiworks_platform/listing.rb', line 273 def public_remarks @public_remarks end |
#public_title ⇒ String
Returns Title of the listing.
343 344 345 |
# File 'lib/moxiworks_platform/listing.rb', line 343 def public_title @public_title end |
#secondary_list_agent_full_name ⇒ String
Returns If there is a second listing agent, the name of the second listing agent.
338 339 340 |
# File 'lib/moxiworks_platform/listing.rb', line 338 def secondary_list_agent_full_name @secondary_list_agent_full_name end |
#secondary_list_agent_uuid ⇒ String
Returns If there is a second listing agent, the unique identifier for the second listing agent. This will correspond to the uuid field of an Agent.
333 334 335 |
# File 'lib/moxiworks_platform/listing.rb', line 333 def secondary_list_agent_uuid @secondary_list_agent_uuid end |
#single_story ⇒ Boolean
Returns whether the building is single story.
278 279 280 |
# File 'lib/moxiworks_platform/listing.rb', line 278 def single_story @single_story end |
#state ⇒ String
Returns state of property address.
283 |
# File 'lib/moxiworks_platform/listing.rb', line 283 attr_accessor :state_or_province |
#state_or_province ⇒ String
Returns state of property address.
283 284 285 |
# File 'lib/moxiworks_platform/listing.rb', line 283 def state_or_province @state_or_province end |
#status ⇒ String
Returns status of listing.
288 289 290 |
# File 'lib/moxiworks_platform/listing.rb', line 288 def status @status end |
#tax_annual_amount ⇒ Integer
Returns Annual property tax for the property.
293 294 295 |
# File 'lib/moxiworks_platform/listing.rb', line 293 def tax_annual_amount @tax_annual_amount end |
#tax_year ⇒ Integer
Returns assessment year that property_tax reflects.
298 299 300 |
# File 'lib/moxiworks_platform/listing.rb', line 298 def tax_year @tax_year end |
#title ⇒ String
Returns Title of the listing.
343 |
# File 'lib/moxiworks_platform/listing.rb', line 343 attr_accessor :public_title |
#view_yn ⇒ Boolean
Returns whether the property has a view.
303 304 305 |
# File 'lib/moxiworks_platform/listing.rb', line 303 def view_yn @view_yn end |
#virtual_tour_url ⇒ String
Returns Virtual tour URL for this listing.
318 319 320 |
# File 'lib/moxiworks_platform/listing.rb', line 318 def virtual_tour_url @virtual_tour_url end |
#waterfront_yn ⇒ Boolean|nil
Returns whether the property has waterfront acreage.
308 309 310 |
# File 'lib/moxiworks_platform/listing.rb', line 308 def waterfront_yn @waterfront_yn end |
#year_built ⇒ Integer
Returns year the building was built.
313 314 315 |
# File 'lib/moxiworks_platform/listing.rb', line 313 def year_built @year_built end |
Class Method Details
.find(opts = {}) ⇒ MoxiworksPlatform::Listing
Find a listing on the Moxi Works Platform
356 357 358 359 |
# File 'lib/moxiworks_platform/listing.rb', line 356 def self.find(opts={}) url = "#{MoxiworksPlatform::Config.url}/api/listings/#{opts[:moxi_works_listing_id]}" self.send_request(:get, opts, url) end |
.search(opts = {}, &block) ⇒ Hash
Search For Listings in Moxi Works Platform
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/moxiworks_platform/listing.rb', line 432 def self.search(opts={}, &block) url ||= "#{MoxiworksPlatform::Config.url}/api/listings" required_opts = [:moxi_works_company_id, :updated_since] required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end prev_page = opts[:previous_page] || opts['previous_page'] unless(prev_page.nil? or prev_page.empty? or not prev_page.is_a?(Hash) or prev_page['listings'].nil? or prev_page['listings'].empty? or not prev_page['listings'].is_a?(Array)) opts[:last_moxi_works_listing_id] ||= prev_page['listings'].last.moxi_works_listing_id end results = MoxiResponseArray.new() json = {'listings' => [], 'last_page' => true} RestClient::Request.execute(method: :get, url: url, payload: opts, headers: self.headers) do |response| puts response if MoxiworksPlatform::Config.debug results.headers = response.headers self.check_for_error_in_response(response) json = JSON.parse(response) json = self.underscore_attribute_names json json['listings'].each do |r| results << MoxiworksPlatform::Listing.new(r) unless r.nil? or r.empty? end json['listings'] = results end if block_given? yield(json['listings']) unless json['final_page'] last_listing = json['listings'].last last_listing_id = (last_listing.nil?) ? nil : last_listing.moxi_works_listing_id MoxiworksPlatform::Listing.search(opts.merge(last_moxi_works_listing_id: last_listing_id), &block) if last_listing_id end end json end |
.send_request(method, opts = {}, url = nil) ⇒ Object
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/moxiworks_platform/listing.rb', line 361 def self.send_request(method, opts={}, url=nil) url ||= "#{MoxiworksPlatform::Config.url}/api/listings" required_opts = [:moxi_works_listing_id, :moxi_works_company_id] raise ::MoxiworksPlatform::Exception::ArgumentError, 'arguments must be passed as named parameters' unless opts.is_a? Hash required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end RestClient::Request.execute(method: method, url: url, payload: opts, headers: self.headers) do |response| puts response if MoxiworksPlatform::Config.debug self.check_for_error_in_response(response) json = JSON.parse(response) json = self.underscore_attribute_names json return false if not json['status'].nil? and json['status'] =='fail' r = self.new(json) unless json.nil? or json.empty? r.headers = response.headers unless r.nil? r end end |