Sha256: 530ede377482712a8953195a1fd355a2e8be2498e5cb8e3702938fcd6d5d966a

Contents?: true

Size: 955 Bytes

Versions: 15

Compression:

Stored size: 955 Bytes

Contents

module Neuron
  module Client
    class GeoTarget
      include Base

      TYPES = %w(COUNTRY REGION METRO CITY) # DO NOT modify, unless you're absolutely sure of all the ramifications!

      ATTRIBUTES = [
        :id,
        :geo_type,      # string, one of TYPES
        :net_acuity_id, # integer
        :abbreviation,  # string
        :full_name,     # string
        :name,          # string
      ]

      attr_accessor *ATTRIBUTES

      def attributes
        ATTRIBUTES
      end

      EXPECTED_QUERY_PARAMS = %w(geo_type search limit)
      def self.query(parameters)
        if validate?
          unless parameters.all?{|k,v| EXPECTED_QUERY_PARAMS.include?(k.to_s)}
            raise "Unsupported parameters: #{parameters.inspect}"
          end
        end
        data = self.connection.get("geo_targets", parameters)
        validate_against_schema!(:index, data)
        data.map{ |hash| from_hash(hash) }
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
neuron-client-0.6.0 lib/neuron-client/model/geo_target.rb
neuron-client-0.5.3 lib/neuron-client/model/geo_target.rb
neuron-client-0.5.2 lib/neuron-client/model/geo_target.rb
neuron-client-0.5.1 lib/neuron-client/model/geo_target.rb
neuron-client-0.5.0 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.8 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.7 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.6 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.5 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.4 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.3 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.2 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.1 lib/neuron-client/model/geo_target.rb
neuron-client-0.4.0 lib/neuron-client/model/geo_target.rb
neuron-client-0.3.0 lib/neuron-client/model/geo_target.rb