propertysolutions 0.0.14
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.
- data/MIT-LICENSE +20 -0
- data/README.md +2 -0
- data/Rakefile +21 -0
- data/app/models/property_solutions/address.rb +27 -0
- data/app/models/property_solutions/api_consumer.rb +41 -0
- data/app/models/property_solutions/phone.rb +20 -0
- data/app/models/property_solutions/properties.rb +75 -0
- data/app/models/property_solutions/property.rb +36 -0
- data/app/models/property_solutions/unit.rb +100 -0
- data/app/models/property_solutions/units.rb +47 -0
- data/bin/propertysolutions +69 -0
- data/config/routes.rb +3 -0
- data/lib/property_solutions/engine.rb +23 -0
- data/lib/property_solutions/version.rb +3 -0
- data/lib/propertysolutions.rb +14 -0
- data/lib/tasks/propertysolutions.rake +27 -0
- metadata +142 -0
    
        data/MIT-LICENSE
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            Copyright 2013 YOURNAME
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 4 | 
            +
            a copy of this software and associated documentation files (the
         | 
| 5 | 
            +
            "Software"), to deal in the Software without restriction, including
         | 
| 6 | 
            +
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 7 | 
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 8 | 
            +
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 9 | 
            +
            the following conditions:
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 12 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 15 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 16 | 
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 17 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 18 | 
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 19 | 
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 20 | 
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            #!/usr/bin/env rake
         | 
| 2 | 
            +
            begin
         | 
| 3 | 
            +
              require 'bundler/setup'
         | 
| 4 | 
            +
            rescue LoadError
         | 
| 5 | 
            +
              puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
         | 
| 6 | 
            +
            end
         | 
| 7 | 
            +
            begin
         | 
| 8 | 
            +
              require 'rdoc/task'
         | 
| 9 | 
            +
            rescue LoadError
         | 
| 10 | 
            +
              require 'rdoc/rdoc'
         | 
| 11 | 
            +
              require 'rake/rdoctask'
         | 
| 12 | 
            +
              RDoc::Task = Rake::RDocTask
         | 
| 13 | 
            +
            end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            RDoc::Task.new(:rdoc) do |rdoc|
         | 
| 16 | 
            +
              rdoc.rdoc_dir = 'rdoc'
         | 
| 17 | 
            +
              rdoc.title    = 'ProperySolutions'
         | 
| 18 | 
            +
              rdoc.options << '--line-numbers'
         | 
| 19 | 
            +
              rdoc.rdoc_files.include('README.rdoc')
         | 
| 20 | 
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         | 
| 21 | 
            +
            end
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module PropertySolutions
         | 
| 3 | 
            +
              class Address
         | 
| 4 | 
            +
                
         | 
| 5 | 
            +
                attr_accessor :address, :city, :state, :zip, :country  
         | 
| 6 | 
            +
                
         | 
| 7 | 
            +
                def initialize(arr = nil)
         | 
| 8 | 
            +
                  if (arr.nil?)
         | 
| 9 | 
            +
                    @address  = "" 
         | 
| 10 | 
            +
                    @city     = "" 
         | 
| 11 | 
            +
                    @state    = "" 
         | 
| 12 | 
            +
                    @zip      = "" 
         | 
| 13 | 
            +
                    @country  = ""
         | 
| 14 | 
            +
                  else
         | 
| 15 | 
            +
                    parse(arr)
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
                
         | 
| 19 | 
            +
                def parse(arr)
         | 
| 20 | 
            +
                  @address  = arr['Address']      || "" 
         | 
| 21 | 
            +
                  @city     = arr['City']         || ""
         | 
| 22 | 
            +
                  @state    = arr['State']        || ""
         | 
| 23 | 
            +
                  @zip      = arr['PostalCode']   || ""
         | 
| 24 | 
            +
                  @country  = arr['Country']      || ""
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            class PropertySolutions::ApiConsumer
         | 
| 3 | 
            +
              
         | 
| 4 | 
            +
              @@field_order = 'id'
         | 
| 5 | 
            +
              @@base = ''
         | 
| 6 | 
            +
              
         | 
| 7 | 
            +
              def self.request(method, data = nil)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                data = {} if data.nil?
         | 
| 10 | 
            +
                data.delete_if { |k,v| v.nil? }
         | 
| 11 | 
            +
                
         | 
| 12 | 
            +
                data = {
         | 
| 13 | 
            +
                  'auth' => {
         | 
| 14 | 
            +
                    'type'     => "basic",
         | 
| 15 | 
            +
                    'username' => PropertySolutions::username,
         | 
| 16 | 
            +
                    'password' => PropertySolutions::password,
         | 
| 17 | 
            +
                  },
         | 
| 18 | 
            +
                  'method' => {
         | 
| 19 | 
            +
                    'name'   => method, # required_service_name
         | 
| 20 | 
            +
                    'params' => data # parameters required for the web service
         | 
| 21 | 
            +
                  }
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                resp = Typhoeus::Request.new(
         | 
| 25 | 
            +
                    "https://#{PropertySolutions::domain}.propertysolutions.com/api/#{@@base}",
         | 
| 26 | 
            +
                    method:   :post,
         | 
| 27 | 
            +
                    headers:  { 'Content-type' => 'application/json, charset: utf-8' },
         | 
| 28 | 
            +
                    body:     data.to_json       
         | 
| 29 | 
            +
                  ).run
         | 
| 30 | 
            +
                resp = JSON.parse(resp.response_body)
         | 
| 31 | 
            +
                if (resp['response'].nil? || !resp['response']['error'].nil? || resp['response']['result'].nil?)
         | 
| 32 | 
            +
                  return false
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
                return resp = resp['response']['result']
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
              
         | 
| 37 | 
            +
              def self.sort(arr)
         | 
| 38 | 
            +
                return arr.sort { |x,y| x.send(@@field_order.to_sym) <=> y.send(@@field_order.to_sym) }
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            end
         | 
| @@ -0,0 +1,20 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module PropertySolutions
         | 
| 3 | 
            +
              class Phone
         | 
| 4 | 
            +
                
         | 
| 5 | 
            +
                attr_accessor :number, :description
         | 
| 6 | 
            +
                
         | 
| 7 | 
            +
                def initialize(arr = nil)
         | 
| 8 | 
            +
                  if (arr.nil?)
         | 
| 9 | 
            +
                    @number = ""
         | 
| 10 | 
            +
                    @description = ""
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
                
         | 
| 14 | 
            +
                def parse(arr)
         | 
| 15 | 
            +
                  @number       = arr["PhoneNumber"]      || ""
         | 
| 16 | 
            +
                  @description  = arr["PhoneDescription"] || ""
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
            end
         | 
| @@ -0,0 +1,75 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module PropertySolutions
         | 
| 3 | 
            +
              class Properties < PropertySolutions::ApiConsumer
         | 
| 4 | 
            +
                
         | 
| 5 | 
            +
                @@field_order = 'id'
         | 
| 6 | 
            +
                @@base = 'properties' 
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
                # Find a property given a property ID
         | 
| 9 | 
            +
                def self.find(property_id)
         | 
| 10 | 
            +
                  resp = self.request('getProperties', {
         | 
| 11 | 
            +
                    'propertyIds' => [property_id]
         | 
| 12 | 
            +
                  })
         | 
| 13 | 
            +
                  return nil if !resp || resp['PhysicalProperty'].nil? || resp['PhysicalProperty']['Property'].nil?
         | 
| 14 | 
            +
                  prop = Property.new(resp['PhysicalProperty']['Property'][0]) 
         | 
| 15 | 
            +
                  return prop
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
                
         | 
| 18 | 
            +
                # Reorder the properties that will be returned based on the given field
         | 
| 19 | 
            +
                def self.reorder(field)
         | 
| 20 | 
            +
                  @@field_order = field 
         | 
| 21 | 
            +
                  return self
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
                
         | 
| 24 | 
            +
                # Return all the properties
         | 
| 25 | 
            +
                def self.all
         | 
| 26 | 
            +
                  return self.properties
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
                
         | 
| 29 | 
            +
                # Return all the properties
         | 
| 30 | 
            +
                def self.properties(property_ids = nil)
         | 
| 31 | 
            +
                  resp = self.request('getProperties', {
         | 
| 32 | 
            +
                    'propertyIds' => property_ids
         | 
| 33 | 
            +
                  })
         | 
| 34 | 
            +
                  return [] if !resp || resp['PhysicalProperty'].nil? || resp['PhysicalProperty']['Property'].nil?
         | 
| 35 | 
            +
                  props = resp['PhysicalProperty']['Property'].collect { |p| Property.new(p) }
         | 
| 36 | 
            +
                  props.sort! { |x,y| 
         | 
| 37 | 
            +
                    x.send(@@field_order.to_sym) <=> y.send(@@field_order.to_sym) 
         | 
| 38 | 
            +
                  }
         | 
| 39 | 
            +
                  return props
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
                
         | 
| 42 | 
            +
                #def self.floor_plans(property_id, property_floor_plan_ids = nil)
         | 
| 43 | 
            +
                #  return self.request('getFloorPlans', { 
         | 
| 44 | 
            +
                #    'propertyId' => property_id,
         | 
| 45 | 
            +
                #    'propertyFloorPlanIds' => property_floor_plan_ids
         | 
| 46 | 
            +
                #  })
         | 
| 47 | 
            +
                #end
         | 
| 48 | 
            +
                #
         | 
| 49 | 
            +
                #def self.pet_types(property_ids)
         | 
| 50 | 
            +
                #  return self.request('getGetTypes', { 
         | 
| 51 | 
            +
                #    'propertyIds' => property_ids 
         | 
| 52 | 
            +
                #  })
         | 
| 53 | 
            +
                #end
         | 
| 54 | 
            +
                #
         | 
| 55 | 
            +
                #def self.rentable_items(property_id)
         | 
| 56 | 
            +
                #  return self.request('getRentableItems', { 
         | 
| 57 | 
            +
                #    'propertyId' => property_id 
         | 
| 58 | 
            +
                #  })
         | 
| 59 | 
            +
                #end
         | 
| 60 | 
            +
                #
         | 
| 61 | 
            +
                #def self.property_pick_lists(property_ids)
         | 
| 62 | 
            +
                #  return self.request('getPropertyPickLists', { 
         | 
| 63 | 
            +
                #    'propertyIds' => property_ids 
         | 
| 64 | 
            +
                #  })
         | 
| 65 | 
            +
                #end
         | 
| 66 | 
            +
                #
         | 
| 67 | 
            +
                #def self.property_preferences(property_id, keys = nil)
         | 
| 68 | 
            +
                #  return self.request('getPropertyPreferences', { 
         | 
| 69 | 
            +
                #    'property_id' => property_id,
         | 
| 70 | 
            +
                #    'keys' => keys
         | 
| 71 | 
            +
                #  })
         | 
| 72 | 
            +
                #end
         | 
| 73 | 
            +
              
         | 
| 74 | 
            +
              end
         | 
| 75 | 
            +
            end
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module PropertySolutions  
         | 
| 3 | 
            +
              class Property
         | 
| 4 | 
            +
                
         | 
| 5 | 
            +
                attr_accessor :id, :name, :type, :short_desc, :long_desc, :website, :address, :phone, :disabled
         | 
| 6 | 
            +
                
         | 
| 7 | 
            +
                def initialize(arr)
         | 
| 8 | 
            +
                  if (arr.nil?)
         | 
| 9 | 
            +
                    @id          = ""
         | 
| 10 | 
            +
                    @name        = ""
         | 
| 11 | 
            +
                    @type        = ""
         | 
| 12 | 
            +
                    @short_desc  = ""
         | 
| 13 | 
            +
                    @long_desc   = ""
         | 
| 14 | 
            +
                    @website     = ""
         | 
| 15 | 
            +
                    @address     = Address.new
         | 
| 16 | 
            +
                    @phone       = Phone.new
         | 
| 17 | 
            +
                    @disabled    = false
         | 
| 18 | 
            +
                  else
         | 
| 19 | 
            +
                    parse(arr)
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              
         | 
| 23 | 
            +
                def parse(arr)
         | 
| 24 | 
            +
                  @id          = arr['PropertyID']        || "" 
         | 
| 25 | 
            +
                  @name        = arr['MarketingName']     || ""
         | 
| 26 | 
            +
                  @type        = arr['Apartment']         || ""
         | 
| 27 | 
            +
                  @short_desc  = arr['ShortDescription']  || ""
         | 
| 28 | 
            +
                  @long_desc   = arr['LongDescription']   || ""
         | 
| 29 | 
            +
                  @website     = arr['webSite']           || ""
         | 
| 30 | 
            +
                  @address     = Address.new(arr['Address'])
         | 
| 31 | 
            +
                  @phone       = Phone.new(arr['Phone'])
         | 
| 32 | 
            +
                  @disabled    = arr['IsDisabled']        || ""
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
                    
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
            end
         | 
| @@ -0,0 +1,100 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module PropertySolutions  
         | 
| 3 | 
            +
              class Unit
         | 
| 4 | 
            +
                
         | 
| 5 | 
            +
                attr_accessor :id, :name, :type, :short_desc, :long_desc, :website, :address, :phone, :disabled
         | 
| 6 | 
            +
                
         | 
| 7 | 
            +
                def initialize(arr)
         | 
| 8 | 
            +
                  if (arr.nil?)
         | 
| 9 | 
            +
                    @id          = ""
         | 
| 10 | 
            +
                    @name        = ""
         | 
| 11 | 
            +
                    @type        = ""
         | 
| 12 | 
            +
                    @short_desc  = ""
         | 
| 13 | 
            +
                    @long_desc   = ""
         | 
| 14 | 
            +
                    @website     = ""
         | 
| 15 | 
            +
                    @address     = Address.new
         | 
| 16 | 
            +
                    @phone       = Phone.new
         | 
| 17 | 
            +
                    @disabled    = false
         | 
| 18 | 
            +
                  else
         | 
| 19 | 
            +
                    parse(arr)
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              
         | 
| 23 | 
            +
                def parse(arr)        
         | 
| 24 | 
            +
                  @number           = arr["@attributes"]["UnitNumber"]      || ""
         | 
| 25 | 
            +
                  @unit_id          = arr["@attributes"]["PropertyUnitId"]  || ""
         | 
| 26 | 
            +
                  @unit_type_id     = arr["@attributes"]["UnitTypeId"]      || ""
         | 
| 27 | 
            +
                  @floor_plan_id    = arr["@attributes"]["FloorplanId"]     || ""
         | 
| 28 | 
            +
                  @floor_plan_name  = arr["@attributes"]["FloorPlanName"]   || ""
         | 
| 29 | 
            +
                  @availability     = arr["@attributes"]["Availability"]    || ""
         | 
| 30 | 
            +
                  
         | 
| 31 | 
            +
            #      arr["Rent"]
         | 
| 32 | 
            +
            #      
         | 
| 33 | 
            +
            #        },
         | 
| 34 | 
            +
            #        "Rent"=>{
         | 
| 35 | 
            +
            #          "TermRent"=>[
         | 
| 36 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>6, "Rent"=>"0.00"}},
         | 
| 37 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>12, "Rent"=>"0.00"}},
         | 
| 38 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>18, "Rent"=>"0.00"}}
         | 
| 39 | 
            +
            #          ],
         | 
| 40 | 
            +
            #         "@attributes"=>{"MinRent"=>"0.00", "MaxRent"=>"0.00"}
         | 
| 41 | 
            +
            #        },
         | 
| 42 | 
            +
            #        "Deposit"=>{
         | 
| 43 | 
            +
            #          "@attributes"=>{"MinDeposit"=>"0.00", "MaxDeposit"=>"200.00"}
         | 
| 44 | 
            +
            #        }
         | 
| 45 | 
            +
            #      },
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
            end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            #{
         | 
| 52 | 
            +
            #  "ILS_Units"=> {
         | 
| 53 | 
            +
            #    "Unit"=> [
         | 
| 54 | 
            +
            #      {
         | 
| 55 | 
            +
            #        "@attributes"=>{
         | 
| 56 | 
            +
            #          "UnitNumber"=>"123-A", 
         | 
| 57 | 
            +
            #          "FloorPlanName"=>"Two Bed/ Two Bath",
         | 
| 58 | 
            +
            #          "Availability"=>"Not Available",
         | 
| 59 | 
            +
            #          "FloorplanId"=>137634,
         | 
| 60 | 
            +
            #          "UnitTypeId"=>"153497",
         | 
| 61 | 
            +
            #          "PropertyUnitId"=>2422769
         | 
| 62 | 
            +
            #        },
         | 
| 63 | 
            +
            #        "Rent"=>{
         | 
| 64 | 
            +
            #          "TermRent"=>[
         | 
| 65 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>6, "Rent"=>"0.00"}},
         | 
| 66 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>12, "Rent"=>"0.00"}},
         | 
| 67 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>18, "Rent"=>"0.00"}}
         | 
| 68 | 
            +
            #          ],
         | 
| 69 | 
            +
            #         "@attributes"=>{"MinRent"=>"0.00", "MaxRent"=>"0.00"}
         | 
| 70 | 
            +
            #        },
         | 
| 71 | 
            +
            #        "Deposit"=>{
         | 
| 72 | 
            +
            #          "@attributes"=>{"MinDeposit"=>"0.00", "MaxDeposit"=>"200.00"}
         | 
| 73 | 
            +
            #        }
         | 
| 74 | 
            +
            #      },
         | 
| 75 | 
            +
            #      {
         | 
| 76 | 
            +
            #        "@attributes"=>{
         | 
| 77 | 
            +
            #          "UnitNumber"=>"123-B",
         | 
| 78 | 
            +
            #          "FloorPlanName"=>"Two Bed/ Two Bath",
         | 
| 79 | 
            +
            #          "Availability"=>"Not Available", 
         | 
| 80 | 
            +
            #          "FloorplanId"=>137634, 
         | 
| 81 | 
            +
            #          "UnitTypeId"=>"153497", 
         | 
| 82 | 
            +
            #          "PropertyUnitId"=>2422769
         | 
| 83 | 
            +
            #        },
         | 
| 84 | 
            +
            #        "Rent"=>{
         | 
| 85 | 
            +
            #          "TermRent"=>[
         | 
| 86 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>6, "Rent"=>"0.00"}},
         | 
| 87 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>12, "Rent"=>"0.00"}},
         | 
| 88 | 
            +
            #            {"@attributes"=>{"LeaseTerm"=>18, "Rent"=>"0.00"}}
         | 
| 89 | 
            +
            #          ],
         | 
| 90 | 
            +
            #          "@attributes"=>{"MinRent"=>"0.00", "MaxRent"=>"0.00"}
         | 
| 91 | 
            +
            #        },
         | 
| 92 | 
            +
            #        "Deposit"=>{
         | 
| 93 | 
            +
            #          "@attributes"=>{
         | 
| 94 | 
            +
            #            "MinDeposit"=>"0.00", "MaxDeposit"=>"200.00"
         | 
| 95 | 
            +
            #          }
         | 
| 96 | 
            +
            #        }
         | 
| 97 | 
            +
            #      }
         | 
| 98 | 
            +
            #    ]
         | 
| 99 | 
            +
            #  }
         | 
| 100 | 
            +
            #}
         | 
| @@ -0,0 +1,47 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module PropertySolutions
         | 
| 3 | 
            +
              class Units < PropertySolutions::ApiConsumer
         | 
| 4 | 
            +
              
         | 
| 5 | 
            +
                @@field_order = 'id'
         | 
| 6 | 
            +
                @@base = 'propertyunits'
         | 
| 7 | 
            +
                
         | 
| 8 | 
            +
             	  ## Returns a list of unit types for a given property id
         | 
| 9 | 
            +
             	  #def self.unit_types(property_id)
         | 
| 10 | 
            +
             	  #  return self.request('getUnitTypes', {
         | 
| 11 | 
            +
             	  #    'propertyId' => property_id
         | 
| 12 | 
            +
             	  #  })
         | 
| 13 | 
            +
             	  #end
         | 
| 14 | 
            +
             	  #
         | 
| 15 | 
            +
             	  ## Pulls a Specials/Concessions for the propertyId passed.
         | 
| 16 | 
            +
             	  #def self.specials(property_id)
         | 
| 17 | 
            +
             	  #  return self.request('getSpecials', {
         | 
| 18 | 
            +
             	  #    'propertyId' => property_id
         | 
| 19 | 
            +
             	  #  })
         | 
| 20 | 
            +
             	  #end
         | 
| 21 | 
            +
             	  
         | 
| 22 | 
            +
             	  # Pulls a list of Unit availability and their pricing
         | 
| 23 | 
            +
             	  def self.where(options)
         | 
| 24 | 
            +
             	    resp = self.request('getUnitsAvailabilityAndPricing', {
         | 
| 25 | 
            +
             	      'propertyId'         => options['property_id'],   # [Integer] required
         | 
| 26 | 
            +
             	      'floorplanId'        => options['floor_plan_id'], # [Integer] optional
         | 
| 27 | 
            +
             	      'unitTypeId'         => options['unit_type_id'],  # [Integer] optional
         | 
| 28 | 
            +
             	      'propertyUnitId'     => options['unit_id'],       # [Integer] optional
         | 
| 29 | 
            +
             	      'availableUnitsOnly' => options['available']      # [Boolean] optional
         | 
| 30 | 
            +
             	    })
         | 
| 31 | 
            +
             	    return resp
         | 
| 32 | 
            +
             	    #return [] if !resp || resp['PhysicalProperty'].nil? || resp['PhysicalProperty']['Property'].nil?
         | 
| 33 | 
            +
                  #units = resp['PhysicalProperty']['Property'].collect { |p| Property.new(p) }
         | 
| 34 | 
            +
                  #units = self.sort(units)
         | 
| 35 | 
            +
                  #return units
         | 
| 36 | 
            +
             	  end
         | 
| 37 | 
            +
                
         | 
| 38 | 
            +
                ## Pulls a list of Amenities
         | 
| 39 | 
            +
                #def self.amenities(property_id, unit_number = nil)
         | 
| 40 | 
            +
                #  return self.request('getAmenities', {      
         | 
| 41 | 
            +
                #    'propertyId' => property_id,
         | 
| 42 | 
            +
                #    'unitNumber' => unit_number
         | 
| 43 | 
            +
                #  })
         | 
| 44 | 
            +
                #end
         | 
| 45 | 
            +
                
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
            end
         | 
| @@ -0,0 +1,69 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'rails/all'
         | 
| 4 | 
            +
            require 'propertysolutions'
         | 
| 5 | 
            +
            require 'propertysolutions/engine'
         | 
| 6 | 
            +
            require 'propertysolutions/version'
         | 
| 7 | 
            +
            require 'propertysolutions/ps_helper'
         | 
| 8 | 
            +
            require 'trollop'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            #puts "Usage:"
         | 
| 11 | 
            +
            #puts "Create a new propertysolutions app:"
         | 
| 12 | 
            +
            #puts "  propertysolutions new <app_path>"
         | 
| 13 | 
            +
            #puts "Initialize an existing rails app as a new propertysolutions app:"
         | 
| 14 | 
            +
            #puts "  propertysolutions init [<app_path>]\n\n"
         | 
| 15 | 
            +
            #exit
         | 
| 16 | 
            +
              
         | 
| 17 | 
            +
            #global_opts = Trollop::options do
         | 
| 18 | 
            +
            #  banner <<-EOS
         | 
| 19 | 
            +
            #--------------------------------------------------------------------------------  
         | 
| 20 | 
            +
            #Property Solutions
         | 
| 21 | 
            +
            #A gem to consume the Property Solutions API
         | 
| 22 | 
            +
            #--------------------------------------------------------------------------------
         | 
| 23 | 
            +
            #Usage:
         | 
| 24 | 
            +
            #propertysolutions new <path>
         | 
| 25 | 
            +
            #propertysolutions init [--force] [<path>]
         | 
| 26 | 
            +
            #--------------------------------------------------------------------------------
         | 
| 27 | 
            +
            #EOS
         | 
| 28 | 
            +
            #  version "Caboose CMS Version #{Caboose::VERSION}\n\n"
         | 
| 29 | 
            +
            #  stop_on ['version', 'new', 'init']
         | 
| 30 | 
            +
            #end
         | 
| 31 | 
            +
            #
         | 
| 32 | 
            +
            #cmd = ARGV.shift
         | 
| 33 | 
            +
            #case cmd
         | 
| 34 | 
            +
            #
         | 
| 35 | 
            +
            #when 'new'
         | 
| 36 | 
            +
            #  
         | 
| 37 | 
            +
            #  path = ARGV.shift
         | 
| 38 | 
            +
            #  if (path.nil?)
         | 
| 39 | 
            +
            #    puts "Error: path for new app is required.\n\n"
         | 
| 40 | 
            +
            #    global_opts.help
         | 
| 41 | 
            +
            #    exit
         | 
| 42 | 
            +
            #  end
         | 
| 43 | 
            +
            #  
         | 
| 44 | 
            +
            #  puts "Creating the new rails app..."
         | 
| 45 | 
            +
            #  `rails new #{path} -d=mysql`  
         | 
| 46 | 
            +
            #  helper = CabooseHelper.new(path, true)
         | 
| 47 | 
            +
            #  helper.init_all
         | 
| 48 | 
            +
            #  
         | 
| 49 | 
            +
            #when 'init'
         | 
| 50 | 
            +
            #  
         | 
| 51 | 
            +
            #  opts = Trollop::options do
         | 
| 52 | 
            +
            #    opt :force, 'Force re-installation of all propertysolutions files.', :default => false
         | 
| 53 | 
            +
            #  end
         | 
| 54 | 
            +
            #  
         | 
| 55 | 
            +
            #  path = ARGV.shift
         | 
| 56 | 
            +
            #  path = Dir.pwd if path.nil?  
         | 
| 57 | 
            +
            #  is_rails_app = File.exists?(File.join(path, 'config', 'environment.rb'))  
         | 
| 58 | 
            +
            #  if (!is_rails_app)
         | 
| 59 | 
            +
            #    puts "Error: Not a rails app.\n\n"
         | 
| 60 | 
            +
            #    global_opts.help
         | 
| 61 | 
            +
            #    exit
         | 
| 62 | 
            +
            #  end
         | 
| 63 | 
            +
            #  
         | 
| 64 | 
            +
            #  helper = CabooseHelper.new(path, opts.force)
         | 
| 65 | 
            +
            #  helper.init_all
         | 
| 66 | 
            +
            #  
         | 
| 67 | 
            +
            #else
         | 
| 68 | 
            +
            #end
         | 
| 69 | 
            +
            #
         | 
    
        data/config/routes.rb
    ADDED
    
    
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            require 'typhoeus'
         | 
| 2 | 
            +
            require 'json'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module PropertySolutions
         | 
| 5 | 
            +
              
         | 
| 6 | 
            +
              def PropertySolutions.log(message, title = nil)
         | 
| 7 | 
            +
                if (Rails.logger.nil?)
         | 
| 8 | 
            +
                  puts "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
         | 
| 9 | 
            +
                  puts title.to_s unless title.nil?
         | 
| 10 | 
            +
                  puts message
         | 
| 11 | 
            +
                  puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
         | 
| 12 | 
            +
                else
         | 
| 13 | 
            +
                  Rails.logger.debug("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
         | 
| 14 | 
            +
                  Rails.logger.debug(title.to_s) unless title.nil?
         | 
| 15 | 
            +
                  Rails.logger.debug(message)
         | 
| 16 | 
            +
                  Rails.logger.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n")
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
               
         | 
| 20 | 
            +
              class Engine < ::Rails::Engine
         | 
| 21 | 
            +
                isolate_namespace PropertySolutions
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            require "property_solutions/version"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            namespace :property_solutions do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              desc "Initializes the database for a caboose installation"
         | 
| 6 | 
            +
              task :db => :environment do
         | 
| 7 | 
            +
                drop_tables
         | 
| 8 | 
            +
                create_tables
         | 
| 9 | 
            +
                load_data
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
              desc "Drops all caboose tables"
         | 
| 12 | 
            +
              task :drop_tables => :environment do drop_tables end
         | 
| 13 | 
            +
              desc "Creates all caboose tables"
         | 
| 14 | 
            +
              task :create_tables => :environment do create_tables end
         | 
| 15 | 
            +
              desc "Loads data into caboose tables"
         | 
| 16 | 
            +
              task :load_data => :environment do load_data end
         | 
| 17 | 
            +
              
         | 
| 18 | 
            +
              def drop_tables
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
              
         | 
| 21 | 
            +
              def create_tables
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
              
         | 
| 24 | 
            +
              def load_data
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,142 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: propertysolutions
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.0.14
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
            platform: ruby
         | 
| 7 | 
            +
            authors:
         | 
| 8 | 
            +
            - William Barry
         | 
| 9 | 
            +
            autorequire: 
         | 
| 10 | 
            +
            bindir: bin
         | 
| 11 | 
            +
            cert_chain: []
         | 
| 12 | 
            +
            date: 2013-06-13 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: rails
         | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                none: false
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - ~>
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: 3.2.13
         | 
| 22 | 
            +
              type: :runtime
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements:
         | 
| 27 | 
            +
                - - ~>
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            +
                    version: 3.2.13
         | 
| 30 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 31 | 
            +
              name: activesupport
         | 
| 32 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            +
                none: false
         | 
| 34 | 
            +
                requirements:
         | 
| 35 | 
            +
                - - ! '>='
         | 
| 36 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            +
                    version: '0'
         | 
| 38 | 
            +
              type: :runtime
         | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            +
                none: false
         | 
| 42 | 
            +
                requirements:
         | 
| 43 | 
            +
                - - ! '>='
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            +
                    version: '0'
         | 
| 46 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 47 | 
            +
              name: trollop
         | 
| 48 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            +
                none: false
         | 
| 50 | 
            +
                requirements:
         | 
| 51 | 
            +
                - - ! '>='
         | 
| 52 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            +
                    version: '0'
         | 
| 54 | 
            +
              type: :runtime
         | 
| 55 | 
            +
              prerelease: false
         | 
| 56 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            +
                none: false
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ! '>='
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 63 | 
            +
              name: typhoeus
         | 
| 64 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                none: false
         | 
| 66 | 
            +
                requirements:
         | 
| 67 | 
            +
                - - ! '>='
         | 
| 68 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            +
                    version: '0'
         | 
| 70 | 
            +
              type: :runtime
         | 
| 71 | 
            +
              prerelease: false
         | 
| 72 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            +
                none: false
         | 
| 74 | 
            +
                requirements:
         | 
| 75 | 
            +
                - - ! '>='
         | 
| 76 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 77 | 
            +
                    version: '0'
         | 
| 78 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 79 | 
            +
              name: json
         | 
| 80 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 | 
            +
                none: false
         | 
| 82 | 
            +
                requirements:
         | 
| 83 | 
            +
                - - ! '>='
         | 
| 84 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 85 | 
            +
                    version: '0'
         | 
| 86 | 
            +
              type: :runtime
         | 
| 87 | 
            +
              prerelease: false
         | 
| 88 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 89 | 
            +
                none: false
         | 
| 90 | 
            +
                requirements:
         | 
| 91 | 
            +
                - - ! '>='
         | 
| 92 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 93 | 
            +
                    version: '0'
         | 
| 94 | 
            +
            description: A gem that interacts with the property management site propertysolutions.com
         | 
| 95 | 
            +
            email:
         | 
| 96 | 
            +
            - william@nine.is
         | 
| 97 | 
            +
            executables:
         | 
| 98 | 
            +
            - propertysolutions
         | 
| 99 | 
            +
            extensions: []
         | 
| 100 | 
            +
            extra_rdoc_files: []
         | 
| 101 | 
            +
            files:
         | 
| 102 | 
            +
            - app/models/property_solutions/address.rb
         | 
| 103 | 
            +
            - app/models/property_solutions/api_consumer.rb
         | 
| 104 | 
            +
            - app/models/property_solutions/phone.rb
         | 
| 105 | 
            +
            - app/models/property_solutions/properties.rb
         | 
| 106 | 
            +
            - app/models/property_solutions/property.rb
         | 
| 107 | 
            +
            - app/models/property_solutions/unit.rb
         | 
| 108 | 
            +
            - app/models/property_solutions/units.rb
         | 
| 109 | 
            +
            - bin/propertysolutions
         | 
| 110 | 
            +
            - config/routes.rb
         | 
| 111 | 
            +
            - lib/property_solutions/engine.rb
         | 
| 112 | 
            +
            - lib/property_solutions/version.rb
         | 
| 113 | 
            +
            - lib/propertysolutions.rb
         | 
| 114 | 
            +
            - lib/tasks/propertysolutions.rake
         | 
| 115 | 
            +
            - MIT-LICENSE
         | 
| 116 | 
            +
            - Rakefile
         | 
| 117 | 
            +
            - README.md
         | 
| 118 | 
            +
            homepage: http://github.com/williambarry007/propertysolutions
         | 
| 119 | 
            +
            licenses: []
         | 
| 120 | 
            +
            post_install_message: 
         | 
| 121 | 
            +
            rdoc_options: []
         | 
| 122 | 
            +
            require_paths:
         | 
| 123 | 
            +
            - lib
         | 
| 124 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 125 | 
            +
              none: false
         | 
| 126 | 
            +
              requirements:
         | 
| 127 | 
            +
              - - ! '>='
         | 
| 128 | 
            +
                - !ruby/object:Gem::Version
         | 
| 129 | 
            +
                  version: '0'
         | 
| 130 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 131 | 
            +
              none: false
         | 
| 132 | 
            +
              requirements:
         | 
| 133 | 
            +
              - - ! '>='
         | 
| 134 | 
            +
                - !ruby/object:Gem::Version
         | 
| 135 | 
            +
                  version: '0'
         | 
| 136 | 
            +
            requirements: []
         | 
| 137 | 
            +
            rubyforge_project: 
         | 
| 138 | 
            +
            rubygems_version: 1.8.25
         | 
| 139 | 
            +
            signing_key: 
         | 
| 140 | 
            +
            specification_version: 3
         | 
| 141 | 
            +
            summary: A gem to help consume the API for propertysolutions.com
         | 
| 142 | 
            +
            test_files: []
         |