Sha256: 974415748ea231251a3da224242c54da643fef92bf58c4f533ce9ef388f9136e

Contents?: true

Size: 709 Bytes

Versions: 8

Compression:

Stored size: 709 Bytes

Contents

module Ratis

  class LocationTypeAhead

    def self.where(conditions={})
      search_text = conditions.delete(:search)
      raise ArgumentError.new('You must provide some search text') unless search_text

      Ratis.all_conditions_used? conditions

      response = Request.get 'Locationtypeahead', { 'Search' => search_text.downcase }

      return "" unless response.success?

      response_code = response.to_hash[:locationtypeahead_response][:responsecode]
      locations     = response.to_array :locationtypeahead_response, :items, :item

      locations.map do |location_hash|
        Ratis::LocationTypeAheadItem.new(location_hash.merge(responsecode: response_code))
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ratis-3.6.6 lib/ratis/location_type_ahead.rb
ratis-3.6.5 lib/ratis/location_type_ahead.rb
ratis-3.6.4 lib/ratis/location_type_ahead.rb
ratis-3.6.3 lib/ratis/location_type_ahead.rb
ratis-3.6.2 lib/ratis/location_type_ahead.rb
ratis-3.6.1 lib/ratis/location_type_ahead.rb
ratis-3.6.0 lib/ratis/location_type_ahead.rb
ratis-3.5.0 lib/ratis/location_type_ahead.rb