class JustimmoClient::V1::Realty

Public Class Methods

new(**options) click to toggle source

@!group Instance Method Summary

Calls superclass method
# File lib/justimmo_client/api/v1/models/realty.rb, line 39
def initialize(**options)
  super(options)
  @contact ||= Employee.new
  @usage ||= RealtyUsage.new
  @marketing ||= RealtyMarketing.new
  @geo ||= GeoLocation.new
  @area ||= RealtyArea.new
  @room_count ||= RealtyRoomCount.new
  @price ||= RealtyPrice.new
end

Public Instance Methods

available=(date) click to toggle source

@param date [String] @return [String, DateTime]

# File lib/justimmo_client/api/v1/models/realty.rb, line 60
def available=(date)
  @available = DateTime.parse(date) unless date.nil?
rescue ArgumentError
  log.debug("Failed to convert date: #{date}")
  @available = date
end
description=(desc) click to toggle source
# File lib/justimmo_client/api/v1/models/realty.rb, line 67
def description=(desc)
  @description =
    if @teaser.empty?
      parts = desc.partition("</ul>\n")
      self.teaser = parts[0..1].join
      parts.last.strip
    else
      desc.strip
    end
end
images() click to toggle source
# File lib/justimmo_client/api/v1/models/realty.rb, line 50
def images
  attachments.select { |x| x.type == "pic" }
end
teaser=(tea) click to toggle source
# File lib/justimmo_client/api/v1/models/realty.rb, line 78
def teaser=(tea)
  @teaser =
    case tea
    when Array
      tea.map(&:strip)
    when String
      tea.gsub(/<\/?(ul|li)>/, "").strip.split("\n").map(&:strip)
    else []
    end
end
title_image() click to toggle source
# File lib/justimmo_client/api/v1/models/realty.rb, line 54
def title_image
  attachments.select { |x| x.category == :title_image }.first
end
type() click to toggle source
# File lib/justimmo_client/api/v1/models/realty.rb, line 89
def type
  @type ||= RealtyInterface.types.select { |x| x.id == type_id }.first
end