]> git.openstreetmap.org Git - rails.git/blobdiff - lib/quova.rb
Moved strings to locales + Added 'Issues' button + Fixed typo in tests
[rails.git] / lib / quova.rb
index ed5b9f491a6811234c2616de6febee63ce303f53..cb6b93654d2bc0998eac5bad168036a75855aeae 100644 (file)
@@ -1,12 +1,12 @@
 ##
 # Load required libraries
 ##
 # Load required libraries
-require 'soap/wsdlDriver'
+require "soap/wsdlDriver"
 
 ##
 # Monkey patch WSDL parser to stop it moaning
 module WSDL
   class Parser
 
 ##
 # Monkey patch WSDL parser to stop it moaning
 module WSDL
   class Parser
-    def warn(msg)
+    def warn(_msg)
     end
   end
 end
     end
   end
 end
@@ -16,44 +16,44 @@ end
 module Quova
   ##
   # Access details for WSDL description
 module Quova
   ##
   # Access details for WSDL description
-  WSDL_URL="https://webservices.quova.com/OnDemand/GeoPoint/v1/default.asmx?WSDL"
+  WSDL_URL = "https://webservices.quova.com/OnDemand/GeoPoint/v1/default.asmx?WSDL".freeze
   WSDL_USER = QUOVA_USERNAME
   WSDL_PASS = QUOVA_PASSWORD
 
   ##
   # Status codes
   WSDL_USER = QUOVA_USERNAME
   WSDL_PASS = QUOVA_PASSWORD
 
   ##
   # Status codes
-  Success = 0
-  IPV6NoSupport = 1
-  InvalidCredentials = 2
-  NotMapped = 3
-  InvalidIPFormat = 4
-  IPAddressNull = 5
-  AccessDenied = 6
-  QueryLimit = 7
-  OutOfService = 10
+  SUCCESS = 0
+  IPV6_NO_SUPPORT = 1
+  INVALID_CREDENTIALS = 2
+  NOT_MAPPED = 3
+  INVALID_IP_FORMAT = 4
+  IP_ADDRESS_NULL = 5
+  ACCESS_DENIED = 6
+  QUERY_LIMIT = 7
+  OUT_OF_SERVICE = 10
 
   ##
   # Create SOAP endpoint
 
   ##
   # Create SOAP endpoint
-  @@soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
-  @@soap.options["protocol.http.basic_auth"] << [WSDL_URL, WSDL_USER, WSDL_PASS]
+  @soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
+  @soap.options["protocol.http.basic_auth"] << [WSDL_URL, WSDL_USER, WSDL_PASS]
 
   ##
   # Accessor for SOAP endpoint
   def self.soap
 
   ##
   # Accessor for SOAP endpoint
   def self.soap
-    @@soap
+    @soap
   end
 
   ##
   # Class representing geolocation details for an IP address
   class IpInfo
     def initialize(ip_address)
   end
 
   ##
   # Class representing geolocation details for an IP address
   class IpInfo
     def initialize(ip_address)
-      @ipinfo = Quova::soap.GetIpInfo(:ipAddress => ip_address)
+      @ipinfo = Quova.soap.GetIpInfo(:ipAddress => ip_address)
     end
 
     def status
       @ipinfo["GetIpInfoResult"]["Response"]["Status"].to_i
     end
     end
 
     def status
       @ipinfo["GetIpInfoResult"]["Response"]["Status"].to_i
     end
+
     def country_code
       @ipinfo["GetIpInfoResult"]["Location"]["Country"]["Name"]
     end
     def country_code
       @ipinfo["GetIpInfoResult"]["Location"]["Country"]["Name"]
     end
@@ -63,4 +63,3 @@ module Quova
     end
   end
 end
     end
   end
 end
-