Sha256: e8a249b04eedb5aab7c8574e7509bf8cc9519b888c2f082238dc374c1ea24add

Contents?: true

Size: 1.86 KB

Versions: 5

Compression:

Stored size: 1.86 KB

Contents

module Pwb
  class ApiPublic::V1::PropResource < JSONAPI::Resource
    model_name 'Pwb::Prop'

    attributes :area_unit, :photos, :property_photos, :extras
    attributes :street_address, :street_number, :postal_code
    attributes :city, :region, :currency
    attributes :country, :longitude, :latitude

    attributes :count_bathrooms, :count_bedrooms, :count_garages, :count_toilets
    attributes :constructed_area, :year_construction, :plot_area
    attributes :prop_type_key, :prop_state_key, :prop_origin_key

    attributes :title_es, :title_en, :title_ar, :description_es, :description_en, :description_ar

    attributes :for_sale, :for_rent_short_term, :for_rent_long_term, :obscure_map, :hide_map

    attributes :price_sale_current_cents, :price_sale_original_cents
    attributes :price_rental_monthly_current_cents, :price_rental_monthly_original_cents
    attributes :price_rental_monthly_low_season_cents, :price_rental_monthly_high_season_cents
    attributes :price_rental_monthly_standard_season_cents
    attributes  :visible, :highlighted, :reference

    def extras
      # override needed here as I have an extras has_many r/n on property
      # which is not yet in use..
      return @model.get_extras
    end

    # TODO - fix client side so I don't have to use these legacy names
    def property_photos
      photos = @model.prop_photos
      return photos
    end

    def photos
      photos = @model.prop_photos
      return photos
    end

    # def ano_constr
    #   ano_constr = @model.year_construction, :plot_area
    #   return ano_constr
    # end

    # t.integer  :year_construction, :plot_area, default: 0, null: false
    # t.integer  :count_bedrooms, default: 0, null: false
    # t.integer  :count_bathrooms, default: 0, null: false
    # t.integer  :count_toilets, default: 0, null: false
    # t.integer  :count_garages, default: 0, null: false

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pwb-1.2.0 app/resources/pwb/api_public/v1/prop_resource.rb
pwb-1.1.1 app/resources/pwb/api_public/v1/prop_resource.rb
pwb-1.0.0 app/resources/pwb/api_public/v1/prop_resource.rb
pwb-0.1.1 app/resources/pwb/api_public/v1/prop_resource.rb
pwb-0.1.0 app/resources/pwb/api_public/v1/prop_resource.rb