Skip to content

hoverboard-labs/nwmls

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

188 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An object mapper for the Evernet NWMLS Soap Web Service

  • Rails 4.0.0

Put this line in your Gemfile:

gem 'nwmls', :git => "[email protected]:luxre/nwmls.git"

Then bundle:

% bundle

Create config/initializers/nwmls.rb to set your Evernet credentials

Evernet::Connection.user = 'XXXXX'
Evernet::Connection.pass = 'XXXXX'

in this intializer you can also set the SchemaName for your query results using the Evernet::Connection.schema_name setting. Possible settings include NWMLSPremiumXML, NWMLSStandardXML, StandardXML, StandardXML1_0, PremiumXML1_0, StandardXML1_1, and PremiumXML1_1. If not set the default is StandardXML1_1

e.g. Evernet::Connection.schema_name = 'StandardXML1_1'

The Nwmls::Listing#find method will return an array of Nwmls::Listing objects if given a hash. The possible keys for that hash are:

:property_type
:status
:county
:area
:city
:begin_date
:end_date
:office_mls_id
:agent_mls_id
:bedrooms
:bathrooms

e.g. Nwmls::Listing.find(:property_type => “RESI”, :status => “A”, :city => “Seattle”)

The options for :property_type are “RESI”, “COND”, “BUSO”, “COMI”, “FARM”, “MANU”, “MULT”, “RENT”, “VACL”. If the :property_type key is not supplied then “RESI” is the default

There are subclasses of Nwmls::Listing based on the property types. Your result objects are returned as instances of these classes. You can also use find with these classes, for example

Nwmls::Listing.find(:property_type => "COND")

is equivalent to

Nwmls::CondominiumListing.find()

The supported subclasses are

Nwmls::ResidentialListing #RESI
Nwmls::CondominiumListing #COND
Nwmls::BusinessOpportunityListing #BUSO
Nwmls::CommercialListing #COMI
Nwmls::FarmListing #FARM
Nwmls::ManufacturedHomeListing #MANU
Nwmls::MultiFamilyListing #MULT
Nwmls::RentalListing #RENT
Nwmls::VacantLandListing #VACL
  • Filters

The find method also takes an optional second parameter. This is an array of filters. The filters work similarly to a select clause in a SQL statement. It limits which attributes are returned in the results. For example

Nwmls::Listing.find(:status => "A", ['LN','PTYP',UD])

would return all active residential listings but only the listing_number, property_type, and update_date attributes. This feature is useful when you are doing finds that return a large number of Listing objects

if you give find the key :listing_number then a single result will be returned instead of an array. Example:

Nwmls::Listing.find(:listing_number => '454186')

conveniently you can also find a single listing with

Nwmls::Listing.find(454186)

if you add the following to your config/initializers/nwmls.rb initializer file

Nwmls::Model.attribute_mode = :raw

The model will act in “raw” mode. This means that attribute’s names and values will be returned exactly as they are represented in the Evernet schema. For example, Nwmls::Listing objects will have attribute LN instead of listing_number. Values for boolean attributes are returned as strings “1” and “0”. Attributes that return arrays will return | delimited strings.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors