Sha256: 67e01166a397db87a313c58c194b7190e27d29564e18404b4d8836622c63a282

Contents?: true

Size: 474 Bytes

Versions: 4

Compression:

Stored size: 474 Bytes

Contents

module MaxMind
  class CountryService < Service

    self.base_path = '/a'

    def parsed_response
      if self.valid_response?
        parsed_response = CSV.parse_line(self.response)
        {
          :country => parsed_response[0],
          :api_response => self.response
        }
      else
        {
          :api_response => self.response
        }
      end
    end

    def valid_response?
      super && !(self.response =~ /\(NULL\),(.+?)/)
    end

  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
crushlovely-max_mind-1.0.0 lib/max_mind/service/country.rb
heythisisnate-max_mind-0.1.0 lib/max_mind/service/country.rb
heythisisnate-max_mind-0.1.1 lib/max_mind/service/country.rb
max_mind-1.0.0 lib/max_mind/service/country.rb