Sha256: fd0780f2a7196926f50cfe3c941043f5440e426166e78868dcf7b6600fafb501

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

require 'iconv'

module Ipgeobase
  class IpMetaData
    include HappyMapper

    tag 'ip-answer'
    element :city, String, :deep => true
    element :country, String, :deep => true
    element :region, String, :deep => true
    element :district, String, :deep => true
    element :lat, Float, :deep => true
    element :lng, Float, :deep => true

    def city
      Iconv.iconv('windows-1251', 'utf-8', @city).first
    end

    def country
      Iconv.iconv('windows-1251', 'utf-8', @country).first
    end

    def region
      Iconv.iconv('windows-1251', 'utf-8', @region).first
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ipgeobase-0.0.1 lib/ipgeobase/ip_meta_data.rb