Class: MoxiworksPlatform::SoldListing
- Defined in:
- lib/moxiworks_platform/sold_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
Community the listing 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.
-
#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_uuid ⇒ String
Listing agent UUID.
-
#list_office_aor ⇒ String
MLS the listing is listed with.
-
#list_office_aor_area ⇒ String
The MLS Area which this listing is in.
-
#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.
-
#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.
-
#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
Secondary listing agent full name.
-
#secondary_list_agent_uuid ⇒ String
Secondary list agent UUID.
-
#single_story ⇒ Boolean
Whether the building is single story.
-
#sold_date ⇒ String
Year the building was built.
-
#sold_price ⇒ Integer
Price listing was sold for.
-
#state ⇒ String
State of property address.
-
#state_or_province ⇒ String
State of property address.
-
#status ⇒ String
Status of the listing.
-
#tax_annual_amount ⇒ Integer
Annual property tax for the property.
-
#tax_year ⇒ Integer
Assessment year that property_tax reflects.
-
#view_yn ⇒ Boolean
Whether the property has a view.
-
#virtual_tour_url ⇒ String
Virtual tour url of the 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::SoldListing
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/sold_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/sold_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/sold_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/sold_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/sold_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/sold_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/sold_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/sold_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/sold_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/sold_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/sold_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/sold_listing.rb', line 63 def bedrooms_total @bedrooms_total end |
#city ⇒ String
Returns city of property address.
68 69 70 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 68 def city @city end |
#community ⇒ String
Returns community the listing is located in.
296 297 298 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 296 def community @community end |
#company_listing_attributes ⇒ Array
Returns company specific attributes.
286 287 288 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 286 def company_listing_attributes @company_listing_attributes end |
#county_or_parish ⇒ String
Returns county of property address.
73 74 75 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 73 def county_or_parish @county_or_parish end |
#created_date ⇒ String
Returns string representing date in format 'MM/DD/YYYY'.
78 79 80 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 78 def created_date @created_date end |
#days_on_market ⇒ Integer
Returns days listing has been on market.
83 84 85 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 83 def days_on_market @days_on_market end |
#elementary_school ⇒ String
Returns elementary school for the property.
88 89 90 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 88 def elementary_school @elementary_school end |
#garage_spaces ⇒ Integer
Returns garage spaces for the property.
93 94 95 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 93 def garage_spaces @garage_spaces end |
#high_school ⇒ String
Returns High school for property.
98 99 100 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 98 def high_school @high_school end |
#internet_address_display_yn ⇒ Boolean
Returns whether to display the address publicly.
103 104 105 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 103 def internet_address_display_yn @internet_address_display_yn end |
#internet_entire_listing_display_yn ⇒ Boolean
Returns whether to display listing on internet.
108 109 110 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 108 def internet_entire_listing_display_yn @internet_entire_listing_display_yn end |
#latitude ⇒ String
Returns latitude of the property.
113 114 115 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 113 def latitude @latitude end |
#list_agent_full_name ⇒ String
Returns name of listing agent.
118 119 120 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 118 def list_agent_full_name @list_agent_full_name end |
#list_agent_uuid ⇒ String
Returns listing agent UUID.
316 317 318 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 316 def list_agent_uuid @list_agent_uuid end |
#list_office_aor ⇒ String
Returns MLS the listing is listed with.
133 134 135 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 133 def list_office_aor @list_office_aor end |
#list_office_aor_area ⇒ String
Returns The MLS Area which this listing is in.
301 302 303 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 301 def list_office_aor_area @list_office_aor_area end |
#list_office_name ⇒ String
Returns name office responsible for listing.
123 124 125 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 123 def list_office_name @list_office_name end |
#list_price ⇒ Integer
Returns listed price.
128 129 130 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 128 def list_price @list_price end |
#listing_contract_date ⇒ String
Returns string representing date in format 'MM/DD/YYYY'.
138 139 140 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 138 def listing_contract_date @listing_contract_date end |
#listing_id ⇒ String
Returns the mls number associated with the listing.
143 144 145 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 143 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
.
163 164 165 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 163 def listing_images @listing_images end |
#living_area ⇒ Integer
Returns square footage of the building.
168 169 170 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 168 def living_area @living_area end |
#longitude ⇒ String
Returns longitude of the property.
173 174 175 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 173 def longitude @longitude end |
#lot_size_acres ⇒ float
Returns the property acreage of the listing.
178 179 180 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 178 def lot_size_acres @lot_size_acres end |
#lot_size_square_feet ⇒ Integer
Returns square footage of lot.
183 184 185 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 183 def lot_size_square_feet @lot_size_square_feet end |
#middle_or_junior_school ⇒ String
Returns Middle school for property.
188 189 190 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 188 def middle_or_junior_school @middle_or_junior_school end |
#modification_timestamp ⇒ String
Returns string representing date in format 'MM/DD/YYYY'.
201 202 203 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 201 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
196 197 198 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 196 def moxi_works_listing_id @moxi_works_listing_id end |
#on_market ⇒ Boolean
Returns whether the listing is on market.
206 207 208 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 206 def on_market @on_market end |
#pool_yn ⇒ Boolean
Returns whether there is a pool.
211 212 213 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 211 def pool_yn @pool_yn end |
#postal_code ⇒ String
Returns zip code of property address.
216 217 218 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 216 def postal_code @postal_code end |
#property_features ⇒ Hash
Returns property features associated with this listing.
221 222 223 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 221 def property_features @property_features end |
#property_type ⇒ String
Returns type of property, could be 'Rental' 'Residential' 'Condo-Coop' 'Townhouse' 'Land' 'Multifamily'.
226 227 228 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 226 def property_type @property_type end |
#public_remarks ⇒ String
Returns agent generated comments regarding the property.
231 232 233 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 231 def public_remarks @public_remarks end |
#public_title ⇒ String
Returns Title of the listing.
281 282 283 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 281 def public_title @public_title end |
#secondary_list_agent_full_name ⇒ String
Returns Secondary listing agent full name.
291 292 293 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 291 def secondary_list_agent_full_name @secondary_list_agent_full_name end |
#secondary_list_agent_uuid ⇒ String
Returns Secondary list agent UUID.
321 322 323 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 321 def secondary_list_agent_uuid @secondary_list_agent_uuid end |
#single_story ⇒ Boolean
Returns whether the building is single story.
236 237 238 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 236 def single_story @single_story end |
#sold_date ⇒ String
Returns year the building was built.
271 272 273 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 271 def sold_date @sold_date end |
#sold_price ⇒ Integer
Returns price listing was sold for.
276 277 278 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 276 def sold_price @sold_price end |
#state ⇒ String
Returns state of property address.
241 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 241 attr_accessor :state_or_province |
#state_or_province ⇒ String
Returns state of property address.
241 242 243 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 241 def state_or_province @state_or_province end |
#status ⇒ String
Returns status of the listing.
306 307 308 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 306 def status @status end |
#tax_annual_amount ⇒ Integer
Returns Annual property tax for the property.
246 247 248 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 246 def tax_annual_amount @tax_annual_amount end |
#tax_year ⇒ Integer
Returns assessment year that property_tax reflects.
251 252 253 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 251 def tax_year @tax_year end |
#view_yn ⇒ Boolean
Returns whether the property has a view.
256 257 258 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 256 def view_yn @view_yn end |
#virtual_tour_url ⇒ String
Returns virtual tour url of the listing.
311 312 313 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 311 def virtual_tour_url @virtual_tour_url end |
#waterfront_yn ⇒ Boolean|nil
Returns whether the property has waterfront acreage.
261 262 263 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 261 def waterfront_yn @waterfront_yn end |
#year_built ⇒ Integer
Returns year the building was built.
266 267 268 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 266 def year_built @year_built end |
Class Method Details
.find(opts = {}) ⇒ MoxiworksPlatform::SoldListing
Find a listing on the Moxi Works Platform
333 334 335 336 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 333 def self.find(opts={}) url = "#{MoxiworksPlatform::Config.url}/api/sold_listings/#{opts[:moxi_works_listing_id]}" self.send_request(:get, opts, url) end |
.search(opts = {}, &block) ⇒ Hash
Search For Listings in Moxi Works Platform
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 409 def self.search(opts={}, &block) url ||= "#{MoxiworksPlatform::Config.url}/api/sold_listings" required_opts = [:moxi_works_company_id, :sold_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::SoldListing.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::SoldListing.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
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/moxiworks_platform/sold_listing.rb', line 338 def self.send_request(method, opts={}, url=nil) url ||= "#{MoxiworksPlatform::Config.url}/api/sold_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 |