Skip to content

Instantly share code, notes, and snippets.

@cotocisternas
Last active January 14, 2019 00:45
Show Gist options
  • Select an option

  • Save cotocisternas/b4d22e8308db145ce2ac2236c4606642 to your computer and use it in GitHub Desktop.

Select an option

Save cotocisternas/b4d22e8308db145ce2ac2236c4606642 to your computer and use it in GitHub Desktop.
Convecta Problems

Integracion AAndes

Problemas con CONVECTA

Property Date

Ambas fechas se representan identicas, y se homologan a la fecha de publicacion del XML, no de la propiedad

  • property[:publication_date]
  • property[:update_date]
pry(main)> properties.map { |property| property[:publication_date] }

[
    [  0] "13/01/2019 14:10:00",
    [  1] "13/01/2019 14:10:00",
    [  2] "13/01/2019 14:10:00",
    [  3] "13/01/2019 14:10:00",
    [  4] "13/01/2019 14:10:00",
    .....
]
pry(main)> properties.map { |property| property[:update_date] }

[
    [  0] "13/01/2019 14:10:00",
    [  1] "13/01/2019 14:10:00",
    [  2] "13/01/2019 14:10:00",
    [  3] "13/01/2019 14:10:00",
    [  4] "13/01/2019 14:10:00",
    .....
]
# Fecha Consulta 13/01/2019
{
                  "id" => "202001074",
        "mls_database" => "202001074",
                 "url" => "http://altoandesweb.prop360.cl//fichaPropiedad.aspx?i=1074",
               "title" => "Departamento en Arriendo en Amplio Departamento",
    "publication_date" => "13/01/2019 14:10:00",
         "update_date" => "13/01/2019 14:10:00",
        ...
}

# Fecha Consulta 27/12/2018
{
                  "id" => "202001074",
        "mls_database" => "202001074",
                 "url" => "http://altoandesweb.prop360.cl//fichaPropiedad.aspx?i=1074",
               "title" => "Departamento en Arriendo en Amplio Departamento",
    "publication_date" => "27/12/2018 08:14:00",
         "update_date" => "27/12/2018 08:14:00",
        ...
}

Property Feed

XML NO SE REEMPLAZA!

  • 10/01/2019 - 138 Propiedades
  • 11/01/2019 - 138 Propiedades
  • 12/01/2019 - 138 Propiedades
  • 13/01/2019 - 138 Propiedades

Features & Images

Tipo de dato no es consistente, para valor unico es un Hash/Map, para valores multiples es un Array/List de Hash/Map y cuando no existe valor es un Empty String

Features HASH

# features = { id: '17', value: 'true' }
# 'piscina'

feature_parse(features[:id])

Features ARRAY

# features = [{ id: '1', value: 'true' }, { id: '2', value: 'true' }]
# [patio / areas verdes comunes', 'balcon / terraza']

collection = []

values = features.map(&:values).flatten.reject { |value| value == 'true' }
values.each do |value|
  collection.push(feature_parse(value))
end

Images HASH

# pictures = { picture_url_large: 'http://altoandes...1.jpg', picture_title: '' }
# 'http://altoandes...1.jpg'

pictures[:picture_url_large]

Images ARRAY

# pictures = [
#  { picture_url_large: 'http://altoandes...1.jpg', picture_title: '' },
#  { picture_url_large: 'http://altoandes...2.jpg', picture_title: '' }
# ]
#
# ['http://altoandes...1.jpg', 'http://altoandes...2.jpg']

pictures.map { |picture| picture[:picture_url_large] }

Convecta Demo Hash

Llaves no consistentes con documentacion, existen llaves que se representan tanto con valor o vacio, otras cuando el valor es nulo se omite la llave. (Ej. 'period')

{
                  "id" => "202001074",
        "mls_database" => "202001074",
                 "url" => "http://altoandesweb.prop360.cl//fichaPropiedad.aspx?i=1074",
               "title" => "Departamento en Arriendo en Amplio Departamento",
    "publication_date" => "27/12/2018 08:14:00",
         "update_date" => "27/12/2018 08:14:00",
          "properties" => {
           "propertytype" => "Apartment",
        "transactiontype" => "For Rent",
                "content" => "Espectacular departamento en vitacura, cuenta con amplios espacios, una buena iluminación, 3 dormitorios mas servicios , sala de estar y 4 baños además de una terraza. Tiene termopanel en todas las ventanas.",
                  "price" => "2000000.000",
               "currency" => "CLP",
                  "rooms" => "3",
              "bathrooms" => "4",
             "floor_area" => "230",
              "plot_area" => "250",
                   "year" => "",
                 "is_new" => "false",
        "common_expenses" => "240000.000",
           "floor_number" => "",
            "orientation" => "",
                "parking" => " ",
           "is_furnished" => "false",
                  "daily" => "false"
    },
            "location" => {
             "address" => "Amplio Departamento",
        "neighborhood" => "Vitacura",
           "city_area" => "Vitacura",
                "city" => "Vitacura",
               "state" => "Metropolitana",
             "country" => "Chile",
            "latitude" => "",
           "longitude" => ""
    },
              "agency" => {
              "by_owner" => "false",
           "agency_name" => "Alto Andes",
         "agency_office" => "Alto Andes",
             "agency_id" => "37330715",
           "agency_logo" => "https://altoandes.prop360.cl/assets/sitiosProp360/altoandes/img/global/logo.png",
        "agency_address" => "Avenida El Salto 4001, oficina 81, Ciudad Empresarial",
          "contact_name" => "Alto Andes Agente Inmobiliario",
        "contact_phones" => "+56222439114,  +56995432788,  +56999914614",
         "contact_email" => "contacto@aandes.cl"
    },
            "features" => " ",
            "pictures" => {
        "picture" => [
            [ 0] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3532_20180209081610.jpg",
                    "picture_title" => " "
            },
            [ 1] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3531_20180209081608.jpg",
                    "picture_title" => " "
            },
            [ 2] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3533_20180209081609.jpg",
                    "picture_title" => " "
            },
            [ 3] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3537_20180209081610.jpg",
                    "picture_title" => " "
            },
            [ 4] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3535_20180209081612.jpg",
                    "picture_title" => " "
            },
            [ 5] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3536_20180209081608.jpg",
                    "picture_title" => " "
            },
            [ 6] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3530_20180209081609.jpg",
                    "picture_title" => " "
            },
            [ 7] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3534_20180209081611.jpg",
                    "picture_title" => " "
            },
            [ 8] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3538_20180209081611.jpg",
                    "picture_title" => " "
            },
            [ 9] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3539_20180209081612.jpg",
                    "picture_title" => " "
            },
            [10] {
                "picture_url_large" => "http://altoandesweb.prop360.cl//assets/img/propiedades/1074_9P5A3540_20180209081614.jpg",
                    "picture_title" => " "
            }
        ]
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment