Project

vistasoft

0.0
No commit activity in last 3 years
No release in over 3 years
Integration with Vista SOAP web service
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

active_support
>= 0
>= 0

Runtime

~> 2
 Project Readme

Vistasoft Soap API

Build Status Coverage Status Code Climate Dependency Status Gem Version

The ruby API for accessing the vistasoft SOAP interface. VistSoft.com.br. See Vista's Soap Specification

Instalation

Add this line to your application's Gemfile:

gem 'vistasoft'

And then execute:

$ bundle

Usage example

Method: busca_imoveis

params = {
  'key'        => '{the client code}',
  'module'     => 'imoveis',
  'method'     => 'busca_imoveis',
  'field'      => {
    'CODIGO'     => 'vista_id',
    'CATEGORIA'  => 'category',
    'VLR_VENDA'  => 'price',
    'CIDADE'     => 'city',
    'BAIRRO'     => 'area',
    'DORMITORIO' => 'bedrooms',
    'VAGAS'      => 'garages',
    'IMAGEM_G'   => 'picture',
    'URL_FOTO'   => 'picture_url',
    'DESCRICAO'  => 'description'
  },
  'order'      => {'VLR_VENDA' => 'DESC'},
  'limit'      => '0,10'
}

# Savon::Response
response = Vistasoft::Soap::Service.new(params).call

# Hash
parsed_response = Vistasoft::Soap::ResponseParser.new.parse(response)

# {
#   "0" =>  {
#     "vista_id"    => '3',
#     "category"    => "Apartamentos",
#     "price"       => nil,
#     "city"        => "Porto Alegre",
#     "area"        => "Bairro Remover",
#     "bedrooms"    => '5',
#     "garages"     => nil,
#     "picture"     => "i_9586_3_ceb68.jpg",
#     "picture_url" => "http://strg-rse.vistahosting.com.br/wx4imove/vista.imobi/fotos/",
#     "description" => nil,
#   },
#   "1" = {
#     "vista_id"    => '3',
#     "category"    => "Apartamentos",
#     "price"       => nil,
#     "city"        => "Porto Alegre",
#     "area"        => "Bairro Remover",
#     "bedrooms"    => '5',
#     "garages"     => nil,
#     "picture"     => "i_9586_3_ceb68.jpg",
#     "picture_url" => "http://strg-rse.vistahosting.com.br/wx4imove/vista.imobi/fotos/",
#     "description" => nil,
#   },
#   "total_registros" => "2"
# }

# Vistasoft::Soap::Collections::ModelCollection
collection = Vistasoft::Soap::Collection.factory(parsed_response, Vistasoft::Soap::Model)

# Vistasoft::Soap::Model
model = collection.first

model.category # => Apartamentos

Method: busca_fotos

params = {
  'key'        => '{the client code}',
  'module'     => 'imoveis',
  'method'     => 'busca_fotos',
  'field'      => {
    'CODIGO'    => 'codigo',
    'IMAGEM_P'  => 'thumb',
    'IMAGEM_G'  => 'foto',
    'URL_FOTO'  => 'url',
    'DESCRICAO' => 'descricao'
  },
 'filter' => {
    # 'CODIGO' => 875
  }
}

# Savon::Response
response = Vistasoft::Soap::Service.new(params).call

# Hash
parsed_response = Vistasoft::Soap::ResponseParser.new.parse(response)

# {
#   "0"=> {
#     "codigo"=>"3",
#     "thumb"=>"i_9586_3_34f71_p.jpg",
#     "foto"=>"i_9586_3_ceb68.jpg",
#     "url"=>"http://strg-rse.vistahosting.com.br/wx4imove/vista.imobi/fotos/",
#     "descricao"=> 'Pretty, uh?'
#   },
#   "1"=> {
#     "codigo"=>"3",
#     "thumb"=>"i_9586_3_c4e6f_p.jpg",
#     "foto"=>"i_9586_3_6e8a6.jpg",
#     "url"=>"http://strg-rse.vistahosting.com.br/wx4imove/vista.imobi/fotos/",
#     "descricao"=> 'Pretty, uh?'
#   }
# }

# Vistasoft::Soap::Collections::ModelCollection
collection = Vistasoft::Soap::Collection.factory(parsed_response, Vistasoft::Soap::Model)

# Vistasoft::Soap::Model
model = collection.first

model.descricao # => 'Pretty, uh?'

Method: lista_origens

params = {
  'key'        => '{the client code}',
  'module'     => 'imoveis',
  'method'     => 'listar_origens'
}

response = Vistasoft::Soap::Service.new(params).call

Vistasoft::Soap::ResponseParser.new.parse(response) # not tested yet

Method: lista_itens_filtro

params = {
  'key'        => '{the client code}',
  'module'     => 'imoveis',
  'method'     => 'lista_itens_filtro',
  'field'      => 'BAIRRO',
  'filter' => {
    'CIDADE' => 'Porto Alegre'
  }
}

response = Vistasoft::Soap::Service.new(params).call

Vistasoft::Soap::ResponseParser.new.parse(response) # ['Centro', 'Higienopolis']

Method: listar_documentos

Not working by the time of plugin development.

Authors

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature) Do not forget to write tests
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request