Sha256: ef79c2da7a877980622e031704604d84e1a23f3cda0fd2998e2a08c0f8f6ee61

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require 'rets4r/core_ext/class/attribute_accessors'
require 'rets4r/core_ext/hash/keys'
require 'rets4r/core_ext/hash/slice'

module RETS4R
  class ListingService
    # RECORD_COUNT_ONLY=Librets::SearchRequest::RECORD_COUNT_ONLY
    RECORD_COUNT_ONLY='fixme'
    # Contains the listing service configurations - typically stored in
    # config/listing_service.yml - as a Hash.
    cattr_accessor :configurations, :instance_writer => false
    cattr_accessor :env, :instance_writer => false

    class << self

      # Connection configuration for the specified environment, or the current
      # environment if none is given.
      def connection(spec = nil)
        case spec
          when nil
            connection(RETS4R::ListingService.env)
          when Symbol, String
            if configuration = configurations[spec.to_s]
              configuration.symbolize_keys
            else
              raise ArgumentError, "#{spec} listing service is not configured"
            end
          else
            raise ArgumentError, "#{spec} listing service is not configured"
        end
      end

    end # class << self
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
rets4r-1.1.18 lib/rets4r/listing_service.rb
jschairb-rets4r-1.1.18 lib/rets4r/listing_service.rb
josephholsten-rets4r-1.1.17 lib/rets4r/listing_service.rb