X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/0ff1214f86ac1347bb257abfda70581cc78903dd..0f1f4c29be08481bc5ebb52eed5be217bde9897d:/lib/osm.rb diff --git a/lib/osm.rb b/lib/osm.rb index f6646503d..eb5afd562 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -13,6 +13,10 @@ module OSM def render_opts { :text => "Generic API Error", :status => :internal_server_error, :content_type => "text/plain" } end + + def to_s + "Generic API Error" + end end # Raised when an API object is not found. @@ -31,6 +35,10 @@ module OSM def render_opts { :text => "Precondition failed: #{@message}", :status => :precondition_failed, :content_type => "text/plain" } end + + def to_s + "Precondition failed: #{@message}" + end end # Raised when to delete an already-deleted object. @@ -65,6 +73,10 @@ module OSM def render_opts { :text => "You need to supply a changeset to be able to make a change", :status => :conflict, :content_type => "text/plain" } end + + def to_s + "You need to supply a changeset to be able to make a change" + end end # Raised when a diff is uploaded containing many changeset IDs which don't match @@ -119,6 +131,10 @@ module OSM ", server had: " + latest.to_s + " of " + type + " " + id.to_s, :status => :conflict, :content_type => "text/plain" } end + + def to_s + "Version mismatch: Provided " + provided.to_s + ", server had: " + latest.to_s + " of " + type + " " + id.to_s + end end # raised when a two tags have a duplicate key string in an element. @@ -240,7 +256,7 @@ module OSM class GeoRSS def initialize(feed_title='OpenStreetMap GPS Traces', feed_description='OpenStreetMap GPS Traces', feed_url='http://www.openstreetmap.org/traces/') @doc = XML::Document.new - @doc.encoding = 'UTF-8' + @doc.encoding = XML::Encoding::UTF_8 rss = XML::Node.new 'rss' @doc.root = rss @@ -326,7 +342,7 @@ module OSM class API def get_xml_doc doc = XML::Document.new - doc.encoding = 'UTF-8' + doc.encoding = XML::Encoding::UTF_8 root = XML::Node.new 'osm' root['version'] = API_VERSION root['generator'] = GENERATOR