nwmls_client 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/nwmls_client/amenity.rb +4 -3
 - data/lib/nwmls_client/base.rb +37 -0
 - data/lib/nwmls_client/business.rb +4 -3
 - data/lib/nwmls_client/commercial.rb +4 -3
 - data/lib/nwmls_client/community.rb +4 -3
 - data/lib/nwmls_client/condominium.rb +4 -3
 - data/lib/nwmls_client/farmranch.rb +5 -3
 - data/lib/nwmls_client/history.rb +6 -4
 - data/lib/nwmls_client/image.rb +39 -44
 - data/lib/nwmls_client/image_data.rb +4 -3
 - data/lib/nwmls_client/listing.rb +31 -27
 - data/lib/nwmls_client/manufactured.rb +4 -3
 - data/lib/nwmls_client/member.rb +4 -3
 - data/lib/nwmls_client/multifamily.rb +4 -3
 - data/lib/nwmls_client/office.rb +4 -3
 - data/lib/nwmls_client/rental.rb +4 -3
 - data/lib/nwmls_client/residential.rb +7 -4
 - data/lib/nwmls_client/school.rb +4 -3
 - data/lib/nwmls_client/timeshare.rb +5 -3
 - data/lib/nwmls_client/vacantland.rb +4 -3
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9b1168fc5cdde96327e3fd7e8a96cb8bb8106da4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7abeb27cc0719c9e575e335fc859352cbc990a2d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e6df160f821fb9bf769616b729baca26f3d7f7a6974d0934f6ebd4526d7a23134c30690ea6aad0b24d2c406a2f130be37608560959a1e2c3710e9da23ce4f5a8
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ce57cef7da4bfea78f1872c87dce98b46755c4ad2c15899bfcd612f312a8f44e8ed308573dfee9f117d8142586184dc1ff868236a982ad5c7bdddb96edf76ee8
         
     | 
    
        data/lib/nwmls_client/amenity.rb
    CHANGED
    
    | 
         @@ -4,14 +4,14 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Amenity < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:operation] = :retrieve_amenity_data
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:data_response] = :retrieve_amenity_data_response
         
     | 
| 
       10 
10 
     | 
    
         
             
                  criteria[:data_result] = :retrieve_amenity_data_result
         
     | 
| 
       11 
11 
     | 
    
         
             
                  criteria[:data_types] = :amenities
         
     | 
| 
       12 
12 
     | 
    
         
             
                  criteria[:data_type] = :amenity
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       14 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 14 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       15 
15 
     | 
    
         
             
                end 
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def display(amenities)
         
     | 
| 
         @@ -36,7 +36,8 @@ module NwmlsClient 
     | 
|
| 
       36 
36 
     | 
    
         
             
            end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       39 
     | 
    
         
            -
               
     | 
| 
      
 39 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 40 
     | 
    
         
            +
              amenity = NwmlsClient::Amenity.new(config)
         
     | 
| 
       40 
41 
     | 
    
         
             
              data = amenity.retrieve_data
         
     | 
| 
       41 
42 
     | 
    
         
             
              amenity.display(data)
         
     | 
| 
       42 
43 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "yaml"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "yaml/store"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module NwmlsClient
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              module Base
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                NWMLS_FILE = 'nwmls.yml'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                def self.load_config()
         
     | 
| 
      
 11 
     | 
    
         
            +
                  if not File.exist?(NWMLS_FILE)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    puts "Generating config file: #{NWMLS_FILE}"        
         
     | 
| 
      
 13 
     | 
    
         
            +
                    store = YAML::Store.new NWMLS_FILE
         
     | 
| 
      
 14 
     | 
    
         
            +
                    store.transaction do 
         
     | 
| 
      
 15 
     | 
    
         
            +
                      store["default"] = { 
         
     | 
| 
      
 16 
     | 
    
         
            +
                        "mls" => "NWMLS", 
         
     | 
| 
      
 17 
     | 
    
         
            +
                        "schema" => "StandardXML1_3",
         
     | 
| 
      
 18 
     | 
    
         
            +
                        "user_id" => "your_nwmls_user_id",
         
     | 
| 
      
 19 
     | 
    
         
            +
                        "password" => "your_nwmls_password"
         
     | 
| 
      
 20 
     | 
    
         
            +
                      }
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  if File.exist?(NWMLS_FILE)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    data = YAML::load_file(NWMLS_FILE)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  else
         
     | 
| 
      
 27 
     | 
    
         
            +
                    raise "Unable to generate config file: #{NWMLS_FILE}"
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  return data['default']
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                end 
         
     | 
| 
      
 33 
     | 
    
         
            +
                
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
              
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Business < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "BUSO"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :business_opportunity
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)
         
     | 
| 
       12 
12 
     | 
    
         
             
                end  
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -17,7 +17,8 @@ end 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 21 
     | 
    
         
            +
              business = NwmlsClient::Business.new(config)
         
     | 
| 
       21 
22 
     | 
    
         
             
              listings = business.retrieve_data
         
     | 
| 
       22 
23 
     | 
    
         
             
              business.display(listings)
         
     | 
| 
       23 
24 
     | 
    
         
             
            end
         
     | 
| 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Commercial < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "COMI"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :commercial_industrial
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
12 
     | 
    
         
             
                end 
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -17,7 +17,8 @@ end 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 21 
     | 
    
         
            +
              commercial = NwmlsClient::Commercial.new(config)
         
     | 
| 
       21 
22 
     | 
    
         
             
              listings = commercial.retrieve_data
         
     | 
| 
       22 
23 
     | 
    
         
             
              commercial.display(listings)
         
     | 
| 
       23 
24 
     | 
    
         
             
            end
         
     | 
| 
         @@ -4,14 +4,14 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Community < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:operation] = :retrieve_area_community_data
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:data_response] = :retrieve_area_community_data_response
         
     | 
| 
       10 
10 
     | 
    
         
             
                  criteria[:data_result] = :retrieve_area_community_data_result
         
     | 
| 
       11 
11 
     | 
    
         
             
                  criteria[:data_types] = :areas_communities
         
     | 
| 
       12 
12 
     | 
    
         
             
                  criteria[:data_type] = :areacommunity
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       14 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 14 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       15 
15 
     | 
    
         
             
                end 
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def display(community_data)
         
     | 
| 
         @@ -32,7 +32,8 @@ end 
     | 
|
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       35 
     | 
    
         
            -
               
     | 
| 
      
 35 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 36 
     | 
    
         
            +
              community = NwmlsClient::Community.new(config)
         
     | 
| 
       36 
37 
     | 
    
         
             
              data = community.retrieve_data
         
     | 
| 
       37 
38 
     | 
    
         
             
              community.display(data)
         
     | 
| 
       38 
39 
     | 
    
         
             
            end
         
     | 
| 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Condominium < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "COND"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :condominium
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
12 
     | 
    
         
             
                end 
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -17,7 +17,8 @@ end 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 21 
     | 
    
         
            +
              condo = NwmlsClient::Condominium.new(config, status: "S")
         
     | 
| 
       21 
22 
     | 
    
         
             
              listings = condo.retrieve_data
         
     | 
| 
       22 
23 
     | 
    
         
             
              condo.display(listings)
         
     | 
| 
       23 
24 
     | 
    
         
             
            end
         
     | 
| 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class FarmRanch < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "FARM"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :farm_ranch
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
12 
     | 
    
         
             
                end 
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -17,7 +17,9 @@ end 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 21 
     | 
    
         
            +
              b_date = DateTime.now-5
         
     | 
| 
      
 22 
     | 
    
         
            +
              farm_ranch = NwmlsClient::FarmRanch.new(config, begin_date: b_date)
         
     | 
| 
       21 
23 
     | 
    
         
             
              listings = farm_ranch.retrieve_data
         
     | 
| 
       22 
24 
     | 
    
         
             
              farm_ranch.display(listings)
         
     | 
| 
       23 
25 
     | 
    
         
             
            end
         
     | 
    
        data/lib/nwmls_client/history.rb
    CHANGED
    
    | 
         @@ -4,14 +4,14 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class History < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:operation] = :retrieve_listing_history_data
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:data_response] = :retrieve_listing_history_data_response
         
     | 
| 
       10 
10 
     | 
    
         
             
                  criteria[:data_result] = :retrieve_listing_history_data_result
         
     | 
| 
       11 
11 
     | 
    
         
             
                  criteria[:data_types] = :listing_history
         
     | 
| 
       12 
12 
     | 
    
         
             
                  criteria[:data_type] = :history
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       14 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 14 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       15 
15 
     | 
    
         
             
                end 
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def display(history_data)
         
     | 
| 
         @@ -20,7 +20,7 @@ module NwmlsClient 
     | 
|
| 
       20 
20 
     | 
    
         
             
                    history_data.each do |item|
         
     | 
| 
       21 
21 
     | 
    
         
             
                      item.each do |key, value|
         
     | 
| 
       22 
22 
     | 
    
         
             
                        if key.to_s == "ml_number"
         
     | 
| 
       23 
     | 
    
         
            -
                          puts "#{key}: #{value}"
         
     | 
| 
      
 23 
     | 
    
         
            +
                          puts "\n#{key}: #{value}"
         
     | 
| 
       24 
24 
     | 
    
         
             
                        else
         
     | 
| 
       25 
25 
     | 
    
         
             
                          if value.is_a?(Array)
         
     | 
| 
       26 
26 
     | 
    
         
             
                            value.each do |item2|
         
     | 
| 
         @@ -41,7 +41,9 @@ end 
     | 
|
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       44 
     | 
    
         
            -
               
     | 
| 
      
 44 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 45 
     | 
    
         
            +
              b_date = DateTime.now-5
         
     | 
| 
      
 46 
     | 
    
         
            +
              history = NwmlsClient::History.new(config, begin_date: b_date)
         
     | 
| 
       45 
47 
     | 
    
         
             
              data = history.retrieve_data
         
     | 
| 
       46 
48 
     | 
    
         
             
              #puts "#{data}"
         
     | 
| 
       47 
49 
     | 
    
         
             
              history.display(data)
         
     | 
    
        data/lib/nwmls_client/image.rb
    CHANGED
    
    | 
         @@ -1,40 +1,28 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'savon'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'base'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            module NwmlsClient
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
              class Image
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                DEFAULT_SCHEMA_NAME = 'StandardXML1_3'
         
     | 
| 
       8 
     | 
    
         
            -
                MLS = 'NWMLS'
         
     | 
| 
       9 
     | 
    
         
            -
                DEFAULT_PTYP = 'RESI'
         
     | 
| 
       10 
8 
     | 
    
         
             
                IMAGE_SCHEMA = 'NWMLS:EverNet:ImageData:1.0'
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                  @user_id = nil
         
     | 
| 
       19 
     | 
    
         
            -
                  @password = nil
         
     | 
| 
       20 
     | 
    
         
            -
                  @listing_number = listing_number    
         
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize(config, image_destination = nil)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @listing_number = nil
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @image_destination = image_destination
         
     | 
| 
      
 13 
     | 
    
         
            +
                  raise "Configuration data is required for authentication" if config.nil?
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @user_id = config.fetch("user_id")
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @password = config.fetch("password")      
         
     | 
| 
       21 
16 
     | 
    
         
             
                end
         
     | 
| 
       22 
17 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                def retrieve_images()
         
     | 
| 
      
 18 
     | 
    
         
            +
                def retrieve_images(listing_number)
         
     | 
| 
       24 
19 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                   
     | 
| 
       26 
     | 
    
         
            -
                    puts "\nBoth user_id and password must be provided.\nExample:  #{Image.name}.user_id\n\n"
         
     | 
| 
       27 
     | 
    
         
            -
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @listing_number = listing_number
         
     | 
| 
       28 
21 
     | 
    
         | 
| 
       29 
22 
     | 
    
         
             
                  request = { 'query' => build_request()}
         
     | 
| 
       30 
23 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                   
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                    response = @client.call(:retrieve_images, message: request)
         
     | 
| 
       34 
     | 
    
         
            -
                  rescue Savon::SOAPFault => error
         
     | 
| 
       35 
     | 
    
         
            -
                    #puts "The call to retrieve_listing_data failed: #{$!}"
         
     | 
| 
       36 
     | 
    
         
            -
                    puts "Error making call to retrieve_images:  #{error.http.code}"
         
     | 
| 
       37 
     | 
    
         
            -
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @client = create_client()
         
     | 
| 
      
 25 
     | 
    
         
            +
                  response = @client.call(:retrieve_images, message: request)
         
     | 
| 
       38 
26 
     | 
    
         | 
| 
       39 
27 
     | 
    
         
             
                  cdata = response.body[:retrieve_images_response][:retrieve_images_result] 
         
     | 
| 
       40 
28 
     | 
    
         
             
                  nori_options = { :convert_tags_to => lambda { |tag| tag.snakecase.to_sym } }
         
     | 
| 
         @@ -42,10 +30,9 @@ module NwmlsClient 
     | 
|
| 
       42 
30 
     | 
    
         | 
| 
       43 
31 
     | 
    
         
             
                  images_data = result[:results][:images]
         
     | 
| 
       44 
32 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
                  if images_data 
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                  else
         
     | 
| 
      
 33 
     | 
    
         
            +
                  raise "No images found:\n#{result}" if images_data.nil?
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  if @image_destination.nil?
         
     | 
| 
       49 
36 
     | 
    
         
             
                    image_folder = File.join(Dir.pwd, "images")
         
     | 
| 
       50 
37 
     | 
    
         
             
                    if not Dir.exist?(image_folder)
         
     | 
| 
       51 
38 
     | 
    
         
             
                      Dir.mkdir(image_folder)
         
     | 
| 
         @@ -55,24 +42,33 @@ module NwmlsClient 
     | 
|
| 
       55 
42 
     | 
    
         
             
                    if not Dir.exist?(dirpath)
         
     | 
| 
       56 
43 
     | 
    
         
             
                      Dir.mkdir(dirpath)
         
     | 
| 
       57 
44 
     | 
    
         
             
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
                  else
         
     | 
| 
      
 46 
     | 
    
         
            +
                    dirpath = File.join(@image_destination, "/#{@listing_number}")
         
     | 
| 
      
 47 
     | 
    
         
            +
                    if not Dir.exist?(dirpath)
         
     | 
| 
      
 48 
     | 
    
         
            +
                      Dir.mkdir(dirpath)
         
     | 
| 
      
 49 
     | 
    
         
            +
                    end
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
       58 
51 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                        filename = File.join(dirpath, "#{@listing_number}_#{image[:image_order]}.jpg")
         
     | 
| 
       64 
     | 
    
         
            -
                        File.open(filename, 'wb') do |f|
         
     | 
| 
       65 
     | 
    
         
            -
                          f.write(Base64.decode64(image[:blob]))
         
     | 
| 
       66 
     | 
    
         
            -
                        end
         
     | 
| 
       67 
     | 
    
         
            -
                      end
         
     | 
| 
       68 
     | 
    
         
            -
                    else
         
     | 
| 
       69 
     | 
    
         
            -
                      image = image_data
         
     | 
| 
      
 52 
     | 
    
         
            +
                  image_data = images_data[:image]
         
     | 
| 
      
 53 
     | 
    
         
            +
                  if image_data.is_a?(Array)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    image_data.each do |image|
         
     | 
| 
       70 
55 
     | 
    
         | 
| 
       71 
56 
     | 
    
         
             
                      filename = File.join(dirpath, "#{@listing_number}_#{image[:image_order]}.jpg")
         
     | 
| 
       72 
57 
     | 
    
         
             
                      File.open(filename, 'wb') do |f|
         
     | 
| 
       73 
58 
     | 
    
         
             
                        f.write(Base64.decode64(image[:blob]))
         
     | 
| 
       74 
59 
     | 
    
         
             
                      end
         
     | 
| 
       75 
60 
     | 
    
         
             
                    end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  else
         
     | 
| 
      
 62 
     | 
    
         
            +
                    image = image_data
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 65 
     | 
    
         
            +
                      filename = File.join(dirpath, "#{@listing_number}_#{image[:image_order]}.jpg")
         
     | 
| 
      
 66 
     | 
    
         
            +
                      File.open(filename, 'wb') do |f|
         
     | 
| 
      
 67 
     | 
    
         
            +
                        f.write(Base64.decode64(image[:blob]))
         
     | 
| 
      
 68 
     | 
    
         
            +
                      end          
         
     | 
| 
      
 69 
     | 
    
         
            +
                    rescue Exception => e
         
     | 
| 
      
 70 
     | 
    
         
            +
                      puts "Image retrieval error:  #{e.message}"
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end 
         
     | 
| 
       76 
72 
     | 
    
         
             
                  end
         
     | 
| 
       77 
73 
     | 
    
         | 
| 
       78 
74 
     | 
    
         
             
                end
         
     | 
| 
         @@ -100,8 +96,8 @@ module NwmlsClient 
     | 
|
| 
       100 
96 
     | 
    
         
             
                  xm.instruct! :xml, :version=>"1.0"
         
     | 
| 
       101 
97 
     | 
    
         
             
                  xm.ImageQuery(:xmlns => "NWMLS:EverNet:ImageQuery:1.0") {
         
     | 
| 
       102 
98 
     | 
    
         
             
                    xm.Auth {
         
     | 
| 
       103 
     | 
    
         
            -
                      xm.UserId user_id
         
     | 
| 
       104 
     | 
    
         
            -
                      xm.Password password
         
     | 
| 
      
 99 
     | 
    
         
            +
                      xm.UserId @user_id
         
     | 
| 
      
 100 
     | 
    
         
            +
                      xm.Password @password
         
     | 
| 
       105 
101 
     | 
    
         
             
                    }
         
     | 
| 
       106 
102 
     | 
    
         
             
                    xm.Query {
         
     | 
| 
       107 
103 
     | 
    
         
             
                      xm.ByListingNumber @listing_number
         
     | 
| 
         @@ -118,8 +114,7 @@ module NwmlsClient 
     | 
|
| 
       118 
114 
     | 
    
         
             
            end
         
     | 
| 
       119 
115 
     | 
    
         | 
| 
       120 
116 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       121 
     | 
    
         
            -
               
     | 
| 
       122 
     | 
    
         
            -
              image 
     | 
| 
       123 
     | 
    
         
            -
              image. 
     | 
| 
       124 
     | 
    
         
            -
              images = image.retrieve_images
         
     | 
| 
      
 117 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 118 
     | 
    
         
            +
              image = NwmlsClient::Image.new(config, "/home/tj/workspace/quorum-laurelhurst/app/assets/images/Residential")
         
     | 
| 
      
 119 
     | 
    
         
            +
              image.retrieve_images(877620)
         
     | 
| 
       125 
120 
     | 
    
         
             
            end
         
     | 
| 
         @@ -4,14 +4,14 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class ImageData < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:operation] = :retrieve_image_data
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:data_response] = :retrieve_image_data_response
         
     | 
| 
       10 
10 
     | 
    
         
             
                  criteria[:data_result] = :retrieve_image_data_result
         
     | 
| 
       11 
11 
     | 
    
         
             
                  criteria[:data_types] = :images
         
     | 
| 
       12 
12 
     | 
    
         
             
                  criteria[:data_type] = :image
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       14 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 14 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       15 
15 
     | 
    
         
             
                end 
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def display(image_data)
         
     | 
| 
         @@ -31,7 +31,8 @@ module NwmlsClient 
     | 
|
| 
       31 
31 
     | 
    
         
             
            end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
      
 34 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 35 
     | 
    
         
            +
              image_data = NwmlsClient::ImageData.new(config)
         
     | 
| 
       35 
36 
     | 
    
         
             
              data = image_data.retrieve_data
         
     | 
| 
       36 
37 
     | 
    
         
             
              image_data.display(data)
         
     | 
| 
       37 
38 
     | 
    
         
             
            end
         
     | 
    
        data/lib/nwmls_client/listing.rb
    CHANGED
    
    | 
         @@ -3,6 +3,7 @@ require 'savon' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'date'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'yaml'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require_relative 'codes'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require_relative 'base'
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            module NwmlsClient
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
         @@ -11,17 +12,20 @@ module NwmlsClient 
     | 
|
| 
       11 
12 
     | 
    
         
             
                DEFAULT_SCHEMA_NAME = 'StandardXML1_3'
         
     | 
| 
       12 
13 
     | 
    
         
             
                MLS = 'NWMLS'
         
     | 
| 
       13 
14 
     | 
    
         
             
                DEFAULT_PTYP = 'RESI'
         
     | 
| 
       14 
     | 
    
         
            -
                IMAGE_SCHEMA = 'NWMLS:EverNet:ImageData:1.0'
         
     | 
| 
       15 
15 
     | 
    
         
             
                AMENITY_FILE = 'amenity.yml'
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
                attr_accessor :mls
         
     | 
| 
       17 
18 
     | 
    
         
             
                attr_accessor :criteria
         
     | 
| 
       18 
19 
     | 
    
         
             
                attr_accessor :schema_name
         
     | 
| 
       19 
20 
     | 
    
         
             
                attr_accessor :user_id
         
     | 
| 
       20 
21 
     | 
    
         
             
                attr_accessor :password
         
     | 
| 
       21 
22 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
       23 
     | 
    
         
            -
                   
     | 
| 
       24 
     | 
    
         
            -
                  @ 
     | 
| 
      
 23 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
      
 24 
     | 
    
         
            +
                  raise "Configuration data is required for authentication" if config.nil?
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @user_id = config.fetch("user_id")
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @password = config.fetch("password")
         
     | 
| 
      
 27 
     | 
    
         
            +
                  @mls = config.fetch("mls")
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @schema_name = config.fetch("schema")
         
     | 
| 
       25 
29 
     | 
    
         
             
                  @criteria = criteria
         
     | 
| 
       26 
30 
     | 
    
         
             
                  @criteria[:property_type] ||= :residential
         
     | 
| 
       27 
31 
     | 
    
         
             
                  @criteria[:begin_date] ||= DateTime.now-1
         
     | 
| 
         @@ -36,27 +40,17 @@ module NwmlsClient 
     | 
|
| 
       36 
40 
     | 
    
         
             
                  data_types = ( @criteria[:data_types] || :listings )
         
     | 
| 
       37 
41 
     | 
    
         
             
                  data_type = ( @criteria[:data_type] || @criteria[:property_type] )
         
     | 
| 
       38 
42 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                  if !@user_id && !@password
         
     | 
| 
       40 
     | 
    
         
            -
                    puts "\nBoth user_id and password must be provided.\nExample:  #{Listing.name}.user_id\n\n"
         
     | 
| 
       41 
     | 
    
         
            -
                  end
         
     | 
| 
       42 
43 
     | 
    
         | 
| 
       43 
44 
     | 
    
         
             
                  request = { 'v_strXmlQuery' => build_request()}
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
                   
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                    response = @client.call(operation, message: request)
         
     | 
| 
       48 
     | 
    
         
            -
                  rescue Savon::SOAPFault => error
         
     | 
| 
       49 
     | 
    
         
            -
                    #puts "The call to retrieve_listing_data failed: #{$!}"
         
     | 
| 
       50 
     | 
    
         
            -
                    puts "Error making call to retrieve_listing_data:  #{error.http.code}"
         
     | 
| 
       51 
     | 
    
         
            -
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @client = create_client()
         
     | 
| 
      
 47 
     | 
    
         
            +
                  response = @client.call(operation, message: request)
         
     | 
| 
       52 
48 
     | 
    
         | 
| 
       53 
49 
     | 
    
         
             
                  cdata = response.body[data_response][data_result] 
         
     | 
| 
       54 
50 
     | 
    
         
             
                  nori_options = { :convert_tags_to => lambda { |tag| tag.snakecase.to_sym } }
         
     | 
| 
       55 
51 
     | 
    
         
             
                  result = Nori.new(nori_options).parse(cdata)
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                  if result[data_types][data_type] 
     | 
| 
       58 
     | 
    
         
            -
                    puts "Unable to retrieve data, please review returned data:\n#{result}"
         
     | 
| 
       59 
     | 
    
         
            -
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  raise "No listing data found:\n#{result}" if result[data_types][data_type].nil?
         
     | 
| 
       60 
54 
     | 
    
         | 
| 
       61 
55 
     | 
    
         
             
                  listing_data = result[data_types][data_type]
         
     | 
| 
       62 
56 
     | 
    
         | 
| 
         @@ -64,11 +58,7 @@ module NwmlsClient 
     | 
|
| 
       64 
58 
     | 
    
         | 
| 
       65 
59 
     | 
    
         
             
                def display(listing_data)
         
     | 
| 
       66 
60 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
                  if  
     | 
| 
       68 
     | 
    
         
            -
                    puts "Unable to display data.  Invalid listing_data: #{listing_data}"
         
     | 
| 
       69 
     | 
    
         
            -
                    puts "listing_data input: #{listing_data}"
         
     | 
| 
       70 
     | 
    
         
            -
                    return 
         
     | 
| 
       71 
     | 
    
         
            -
                  end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  raise "No listing data to display" if listing_data.nil?
         
     | 
| 
       72 
62 
     | 
    
         | 
| 
       73 
63 
     | 
    
         
             
                  amenity_file = File.join(File.dirname(__FILE__), AMENITY_FILE)
         
     | 
| 
       74 
64 
     | 
    
         
             
                  if not File.exist?(amenity_file)
         
     | 
| 
         @@ -162,7 +152,7 @@ module NwmlsClient 
     | 
|
| 
       162 
152 
     | 
    
         
             
                      }
         
     | 
| 
       163 
153 
     | 
    
         
             
                      xm.Body {
         
     | 
| 
       164 
154 
     | 
    
         
             
                        xm.Query {
         
     | 
| 
       165 
     | 
    
         
            -
                          xm.MLS MLS
         
     | 
| 
      
 155 
     | 
    
         
            +
                          xm.MLS (mls || MLS)
         
     | 
| 
       166 
156 
     | 
    
         
             
                          if @criteria[:listing_number]
         
     | 
| 
       167 
157 
     | 
    
         
             
                            xm.ListingNumber @criteria[:listing_number] if @criteria[:listing_number]
         
     | 
| 
       168 
158 
     | 
    
         
             
                            xm.PropertyType (@criteria[:property_code] || DEFAULT_PTYP)
         
     | 
| 
         @@ -194,9 +184,23 @@ end 
     | 
|
| 
       194 
184 
     | 
    
         | 
| 
       195 
185 
     | 
    
         | 
| 
       196 
186 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       197 
     | 
    
         
            -
               
     | 
| 
       198 
     | 
    
         
            -
              listing 
     | 
| 
       199 
     | 
    
         
            -
              listing.password = "secret_password"
         
     | 
| 
      
 187 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 188 
     | 
    
         
            +
              listing = NwmlsClient::Listing.new(config)
         
     | 
| 
       200 
189 
     | 
    
         
             
              data = listing.retrieve_data
         
     | 
| 
       201 
190 
     | 
    
         
             
              listing.display(data)
         
     | 
| 
       202 
191 
     | 
    
         
             
            end
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
            # Status  Description
         
     | 
| 
      
 194 
     | 
    
         
            +
            # A Active
         
     | 
| 
      
 195 
     | 
    
         
            +
            # CT  Contingent
         
     | 
| 
      
 196 
     | 
    
         
            +
            # PB  Pending BU Requested
         
     | 
| 
      
 197 
     | 
    
         
            +
            # PF  Pending Feasibility
         
     | 
| 
      
 198 
     | 
    
         
            +
            # PI  Pending Inspection
         
     | 
| 
      
 199 
     | 
    
         
            +
            # PS  Pending Short Sale
         
     | 
| 
      
 200 
     | 
    
         
            +
            # P Pending
         
     | 
| 
      
 201 
     | 
    
         
            +
            # E Expired
         
     | 
| 
      
 202 
     | 
    
         
            +
            # T Temp. Off Mrkt.
         
     | 
| 
      
 203 
     | 
    
         
            +
            # SFR Sale Fail Release
         
     | 
| 
      
 204 
     | 
    
         
            +
            # CA  Cancelled
         
     | 
| 
      
 205 
     | 
    
         
            +
            # R Rented
         
     | 
| 
      
 206 
     | 
    
         
            +
            # S Sold
         
     | 
| 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Manufactured < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "MANU"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :manufactured
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
12 
     | 
    
         
             
                end 
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -16,7 +16,8 @@ module NwmlsClient 
     | 
|
| 
       16 
16 
     | 
    
         
             
            end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
      
 19 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 20 
     | 
    
         
            +
              manufactured = NwmlsClient::Manufactured.new(config)
         
     | 
| 
       20 
21 
     | 
    
         
             
              listings = manufactured.retrieve_data
         
     | 
| 
       21 
22 
     | 
    
         
             
              manufactured.display(listings)
         
     | 
| 
       22 
23 
     | 
    
         
             
            end
         
     | 
    
        data/lib/nwmls_client/member.rb
    CHANGED
    
    | 
         @@ -4,14 +4,14 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Member < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:operation] = :retrieve_member_data
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:data_response] = :retrieve_member_data_response
         
     | 
| 
       10 
10 
     | 
    
         
             
                  criteria[:data_result] = :retrieve_member_data_result
         
     | 
| 
       11 
11 
     | 
    
         
             
                  criteria[:data_types] = :members
         
     | 
| 
       12 
12 
     | 
    
         
             
                  criteria[:data_type] = :member
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       14 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 14 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       15 
15 
     | 
    
         
             
                end 
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def display(member_data)
         
     | 
| 
         @@ -31,7 +31,8 @@ module NwmlsClient 
     | 
|
| 
       31 
31 
     | 
    
         
             
            end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
      
 34 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 35 
     | 
    
         
            +
              member = NwmlsClient::Member.new(config)
         
     | 
| 
       35 
36 
     | 
    
         
             
              data = member.retrieve_data
         
     | 
| 
       36 
37 
     | 
    
         
             
              #puts "#{data}"
         
     | 
| 
       37 
38 
     | 
    
         
             
              member.display(data)
         
     | 
| 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Multifamily < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "MULT"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :multi_family
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
12 
     | 
    
         
             
                end 
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -16,7 +16,8 @@ module NwmlsClient 
     | 
|
| 
       16 
16 
     | 
    
         
             
            end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
      
 19 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 20 
     | 
    
         
            +
              multi_family = NwmlsClient::Multifamily.new(config)
         
     | 
| 
       20 
21 
     | 
    
         
             
              listings = multi_family.retrieve_data
         
     | 
| 
       21 
22 
     | 
    
         
             
              multi_family.display(listings)
         
     | 
| 
       22 
23 
     | 
    
         
             
            end
         
     | 
    
        data/lib/nwmls_client/office.rb
    CHANGED
    
    | 
         @@ -4,14 +4,14 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Office < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:operation] = :retrieve_office_data
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:data_response] = :retrieve_office_data_response
         
     | 
| 
       10 
10 
     | 
    
         
             
                  criteria[:data_result] = :retrieve_office_data_result
         
     | 
| 
       11 
11 
     | 
    
         
             
                  criteria[:data_types] = :offices
         
     | 
| 
       12 
12 
     | 
    
         
             
                  criteria[:data_type] = :office
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       14 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 14 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       15 
15 
     | 
    
         
             
                end 
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def display(office_data)
         
     | 
| 
         @@ -31,7 +31,8 @@ module NwmlsClient 
     | 
|
| 
       31 
31 
     | 
    
         
             
            end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
      
 34 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 35 
     | 
    
         
            +
              office = NwmlsClient::Office.new(config)
         
     | 
| 
       35 
36 
     | 
    
         
             
              data = office.retrieve_data
         
     | 
| 
       36 
37 
     | 
    
         
             
              #puts "#{data}"
         
     | 
| 
       37 
38 
     | 
    
         
             
              office.display(data)
         
     | 
    
        data/lib/nwmls_client/rental.rb
    CHANGED
    
    | 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Rental < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "RENT"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :rental
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
12 
     | 
    
         
             
                end 
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -17,7 +17,8 @@ end 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 21 
     | 
    
         
            +
              rental = NwmlsClient::Rental.new(config)
         
     | 
| 
       21 
22 
     | 
    
         
             
              listings = rental.retrieve_data
         
     | 
| 
       22 
23 
     | 
    
         
             
              rental.display(listings)
         
     | 
| 
       23 
24 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,14 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative "base"
         
     | 
| 
       1 
2 
     | 
    
         
             
            require_relative "listing"
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            module NwmlsClient
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
              class Residential < Listing
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 8 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
9 
     | 
    
         
             
                  criteria[:property_code] = "RESI"
         
     | 
| 
       9 
10 
     | 
    
         
             
                  criteria[:property_type] = :residential
         
     | 
| 
       10 
11 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 12 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
13 
     | 
    
         
             
                end 
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
              end
         
     | 
| 
         @@ -16,8 +17,10 @@ module NwmlsClient 
     | 
|
| 
       16 
17 
     | 
    
         
             
            end
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 21 
     | 
    
         
            +
              residential = NwmlsClient::Residential.new(config, city: "Seattle", status: "S")
         
     | 
| 
       20 
22 
     | 
    
         
             
              listings = residential.retrieve_data
         
     | 
| 
       21 
23 
     | 
    
         
             
              #puts "#{listings}"
         
     | 
| 
       22 
24 
     | 
    
         
             
              residential.display(listings)
         
     | 
| 
       23 
     | 
    
         
            -
            end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
    
        data/lib/nwmls_client/school.rb
    CHANGED
    
    | 
         @@ -4,14 +4,14 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class School < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:operation] = :retrieve_school_data
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:data_response] = :retrieve_school_data_response
         
     | 
| 
       10 
10 
     | 
    
         
             
                  criteria[:data_result] = :retrieve_school_data_result
         
     | 
| 
       11 
11 
     | 
    
         
             
                  criteria[:data_types] = :schools
         
     | 
| 
       12 
12 
     | 
    
         
             
                  criteria[:data_type] = :school
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       14 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 14 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       15 
15 
     | 
    
         
             
                end 
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def display(school_data)
         
     | 
| 
         @@ -31,7 +31,8 @@ module NwmlsClient 
     | 
|
| 
       31 
31 
     | 
    
         
             
            end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
      
 34 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 35 
     | 
    
         
            +
              school = NwmlsClient::School.new(config)
         
     | 
| 
       35 
36 
     | 
    
         
             
              data = school.retrieve_data
         
     | 
| 
       36 
37 
     | 
    
         
             
              #puts "#{data}"
         
     | 
| 
       37 
38 
     | 
    
         
             
              school.display(data)
         
     | 
| 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Timeshare < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "TSHR"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :time_share
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
12 
     | 
    
         
             
                end 
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -16,7 +16,9 @@ module NwmlsClient 
     | 
|
| 
       16 
16 
     | 
    
         
             
            end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
      
 19 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 20 
     | 
    
         
            +
              b_date = DateTime.now-5
         
     | 
| 
      
 21 
     | 
    
         
            +
              time_share = NwmlsClient::Timeshare.new(config, begin_date: b_date)
         
     | 
| 
       20 
22 
     | 
    
         
             
              listings = time_share.retrieve_data
         
     | 
| 
       21 
23 
     | 
    
         
             
              time_share.display(listings)
         
     | 
| 
       22 
24 
     | 
    
         
             
            end
         
     | 
| 
         @@ -4,11 +4,11 @@ module NwmlsClient 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              class Vacantland < Listing
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def initialize(criteria = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config, criteria = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                  criteria[:property_code] = "VACL"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  criteria[:property_type] = :vacant_land
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @criteria = criteria 
         
     | 
| 
       11 
     | 
    
         
            -
                  super(@criteria)    
         
     | 
| 
      
 11 
     | 
    
         
            +
                  super(config, @criteria)    
         
     | 
| 
       12 
12 
     | 
    
         
             
                end 
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -17,7 +17,8 @@ end 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            if __FILE__ == $0
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              config = NwmlsClient::Base.load_config
         
     | 
| 
      
 21 
     | 
    
         
            +
              vacant_land = NwmlsClient::Vacantland.new(config)
         
     | 
| 
       21 
22 
     | 
    
         
             
              listings = vacant_land.retrieve_data
         
     | 
| 
       22 
23 
     | 
    
         
             
              vacant_land.display(listings)
         
     | 
| 
       23 
24 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: nwmls_client
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - TJ Flynn
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-02-03 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: savon
         
     | 
| 
         @@ -38,6 +38,7 @@ files: 
     | 
|
| 
       38 
38 
     | 
    
         
             
            - README
         
     | 
| 
       39 
39 
     | 
    
         
             
            - lib/nwmls_client/amenity.rb
         
     | 
| 
       40 
40 
     | 
    
         
             
            - lib/nwmls_client/amenity.yml
         
     | 
| 
      
 41 
     | 
    
         
            +
            - lib/nwmls_client/base.rb
         
     | 
| 
       41 
42 
     | 
    
         
             
            - lib/nwmls_client/business.rb
         
     | 
| 
       42 
43 
     | 
    
         
             
            - lib/nwmls_client/codes.rb
         
     | 
| 
       43 
44 
     | 
    
         
             
            - lib/nwmls_client/commercial.rb
         
     |