Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

230 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An object mapper for the Evernet NWMLS Soap Web Service

  • Rails >= 4.0.0 < 4.2.7

Put this line in your Gemfile:

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

Then bundle:

% bundle

Create the initializer:

% ./bin/rails generate nwmls USER_ID PASSWORD SCHEMA_NAME

You can omit the arguments for the generator and set the values in the initializer later

Edit 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. The default is StandardXML1_2. Supported schemas include:

  • StandardXML1_1

  • StandardXML1_2

  • PremiumXML1_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

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages