repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/config/actions/content_security_policy.rb
lib/hanami/config/actions/content_security_policy.rb
# frozen_string_literal: true module Hanami class Config class Actions # Config for Content Security Policy in Hanami apps # # @since 2.0.0 class ContentSecurityPolicy # @since 2.0.0 # @api private def initialize(&blk) @policy = { base_uri: "'...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/config/actions/cookies.rb
lib/hanami/config/actions/cookies.rb
# frozen_string_literal: true module Hanami class Config class Actions # Wrapper for app-level config of HTTP cookies for Hanami actions. # # This decorates the hash of cookie options that is otherwise directly configurable on # actions, and adds the `enabled?` method to allow app base ac...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/config/actions/sessions.rb
lib/hanami/config/actions/sessions.rb
# frozen_string_literal: true require "hanami/utils/string" require "hanami/utils/class" module Hanami class Config class Actions # Config for HTTP session middleware in Hanami actions. # # @api public # @since 2.0.0 class Sessions # Returns the configured session storage ...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/slice/router.rb
lib/hanami/slice/router.rb
# frozen_string_literal: true require "hanami/router" require_relative "routing/resolver" require_relative "routing/middleware/stack" module Hanami class Slice # `Hanami::Router` subclass with enhancements for use within Hanami apps. # # This is loaded from Hanami apps and slices and made available as t...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/slice/routes_helper.rb
lib/hanami/slice/routes_helper.rb
# frozen_string_literal: true module Hanami class Slice # Hanami app routes helpers # # An instance of this class will be registered with slice (at the "routes" key). You # can use it to access the route helpers for your app. # # @example # MyApp::App["routes"].path(:root) # => "/" ...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/slice/view_name_inferrer.rb
lib/hanami/slice/view_name_inferrer.rb
# frozen_string_literal: true require_relative "../constants" module Hanami class Slice # Infers a view name for automatically rendering within actions. # # @api private # @since 2.0.0 class ViewNameInferrer ALTERNATIVE_NAMES = { "create" => "new", "update" => "edit" ...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/slice/routing/resolver.rb
lib/hanami/slice/routing/resolver.rb
# frozen_string_literal: true module Hanami class Slice # @api private module Routing # Hanami app router endpoint resolver # # This resolves endpoints objects from a slice container using the strings passed to `to:` as # their container keys. # # @api private # @sin...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/slice/routing/middleware/stack.rb
lib/hanami/slice/routing/middleware/stack.rb
# frozen_string_literal: true require "hanami/router" require "hanami/middleware" require "hanami/middleware/app" require "hanami/errors" module Hanami class Slice module Routing # @since 2.0.0 # @api private module Middleware # Wraps a rack app with a middleware stack # ...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/web/rack_logger.rb
lib/hanami/web/rack_logger.rb
# frozen_string_literal: true require "delegate" require "json" module Hanami # @api private module Web # Rack logger for Hanami apps # # @api private # @since 2.0.0 class RackLogger EMPTY_PARAMS = {}.freeze private_constant :EMPTY_PARAMS REQUEST_METHOD = "REQUEST_METHOD" ...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
hanami/hanami
https://github.com/hanami/hanami/blob/ccc7e5df285595191fb467729bb5ddc53f77f077/lib/hanami/web/welcome.rb
lib/hanami/web/welcome.rb
# frozen_string_literal: true require "erb" module Hanami # @api private module Web # Middleware that renders a welcome view in fresh Hanami apps. # # @api private # @since 2.1.0 class Welcome # @api private # @since 2.1.0 def initialize(app) @app = app end ...
ruby
MIT
ccc7e5df285595191fb467729bb5ddc53f77f077
2026-01-04T15:40:32.670663Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/init.rb
init.rb
require 'geocoder'
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/mongoid_test_helper.rb
test/mongoid_test_helper.rb
require 'rubygems' require 'test/unit' require 'test_helper' require 'mongoid' require 'geocoder/models/mongoid' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) if (::Mongoid::VERSION >= "3") Mongoid.logger = Logger.new($stderr, :debug) else Mongoid.co...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/test_helper.rb
test/test_helper.rb
# encoding: utf-8 require 'rubygems' require 'test/unit' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'yaml' configs = YAML.load_file('test/database.yml') if configs.keys.include? ENV['DB'] require 'active_record' # Establish a database co...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/db/migrate/001_create_test_schema.rb
test/db/migrate/001_create_test_schema.rb
# CreateTestSchema creates the tables used in test_helper.rb superclass = ActiveRecord::Migration # TODO: Inherit from the 5.0 Migration class directly when we drop support for Rails 4. superclass = ActiveRecord::Migration[5.0] if superclass.respond_to?(:[]) class CreateTestSchema < superclass def self.up [ ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/ip_address_test.rb
test/unit/ip_address_test.rb
# encoding: utf-8 require 'test_helper' class IpAddressTest < GeocoderTestCase def test_valid assert Geocoder::IpAddress.new("232.65.123.94").valid? assert Geocoder::IpAddress.new(IPAddr.new("232.65.123.94")).valid? assert !Geocoder::IpAddress.new("666.65.123.94").valid? assert Geocoder::IpAddress.n...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/logger_test.rb
test/unit/logger_test.rb
# encoding: utf-8 require 'test_helper' require 'logger' require 'tempfile' class LoggerTest < GeocoderTestCase def setup @tempfile = Tempfile.new("log") @logger = Logger.new(@tempfile.path) Geocoder.configure(logger: @logger) end def teardown @logger.close @tempfile.close end def test...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/test_mode_test.rb
test/unit/test_mode_test.rb
# encoding: utf-8 require 'test_helper' class TestModeTest < GeocoderTestCase def setup @_original_lookup = Geocoder.config.lookup Geocoder.configure(:lookup => :test) end def teardown Geocoder::Lookup::Test.reset Geocoder.configure(:lookup => @_original_lookup) end def test_search_with_kn...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/active_record_test.rb
test/unit/active_record_test.rb
# encoding: utf-8 require 'test_helper' class ActiveRecordTest < GeocoderTestCase def test_exclude_condition_when_model_has_a_custom_primary_key venue = PlaceWithCustomPrimaryKey.new(*geocoded_object_params(:msg)) # just call private method directly so we don't have to stub .near scope conditions = ven...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/mongoid_test.rb
test/unit/mongoid_test.rb
# encoding: utf-8 require 'mongoid_test_helper' class MongoidTest < GeocoderTestCase def test_geocoded_check p = PlaceUsingMongoid.new(*geocoded_object_params(:msg)) p.location = [40.750354, -73.993371] assert p.geocoded? end def test_geocoded_check_single_coord p = PlaceUsingMongoid.new(*geocod...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookup_test.rb
test/unit/lookup_test.rb
# encoding: utf-8 require 'test_helper' class LookupTest < GeocoderTestCase def test_responds_to_name_method Geocoder::Lookup.all_services.each do |l| lookup = Geocoder::Lookup.get(l) assert lookup.respond_to?(:name), "Lookup #{l} does not respond to #name method." end end def test_s...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/model_test.rb
test/unit/model_test.rb
# encoding: utf-8 require 'test_helper' class ModelTest < GeocoderTestCase def test_geocode_with_block_runs_block e = PlaceWithCustomResultsHandling.new(*geocoded_object_params(:msg)) e.geocode assert_match(/[0-9\.,\-]+/, e.coords_string) end def test_geocode_with_block_doesnt_auto_assign_coordinat...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/proxy_test.rb
test/unit/proxy_test.rb
# encoding: utf-8 require 'test_helper' class ProxyTest < GeocoderTestCase def test_uses_proxy_when_specified Geocoder.configure(:http_proxy => 'localhost') Geocoder.configure(:use_https => false) lookup = Geocoder::Lookup::Bing.new assert lookup.send(:http_client).proxy_class? end def test_doe...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/request_test.rb
test/unit/request_test.rb
# encoding: utf-8 require 'test_helper' class RequestTest < GeocoderTestCase class MockRequest < Rack::Request include Geocoder::Request def initialize(headers={}, ip="") super_env = headers super_env.merge!({'REMOTE_ADDR' => ip}) unless ip == "" super(super_env) end end def setup ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/util_test.rb
test/unit/util_test.rb
# frozen_string_literal: true require 'test_helper' class UtilTest < GeocoderTestCase def test_recursive_hash_merge h1 = { 'a' => 100, 'b' => 200, 'c' => { 'c1' => 12, 'c2' => 14 } } h2 = { 'b' => 254, 'c' => { 'c1' => 16, 'c3' => 94 } } Geocoder::Util.recursive_hash_merge(h1, h2) assert h1 == { 'a'...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/calculations_test.rb
test/unit/calculations_test.rb
# encoding: utf-8 require 'test_helper' class CalculationsTest < GeocoderTestCase def setup Geocoder.configure( :units => :mi, :distances => :linear ) end # --- degree distance --- def test_longitude_degree_distance_at_equator assert_equal 69, Geocoder::Calculations.longitude_degree_d...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/query_test.rb
test/unit/query_test.rb
# encoding: utf-8 require 'test_helper' class QueryTest < GeocoderTestCase def test_detect_ipv4 assert Geocoder::Query.new("232.65.123.94").ip_address? ip = IPAddr.new("232.65.123.94") assert Geocoder::Query.new(ip).ip_address? end def test_detect_ipv6 assert Geocoder::Query.new("3ffe:0b00:0000...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/configuration_test.rb
test/unit/configuration_test.rb
# encoding: utf-8 require 'test_helper' class ConfigurationTest < GeocoderTestCase def setup Geocoder::Configuration.set_defaults end def test_exception_raised_on_bad_lookup_config Geocoder.configure(:lookup => :stoopid) assert_raises Geocoder::ConfigurationError do Geocoder.search "something ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/near_test.rb
test/unit/near_test.rb
# encoding: utf-8 require 'test_helper' require 'arel' class NearTest < GeocoderTestCase def test_near_scope_options_includes_bounding_box_condition omit("Not applicable to unextended SQLite") if using_unextended_sqlite? result = PlaceWithCustomResultsHandling.send(:near_scope_options, 1.0, 2.0, 5) tab...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/result_test.rb
test/unit/result_test.rb
# encoding: utf-8 require 'test_helper' class ResultTest < GeocoderTestCase def test_forward_geocoding_result_has_required_attributes Geocoder::Lookup.all_services_except_test.each do |l| next if [ :ip2location, # has pay-per-attribute pricing model :ip2location_io, # has pay-per-attribute...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/method_aliases_test.rb
test/unit/method_aliases_test.rb
# encoding: utf-8 require 'test_helper' class MethodAliasesTest < GeocoderTestCase def test_distance_from_is_alias_for_distance_to v = Place.new(*geocoded_object_params(:msg)) v.latitude, v.longitude = [40.750354, -73.993371] assert_equal v.distance_from([30, -94]), v.distance_to([30, -94]) end def...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/error_handling_test.rb
test/unit/error_handling_test.rb
# encoding: utf-8 require 'test_helper' class ErrorHandlingTest < GeocoderTestCase def teardown Geocoder.configure(:always_raise => []) end def test_does_not_choke_on_timeout silence_warnings do Geocoder::Lookup.all_services_with_http_requests.each do |l| Geocoder.configure(:lookup => l) ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/https_test.rb
test/unit/https_test.rb
# encoding: utf-8 require 'test_helper' class HttpsTest < GeocoderTestCase def test_uses_https_for_secure_query Geocoder.configure(:use_https => true) g = Geocoder::Lookup::Google.new assert_match(/^https:/, g.query_url(Geocoder::Query.new("test"))) end end
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/geocoder_test.rb
test/unit/geocoder_test.rb
# encoding: utf-8 require 'test_helper' class GeocoderTest < GeocoderTestCase def test_distance_to_returns_float v = Place.new(*geocoded_object_params(:msg)) v.latitude, v.longitude = [40.750354, -73.993371] assert (v.distance_to([30, -94])).is_a?(Float) end def test_coordinates_method_returns_arra...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/cache_test.rb
test/unit/cache_test.rb
# encoding: utf-8 require 'test_helper' class CacheTest < GeocoderTestCase def setup @tempfile = Tempfile.new("log") @logger = Logger.new(@tempfile.path) Geocoder.configure(logger: @logger) end def teardown Geocoder.configure(logger: :kernel) @logger.close @tempfile.close end def te...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/twogis_test.rb
test/unit/lookups/twogis_test.rb
# encoding: utf-8 require 'test_helper' class TwogisTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :twogis) set_api_key!(:twogis) end def test_twogis_point result = Geocoder.search('Kremlin, Moscow, Russia').first assert_equal [55.755836, 37.617774], result.coordinates ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/pdok_nl_test.rb
test/unit/lookups/pdok_nl_test.rb
# encoding: utf-8 require 'test_helper' class PdokNlTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :pdok_nl) end def test_result_components result = Geocoder.search('Nieuwezijds Voorburgwal 147, Amsterdam').first assert_equal result.street, 'Nieuwezijds Voorburgwal'...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/google_test.rb
test/unit/lookups/google_test.rb
# encoding: utf-8 require 'test_helper' class GoogleTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :google) end def test_google_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "Manhattan", result.address_components_o...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipinfo_io_lite_test.rb
test/unit/lookups/ipinfo_io_lite_test.rb
require 'test_helper' class IpinfoIoLiteTest < GeocoderTestCase def test_ipinfo_io_lite_lookup_loopback_address Geocoder.configure(ip_lookup: :ipinfo_io_lite) result = Geocoder.search('127.0.0.1').first assert_equal '127.0.0.1', result.ip end def test_ipinfo_io_lite_lookup_private_address Geocod...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/yandex_test.rb
test/unit/lookups/yandex_test.rb
# encoding: utf-8 $: << File.join(File.dirname(__FILE__), "..", "..") require 'test_helper' class YandexTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :yandex, language: :en) end def test_yandex_viewport result = Geocoder.search('Kremlin, Moscow, Russia').first assert_equal ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/amazon_location_service_test.rb
test/unit/lookups/amazon_location_service_test.rb
# encoding: utf-8 require 'test_helper' class AmazonLocationServiceTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :amazon_location_service, amazon_location_service: {index_name: "some_index_name"}) end def test_amazon_location_service_geocoding result = Geocoder.search("Madison ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/bing_test.rb
test/unit/lookups/bing_test.rb
# encoding: utf-8 require 'test_helper' class BingTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :bing) set_api_key!(:bing) end def test_query_for_reverse_geocode lookup = Geocoder::Lookup::Bing.new url = lookup.query_url(Geocoder::Query.new([45.423733, -75.676333])) ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipdata_co_test.rb
test/unit/lookups/ipdata_co_test.rb
# encoding: utf-8 require 'test_helper' class IpdataCoTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ipdata_co) end def test_result_on_ip_address_search result = Geocoder.search("74.200.247.59").first assert result.is_a?(Geocoder::Result::IpdataCo) end def test_resu...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/esri_test.rb
test/unit/lookups/esri_test.rb
# encoding: utf-8 require 'test_helper' require 'geocoder/esri_token' class EsriTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :esri) end def test_query_for_geocode query = Geocoder::Query.new("Bluffton, SC") lookup = Geocoder::Lookup.get(:esri) res = lookup.query_url(qu...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipapi_com_test.rb
test/unit/lookups/ipapi_com_test.rb
# encoding: utf-8 require 'test_helper' class IpapiComTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ipapi_com) end def test_result_on_ip_address_search result = Geocoder.search("74.200.247.59").first assert result.is_a?(Geocoder::Result::IpapiCom) end def test_resu...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipinfo_io_test.rb
test/unit/lookups/ipinfo_io_test.rb
# encoding: utf-8 require 'test_helper' class IpinfoIoTest < GeocoderTestCase def test_ipinfo_io_lookup_loopback_address Geocoder.configure(:ip_lookup => :ipinfo_io) result = Geocoder.search("127.0.0.1").first assert_nil result.latitude assert_nil result.longitude assert_equal "127.0.0.1", resul...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/db_ip_com_test.rb
test/unit/lookups/db_ip_com_test.rb
require 'test_helper' class DbIpComTest < GeocoderTestCase def configure_for_free_api_access Geocoder.configure(ip_lookup: :db_ip_com, db_ip_com: { api_key: 'MY_API_KEY' }) set_api_key!(:db_ip_com) end def configure_for_paid_api_access Geocoder.configure(ip_lookup: :db_ip_com, db_ip_com: { api_key: ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/photon_test.rb
test/unit/lookups/photon_test.rb
# frozen_string_literal: true require 'test_helper' # Test for Photon class PhotonTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :photon) end def test_photon_forward_geocoding_result_properties result = Geocoder.search('Madison Square Garden, New York, NY').first geometry ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/google_premier_test.rb
test/unit/lookups/google_premier_test.rb
# encoding: utf-8 require 'test_helper' class GooglePremierTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :google_premier) set_api_key!(:google_premier) end def test_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "Man...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/google_places_search_test.rb
test/unit/lookups/google_places_search_test.rb
# encoding: utf-8 require 'test_helper' class GooglePlacesSearchTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :google_places_search) set_api_key!(:google_places_search) end def test_google_places_search_result_contains_place_id assert_equal "ChIJhRwB-yFawokR5Phil-QQ3zM", ma...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ip2location_lite_test.rb
test/unit/lookups/ip2location_lite_test.rb
# encoding: utf-8 require 'test_helper' class Ip2locationLiteTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ip2location_lite, ip2location_lite: { file: File.join('folder', 'test_file') }) end def test_loopback result = Geocoder.search('127.0.0.1').first assert_equal '', r...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/geocoder_ca_test.rb
test/unit/lookups/geocoder_ca_test.rb
# encoding: utf-8 require 'test_helper' class GeocoderCaTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :geocoder_ca) set_api_key!(:geocoder_ca) end def test_result_components result = Geocoder.search([45.423733, -75.676333]).first assert_equal "CA", result.country_code ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/geoip2_test.rb
test/unit/lookups/geoip2_test.rb
# encoding: utf-8 require 'test_helper' class Geoip2Test < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :geoip2, file: 'test_file') end def test_result_attributes result = Geocoder.search('8.8.8.8').first assert_equal 'Mountain View, CA 94043, United States', result.address ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/uk_ordnance_survey_names.rb
test/unit/lookups/uk_ordnance_survey_names.rb
# encoding: utf-8 require 'test_helper' class UkOrdnanceSurveyNamesTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :uk_ordnance_survey_names) set_api_key!(:uk_ordnance_survey_names) end def test_result_on_placename_search result = Geocoder.search('London').first assert_in...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/telize_test.rb
test/unit/lookups/telize_test.rb
# encoding: utf-8 require 'test_helper' class TelizeTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :telize, telize: {host: nil}) set_api_key!(:telize) end def test_query_url lookup = Geocoder::Lookup::Telize.new query = Geocoder::Query.new("74.200.247.59") assert_...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/maxmind_geoip2_test.rb
test/unit/lookups/maxmind_geoip2_test.rb
# encoding: utf-8 require 'test_helper' class MaxmindGeoip2Test < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :maxmind_geoip2) end def test_result_attributes result = Geocoder.search('1.2.3.4').first assert_equal 'Los Angeles, CA 90001, United States', result.address asse...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/pickpoint_test.rb
test/unit/lookups/pickpoint_test.rb
require 'test_helper' class PickpointTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :pickpoint) set_api_key!(:pickpoint) end def test_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "10001", result.postal_code asse...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/pelias_test.rb
test/unit/lookups/pelias_test.rb
# encoding: utf-8 require 'test_helper' class PeliasTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :pelias, api_key: 'abc123', pelias: {}) # Empty pelias hash only for test (pollution control) end def test_configure_default_endpoint query = Geocoder::Query.new('Madison Square Ga...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/maxmind_test.rb
test/unit/lookups/maxmind_test.rb
# encoding: utf-8 require 'test_helper' class MaxmindTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :maxmind) end def test_maxmind_result_on_ip_address_search Geocoder.configure(maxmind: {service: :city_isp_org}) result = Geocoder.search("74.200.247.59").first assert ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/google_places_details_test.rb
test/unit/lookups/google_places_details_test.rb
# encoding: utf-8 require 'test_helper' class GooglePlacesDetailsTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :google_places_details) set_api_key!(:google_places_details) end def test_google_places_details_result_components assert_equal "Manhattan", madison_square_garden.a...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/mapbox_test.rb
test/unit/lookups/mapbox_test.rb
# encoding: utf-8 require 'test_helper' class MapboxTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :mapbox) set_api_key!(:mapbox) end def test_url_contains_api_key Geocoder.configure(mapbox: {api_key: "abc123"}) query = Geocoder::Query.new("Leadville, CO") assert_equ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipregistry_test.rb
test/unit/lookups/ipregistry_test.rb
# encoding: utf-8 require 'test_helper' class IpregistryTest < GeocoderTestCase def test_lookup_loopback_address Geocoder.configure(:ip_lookup => :ipregistry) result = Geocoder.search("127.0.0.1").first assert_nil result.latitude assert_nil result.longitude assert_equal "127.0.0.1", result.ip e...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/azure_test.rb
test/unit/lookups/azure_test.rb
require 'test_helper' class AzureTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :azure, azure: { limit: 1 }) set_api_key!(:azure) end def test_azure_results_jakarta_properties result = Geocoder.search('Jakarta').first assert_equal 'Jakarta', result&.city assert_equa...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/pc_miler_test.rb
test/unit/lookups/pc_miler_test.rb
# encoding: utf-8 require 'test_helper' class TrimbleMapsTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :pc_miler) end def test_query_for_geocode query = Geocoder::Query.new('wall drug') lookup = Geocoder::Lookup.get(:pc_miler) res = lookup.query_url(query) assert_eq...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ban_data_gouv_fr_test.rb
test/unit/lookups/ban_data_gouv_fr_test.rb
# encoding: utf-8 require 'test_helper' class BanDataGouvFrTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :ban_data_gouv_fr, use_https: true) end def test_query_for_geocode query = Geocoder::Query.new('13 rue yves toudic, 75010 Paris') lookup = Geocoder::Lookup.get(:ban_data...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/geocodio_test.rb
test/unit/lookups/geocodio_test.rb
# encoding: utf-8 require 'test_helper' class GeocodioTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :geocodio) set_api_key!(:geocodio) end def test_result_components result = Geocoder.search("1101 Pennsylvania Ave NW, Washington DC").first assert_equal 1.0, result.accur...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipgeolocation_test.rb
test/unit/lookups/ipgeolocation_test.rb
# encoding: utf-8 require 'test_helper' class IpgeolocationTest < GeocoderTestCase def setup super Geocoder.configure( :api_key => 'ea91e4a4159247fdb0926feae70c2911', :ip_lookup => :ipgeolocation, :always_raise => :all ) end def test_result_on_ip_address_search result = ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/opencagedata_test.rb
test/unit/lookups/opencagedata_test.rb
# encoding: utf-8 require 'test_helper' class OpencagedataTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :opencagedata) set_api_key!(:opencagedata) end def test_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "West 31s...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/melissa_street_test.rb
test/unit/lookups/melissa_street_test.rb
# encoding: utf-8 require 'test_helper' class MelissaStreetTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :melissa_street) set_api_key!(:melissa_street) end def test_result_components result = Geocoder.search("1 Frank H Ogawa Plz Fl 3").first assert_equal "1", result.num...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ip2location_test.rb
test/unit/lookups/ip2location_test.rb
# encoding: utf-8 require 'test_helper' class Ip2locationTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ip2location) set_api_key!(:ip2location) end def test_ip2location_query_url query = Geocoder::Query.new('8.8.8.8') assert_equal 'https://api.ip2location.com/v2/?ip=...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/mapquest_test.rb
test/unit/lookups/mapquest_test.rb
# encoding: utf-8 require 'test_helper' class MapquestTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :mapquest) set_api_key!(:mapquest) end def test_url_contains_api_key Geocoder.configure(mapquest: {api_key: "abc123"}) query = Geocoder::Query.new("Bluffton, SC") ass...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ip2location_io_test.rb
test/unit/lookups/ip2location_io_test.rb
# encoding: utf-8 require 'test_helper' class Ip2locationIoTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ip2location_io) set_api_key!(:ip2location_io) end def test_ip2location_io_query_url query = Geocoder::Query.new('8.8.8.8') assert_equal 'https://api.ip2location....
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/maxmind_local_test.rb
test/unit/lookups/maxmind_local_test.rb
# encoding: utf-8 require 'test_helper' class MaxmindLocalTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :maxmind_local) end def test_result_attributes result = Geocoder.search('8.8.8.8').first assert_equal 'Mountain View, CA 94043, United States', result.address asse...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/location_iq_test.rb
test/unit/lookups/location_iq_test.rb
# encoding: utf-8 require 'unit/lookups/nominatim_test' require 'test_helper' class LocationIq < NominatimTest def setup super Geocoder.configure(lookup: :location_iq) set_api_key!(:location_iq) end def test_url_contains_api_key Geocoder.configure(location_iq: {api_key: "abc123"}) query = G...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/abstract_api_test.rb
test/unit/lookups/abstract_api_test.rb
# encoding: utf-8 require 'test_helper' class AbstractApiTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :abstract_api) set_api_key!(:abstract_api) end def test_result_attributes result = Geocoder.search('2.19.128.50').first assert_equal 'Seattle, WA 98111, United Stat...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/latlon_test.rb
test/unit/lookups/latlon_test.rb
# encoding: utf-8 require 'test_helper' class LatlonTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :latlon) set_api_key!(:latlon) end def test_result_components result = Geocoder.search("6000 Universal Blvd, Orlando, FL 32819").first assert_equal "6000", result.number ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/geoapify_test.rb
test/unit/lookups/geoapify_test.rb
# frozen_string_literal: true require 'test_helper' class GeoapifyTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :geoapify) set_api_key!(:geoapify) end def test_geoapify_forward_geocoding_result_properties result = Geocoder.search('Madison Square Garden, New York, NY').firs...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/freegeoip_test.rb
test/unit/lookups/freegeoip_test.rb
# encoding: utf-8 require 'test_helper' class FreegeoipTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :freegeoip) end def test_result_on_ip_address_search result = Geocoder.search("74.200.247.59").first assert result.is_a?(Geocoder::Result::Freegeoip) end def test_re...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/pointpin_test.rb
test/unit/lookups/pointpin_test.rb
# encoding: utf-8 require 'test_helper' class PointpinTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :pointpin, api_key: "abc123") end def test_result_on_ip_address_search result = Geocoder.search("80.111.55.55").first assert result.is_a?(Geocoder::Result::Pointpin) end...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/geoportail_lu_test.rb
test/unit/lookups/geoportail_lu_test.rb
# encoding: utf-8 require 'test_helper' class GeoportailLuTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :geoportail_lu) end def test_query_for_geocode query = Geocoder::Query.new('55 route de luxembourg, pontpierre') lookup = Geocoder::Lookup.get(:geoportail_lu) res = l...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/postcode_anywhere_uk_test.rb
test/unit/lookups/postcode_anywhere_uk_test.rb
# encoding: utf-8 require 'test_helper' class PostcodeAnywhereUkTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :postcode_anywhere_uk) set_api_key!(:postcode_anywhere_uk) end def test_result_components_with_placename_search results = Geocoder.search('Romsey') assert_equa...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipstack_test.rb
test/unit/lookups/ipstack_test.rb
# encoding: utf-8 require 'test_helper' class SpyLogger def initialize @log = [] end def logged?(msg) @log.include?(msg) end def add(level, msg) @log << msg end end class IpstackTest < GeocoderTestCase def setup super @logger = SpyLogger.new Geocoder.configure( :api_key ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipbase_test.rb
test/unit/lookups/ipbase_test.rb
# encoding: utf-8 require 'test_helper' class IpbaseTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ipbase, lookup: :ipbase) end def test_no_results results = Geocoder.search("no results") assert_equal 0, results.length end def test_no_data results = Geocoder.sear...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/postcodes_io_test.rb
test/unit/lookups/postcodes_io_test.rb
# encoding: utf-8 require 'test_helper' class PostcodesIoTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :postcodes_io) end def test_result_on_postcode_search results = Geocoder.search('WR26NJ') assert_equal 1, results.size assert_equal 'Worcestershire', results.first.co...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/here_test.rb
test/unit/lookups/here_test.rb
# encoding: utf-8 require 'test_helper' class HereTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :here) set_api_key!(:here) end def test_with_array_api_key_raises_when_configured Geocoder.configure(api_key: %w[foo bar]) Geocoder.configure(always_raise: :all) assert_r...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/osmnames_test.rb
test/unit/lookups/osmnames_test.rb
# encoding: utf-8 require 'test_helper' class OsmnamesTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :osmnames) set_api_key!(:osmnames) end def test_url_contains_api_key Geocoder.configure(osmnames: {api_key: 'abc123'}) query = Geocoder::Query.new('test') assert_incl...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/nominatim_test.rb
test/unit/lookups/nominatim_test.rb
# encoding: utf-8 require 'test_helper' class NominatimTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :nominatim) set_api_key!(:nominatim) end def test_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "10001", result.po...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/ipqualityscore_test.rb
test/unit/lookups/ipqualityscore_test.rb
# encoding: utf-8 require 'test_helper' class IpqualityscoreTest < GeocoderTestCase def setup super # configuring this IP lookup as the address lookup is weird, but necessary # in order to run tests with the 'quota exceeded' fixture Geocoder.configure(lookup: :ipqualityscore, ip_lookup: :ipqualitysc...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/smarty_streets_test.rb
test/unit/lookups/smarty_streets_test.rb
# encoding: utf-8 require 'test_helper' class SmartyStreetsTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :smarty_streets) set_api_key!(:smarty_streets) end def test_url_contains_api_key Geocoder.configure(:smarty_streets => {:api_key => 'blah'}) query = Geocoder::Query....
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/test/unit/lookups/nationaal_georegister_nl_test.rb
test/unit/lookups/nationaal_georegister_nl_test.rb
# encoding: utf-8 require 'test_helper' class NationaalGeoregisterNlTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :nationaal_georegister_nl) end def test_result_components result = Geocoder.search('Nieuwezijds Voorburgwal 147, Amsterdam').first assert_equal result.street, ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/examples/cache_bypass.rb
examples/cache_bypass.rb
# This class allows you to configure how Geocoder should treat errors that occur when # the cache is not available. # Configure it like this # config/initializers/geocoder.rb # Geocoder.configure( # :cache => Geocoder::CacheBypass.new(Redis.new) # ) # # Depending on the value of @bypass this will either # raise the ex...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/examples/app_defined_lookup_services.rb
examples/app_defined_lookup_services.rb
# To extend the Geocoder with additional lookups that come from the application, # not shipped with the gem, define a "child" lookup in your application, based on existing one. # This is required because the Geocoder::Configuration is a Singleton and stores one api key per lookup. # in app/libs/geocoder/lookup/my_prec...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/examples/reverse_geocode_job.rb
examples/reverse_geocode_job.rb
# This class implements an ActiveJob job for performing reverse-geocoding # asynchronously. Example usage: # if @location.save && @location.address.blank? # ReverseGeocodeJob.perform_later(@location) # end # Be sure to configure the queue adapter in config/application.rb: # config.active_job.queue_adapter = :sideki...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/lib/geocoder.rb
lib/geocoder.rb
require "geocoder/configuration" require "geocoder/logger" require "geocoder/kernel_logger" require "geocoder/query" require "geocoder/calculations" require "geocoder/exceptions" require "geocoder/cache" require "geocoder/request" require "geocoder/lookup" require "geocoder/ip_address" require "geocoder/models/active_r...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/lib/easting_northing.rb
lib/easting_northing.rb
module Geocoder class EastingNorthing attr_reader :easting, :northing, :lat_lng def initialize(opts) @easting = opts[:easting] @northing = opts[:northing] @lat_lng = to_WGS84(to_osgb_36) end private def to_osgb_36 osgb_fo = 0.9996012717 northing0 = -100_000.0 ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/lib/maxmind_database.rb
lib/maxmind_database.rb
require 'csv' require 'net/http' module Geocoder module MaxmindDatabase extend self def download(package, dir = "tmp") filepath = File.expand_path(File.join(dir, "#{archive_edition(package)}.zip")) open(filepath, 'wb') do |file| uri = URI.parse(base_url(package)) Net::HTTP.start(...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/lib/generators/geocoder/migration_version.rb
lib/generators/geocoder/migration_version.rb
module Geocoder module Generators module MigrationVersion def rails_5? Rails::VERSION::MAJOR == 5 end def migration_version if rails_5? "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end end end end end
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/lib/generators/geocoder/maxmind/geolite_country_generator.rb
lib/generators/geocoder/maxmind/geolite_country_generator.rb
require 'rails/generators/migration' require 'generators/geocoder/migration_version' module Geocoder module Generators module Maxmind class GeoliteCountryGenerator < Rails::Generators::Base include Rails::Generators::Migration include Generators::MigrationVersion source_root File.e...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/lib/generators/geocoder/maxmind/geolite_city_generator.rb
lib/generators/geocoder/maxmind/geolite_city_generator.rb
require 'rails/generators/migration' require 'generators/geocoder/migration_version' module Geocoder module Generators module Maxmind class GeoliteCityGenerator < Rails::Generators::Base include Rails::Generators::Migration include Generators::MigrationVersion source_root File.expa...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb
lib/generators/geocoder/maxmind/templates/migration/geolite_city.rb
class GeocoderMaxmindGeoliteCity < ActiveRecord::Migration<%= migration_version %> def self.up create_table :maxmind_geolite_city_blocks, id: false do |t| t.column :start_ip_num, :bigint, null: false t.column :end_ip_num, :bigint, null: false t.column :loc_id, :bigint, null: false end ad...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false
alexreisner/geocoder
https://github.com/alexreisner/geocoder/blob/8143fce1820539cdaf6344c3400edf5690ec1611/lib/generators/geocoder/maxmind/templates/migration/geolite_country.rb
lib/generators/geocoder/maxmind/templates/migration/geolite_country.rb
class GeocoderMaxmindGeoliteCountry < ActiveRecord::Migration<%= migration_version %> def self.up create_table :maxmind_geolite_country, id: false do |t| t.column :start_ip, :string t.column :end_ip, :string t.column :start_ip_num, :bigint, null: false t.column :end_ip_num, :bigint, null: ...
ruby
MIT
8143fce1820539cdaf6344c3400edf5690ec1611
2026-01-04T15:40:27.673533Z
false