before_action :check_api_readable
around_action :api_call_handle_error, :api_call_timeout
+ before_action :set_default_request_format
+
# This is probably the most common call of all. It is used for getting the
# OSM data for a specified bounding box, usually for editing. First the
# bounding box (bbox) is checked to make sure that it is sane. All nodes
response.headers["Content-Disposition"] = "attachment; filename=\"map.osm\""
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
end
end
before_action :check_api_readable, :except => [:create, :update, :delete]
around_action :api_call_handle_error, :api_call_timeout
+ before_action :set_default_request_format, :except => [:create, :update, :delete]
+
# Create a node from XML.
def create
assert_method :put
if @node.visible
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
else
head :gone
end
@nodes = Node.find(ids)
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
end
end
before_action :lookup_old_element, :except => [:history]
before_action :lookup_old_element_versions, :only => [:history]
+ before_action :set_default_request_format, :except => [:redact]
+
def history
# the .where() method used in the lookup_old_element_versions
# call won't throw an error if no records are found, so we have
end
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
def version
response.last_modified = @old_element.timestamp
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
end
before_action :check_api_readable, :except => [:create, :update, :delete]
around_action :api_call_handle_error, :api_call_timeout
+ before_action :set_default_request_format, :except => [:create, :update, :delete]
+
def create
assert_method :put
response.last_modified = @relation.timestamp
if @relation.visible
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
else
head :gone
end
@relations << relation
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
else
head :gone
end
@relations = Relation.find(ids)
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
def relations_for_way
end
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
end
end
before_action :check_api_readable, :except => [:create, :update, :delete]
around_action :api_call_handle_error, :api_call_timeout
+ before_action :set_default_request_format, :except => [:create, :update, :delete]
+
def create
assert_method :put
if @way.visible
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
else
head :gone
end
end
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
else
head :gone
end
@ways = Way.find(ids)
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
##
@ways = Way.where(:id => wayids, :visible => true)
# Render the result
- render :formats => [:xml]
+ respond_to do |format|
+ format.xml
+ format.json
+ end
end
end
end
private
+ ##
+ # Set default request format to xml unless a client requests a specific format,
+ # which can be done via (a) URL suffix and/or (b) HTTP Accept header, where
+ # the URL suffix always takes precedence over the Accept header.
+ def set_default_request_format
+ unless params[:format]
+ accept_header = request.headers["HTTP_ACCEPT"]
+ if accept_header.nil?
+ # e.g. unit tests don't set an Accept: header by default, force XML in this case
+ request.format = "xml"
+ return
+ end
+
+ req_mimetypes = []
+
+ # Some clients (JOSM) send Accept headers which cannot be parsed by Rails, example: *; q=.2
+ # To be fair, JOSM's Accept header doesn't adhere to RFC 7231, section 5.3.1, et al. either
+ # As a workaround for backwards compatibility, we're assuming XML format
+ begin
+ req_mimetypes = Mime::Type.parse(accept_header)
+ rescue Mime::Type::InvalidMimeType
+ request.format = "xml"
+ return
+ end
+
+ # req_mimetypes contains all Accept header MIME types with descending priority
+ req_mimetypes.each do |mime|
+ if mime.symbol == :xml
+ request.format = "xml"
+ break
+ end
+
+ if mime.symbol == :json
+ request.format = "json"
+ break
+ end
+
+ # Any format, not explicitly requesting XML or JSON -> assume XML as default
+ if mime == "*/*"
+ request.format = "xml"
+ break
+ end
+
+ # In case the client requests some other format besides XML, JSON and */*,
+ # we deliberately don't set request.format. The framework will return an
+ # ActionController::UnknownFormat error to the client later on in this case.
+ end
+ end
+ end
+
def authorize(realm = "Web Password", errormessage = "Couldn't authenticate you")
# make the current_user object from any auth sources we have
setup_user_auth
def api_call_handle_error
yield
+ rescue ActionController::UnknownFormat
+ head :not_acceptable
rescue ActiveRecord::RecordNotFound => e
head :not_found
rescue LibXML::XML::Error, ArgumentError => e
def to_s
format("%.7f", self)
end
+
+ def as_json(_)
+ format("%.7f", self).to_f
+ end
end
# This scaling factor is used to convert between the float lat/lon that is
--- /dev/null
+json.version Settings.api_version
+json.generator Settings.generator
+json.copyright Settings.copyright_owner
+json.attribution Settings.attribution_url
+json.license Settings.license_url
--- /dev/null
+json.bounds do
+ json.minlat GeoRecord::Coord.new(@bounds.min_lat)
+ json.minlon GeoRecord::Coord.new(@bounds.min_lon)
+ json.maxlat GeoRecord::Coord.new(@bounds.max_lat)
+ json.maxlon GeoRecord::Coord.new(@bounds.max_lon)
+end
--- /dev/null
+json.partial! "root_attributes"
+
+json.partial! "bounds"
+
+all = @nodes + @ways + @relations
+
+json.elements(all) do |obj|
+ json.partial! obj
+end
--- /dev/null
+json.type "node"
+json.id node.id
+if node.visible
+ json.lat GeoRecord::Coord.new(node.lat)
+ json.lon GeoRecord::Coord.new(node.lon)
+end
+json.timestamp node.timestamp.xmlschema
+json.version node.version
+json.changeset node.changeset_id
+json.user node.changeset.user.display_name
+json.uid node.changeset.user_id
+
+json.visible node.visible unless node.visible
+
+json.tags node.tags unless node.tags.empty?
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@nodes) do |node|
+ json.partial! node
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements([@node]) do |node|
+ json.partial! node
+end
--- /dev/null
+json.type "node"
+json.id old_node.node_id
+if old_node.visible
+ json.lat GeoRecord::Coord.new(old_node.lat)
+ json.lon GeoRecord::Coord.new(old_node.lon)
+end
+json.timestamp old_node.timestamp.xmlschema
+json.version old_node.version
+json.changeset old_node.changeset_id
+json.user old_node.changeset.user.display_name
+json.uid old_node.changeset.user_id
+
+json.visible old_node.visible unless old_node.visible
+
+json.tags old_node.tags unless old_node.tags.empty?
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@elems) do |old_node|
+ json.partial! old_node
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements([@old_element]) do |old_node|
+ json.partial! old_node
+end
--- /dev/null
+json.type "relation"
+json.id old_relation.relation_id
+json.timestamp old_relation.timestamp.xmlschema
+json.version old_relation.version
+json.changeset old_relation.changeset_id
+json.user old_relation.changeset.user.display_name
+json.uid old_relation.changeset.user_id
+
+json.visible old_relation.visible unless old_relation.visible
+
+unless old_relation.relation_members.empty?
+ json.members(old_relation.relation_members) do |m|
+ json.type m.member_type.downcase
+ json.ref m.member_id
+ json.role m.member_role
+ end
+end
+
+json.tags old_relation.tags unless old_relation.tags.empty?
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@elems) do |old_relation|
+ json.partial! old_relation
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements([@old_element]) do |old_relation|
+ json.partial! old_relation
+end
--- /dev/null
+json.type "way"
+json.id old_way.way_id
+json.timestamp old_way.timestamp.xmlschema
+json.version old_way.version
+json.changeset old_way.changeset_id
+json.user old_way.changeset.user.display_name
+json.uid old_way.changeset.user_id
+
+json.visible old_way.visible unless old_way.visible
+
+json.nodes old_way.nds unless old_way.nds.empty?
+
+json.tags old_way.tags unless old_way.tags.empty?
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@elems) do |old_way|
+ json.partial! old_way
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements([@old_element]) do |old_way|
+ json.partial! old_way
+end
--- /dev/null
+json.type "relation"
+json.id relation.id
+json.timestamp relation.timestamp.xmlschema
+json.version relation.version
+json.changeset relation.changeset_id
+json.user relation.changeset.user.display_name
+json.uid relation.changeset.user_id
+
+json.visible relation.visible unless relation.visible
+
+unless relation.relation_members.empty?
+ json.members(relation.relation_members) do |m|
+ json.type m.member_type.downcase
+ json.ref m.member_id
+ json.role m.member_role
+ end
+end
+
+json.tags relation.tags unless relation.tags.empty?
--- /dev/null
+json.partial! "api/root_attributes"
+
+all = @nodes + @ways + @relations
+
+json.elements(all) do |obj|
+ json.partial! obj
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@relations) do |relation|
+ json.partial! relation
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@relations) do |relation|
+ json.partial! relation
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@relations) do |relation|
+ json.partial! relation
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@relations) do |relation|
+ json.partial! relation
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements([@relation]) do |relation|
+ json.partial! relation
+end
--- /dev/null
+json.type "way"
+json.id way.id
+json.timestamp way.timestamp.xmlschema
+json.version way.version
+json.changeset way.changeset_id
+json.user way.changeset.user.display_name
+json.uid way.changeset.user_id
+
+json.visible way.visible unless way.visible
+
+json.nodes way.nodes.ids unless way.nodes.ids.empty?
+
+json.tags way.tags unless way.tags.empty?
--- /dev/null
+json.partial! "api/root_attributes"
+
+all = @nodes + [@way]
+
+json.elements(all) do |obj|
+ json.partial! obj
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@ways) do |way|
+ json.partial! way
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements([@way]) do |way|
+ json.partial! way
+end
--- /dev/null
+json.partial! "api/root_attributes"
+
+json.elements(@ways) do |way|
+ json.partial! way
+end
# Author: Alex73
# Author: Artsiom91
# Author: Goshaproject
+# Author: Jhnrvr
# Author: Jim-by
# Author: Macofe
# Author: Mechanizatar
about_x_hours:
one: прыкладна гадзіну таму
other: прыкладна %{count} гадзін(ы) таму
+ about_x_months:
+ one: прыкладна 1 месяц таму
+ few: прыкладна %{count} месяцы таму
+ many: прыкладна %{count} месяцаў таму
+ other: прыкладна %{count} месяцы(аў) таму
+ about_x_years:
+ one: прыкладна 1 год таму
+ few: прыкладна %{count} гады таму
+ many: прыкладна %{count} гадоў таму
+ other: прыкладна %{count} гады(оў) таму
+ almost_x_years:
+ one: амаль 1 год таму
+ few: амаль %{count} гады таму
+ many: амаль %{count} гадоў таму
+ other: амаль %{count} гады(оў) таму
half_a_minute: паўхвіліны таму
+ less_than_x_seconds:
+ one: менш за секунду таму
+ few: менш за %{count} секунды таму
+ many: менш за %{count} секундаў таму
+ other: менш за %{count} секунды(аў) таму
+ less_than_x_minutes:
+ one: менш за хвіліну таму
+ few: менш за %{count} хвіліны таму
+ many: менш за %{count} хвілін таму
+ other: менш за %{count} хвілін(ы) таму
+ over_x_years:
+ one: больш за год таму
+ few: больш за %{count} гады таму
+ many: больш за %{count} гадоў таму
+ other: больш за %{count} гады(оў) таму
+ x_seconds:
+ one: 1 секунду таму
+ few: '%{count} секунды таму'
+ many: '%{count} секундаў таму'
+ other: '%{count} секунды(аў) таму'
+ x_minutes:
+ one: 1 хвіліну таму
+ few: '%{count} хвіліны таму'
+ many: '%{count} хвілін таму'
+ other: '%{count} хвілін(ы) таму'
+ x_days:
+ one: 1 дзень таму
+ few: '%{count} дні таму'
+ many: '%{count} дзён таму'
+ other: '%{count} дзён таму'
+ x_months:
+ one: 1 месяц таму
+ few: '%{count} месяцы таму'
+ many: '%{count} месяцаў таму'
+ other: '%{count} месяцы(аў) таму'
+ x_years:
+ one: 1 год таму
+ few: '%{count} гады таму'
+ many: '%{count} гадоў таму'
+ other: '%{count} гады(оў) таму'
editor:
default: Тыповы (зараз %{name})
potlatch:
api:
notes:
comment:
- opened_at_html: Створана %{when} таму
- opened_at_by_html: Створана %{when} таму %{user}
- commented_at_html: Абноўлена %{when} таму
- commented_at_by_html: Абноўлена %{when} таму %{user}
- closed_at_html: Вырашана %{when} таму
- closed_at_by_html: Вырашаны %{when} таму %{user}
- reopened_at_html: Пераадкрыта %{when} таму
- reopened_at_by_html: Пераадкрыта %{when} таму %{user}
+ opened_at_html: Створана %{when}
+ opened_at_by_html: Створана %{when} карыстальнікам %{user}
+ commented_at_html: Абноўлена %{when}
+ commented_at_by_html: Абноўлена %{when} карыстальнікам %{user}
+ closed_at_html: Вырашана %{when}
+ closed_at_by_html: Вырашаны %{when} карыстальнікам %{user}
+ reopened_at_html: Пераадкрыта %{when}
+ reopened_at_by_html: Пераадкрыта %{when} карыстальнікам %{user}
rss:
title: Заўвагі OpenStreetMap
description_area: Спіс заўваг створаных, пракаментаваных ці вырашаных у вашым
relation: Дачыненні (%{count})
relation_paginated: Дачыненні (%{x}-%{y} з %{count})
comment: Каментары (%{count})
- hidden_commented_by: Схаваны каментар ад %{user} <abbr title='%{exact_time}'>%{when}
- таму</abbr>
- commented_by: Каментар ад %{user} <abbr title='%{exact_time}'>%{when} таму</abbr>
+ hidden_commented_by: Схаваны каментарый ад %{user} <abbr title='%{exact_time}'>%{when}</abbr>
+ commented_by: Каментарый ад %{user} <abbr title='%{exact_time}'>%{when} </abbr>
changesetxml: XML пакета правак
osmchangexml: osmChange XML
feed:
tag: Вікі-старонка апісання тэгу %{key}=%{value}
wikidata_link: Элемент %{page} у Вікідадзеных
wikipedia_link: Артыкул %{page} на Вікіпедыі
+ wikimedia_commons_link: '%{page} ў Вікісховішчы'
telephone_link: Патэлефанаваць %{phone_number}
colour_preview: Прагляд колеру %{colour_value}
note:
opened_by: Створана %{user} <abbr title='%{exact_time}'>%{when} таму</abbr>
opened_by_anonymous: Створана ананімным карыстальнікам <abbr title='%{exact_time}'>%{when}
таму</abbr>
- commented_by: Каментар ад %{user} <abbr title='%{exact_time}'>%{when} таму</abbr>
- commented_by_anonymous: Ананінмы каментар <abbr title='%{exact_time}'>%{when}
- таму</abbr>
- closed_by: Вырашана %{user} <abbr title='%{exact_time}'>%{when} таму</abbr>
- closed_by_anonymous: Вырашана ананімным карыстальнікам <abbr title='%{exact_time}'>%{when}
- таму</abbr>
- reopened_by: Паўторна актывавана %{user} <abbr title='%{exact_time}'>%{when}
- таму</abbr>
- reopened_by_anonymous: Пераадкрыта ананімным карыстальнікам <abbr title='%{exact_time}'>%{when}
- таму</abbr>
- hidden_by: Схавана %{user} <abbr title='%{exact_time}'>%{when} таму</abbr>
+ commented_by: Каментарый ад %{user} <abbr title='%{exact_time}'>%{when} </abbr>
+ commented_by_anonymous: Ананімны каментарый <abbr title='%{exact_time}'>%{when}
+ </abbr>
+ closed_by: Вырашана карыстальнікам %{user} <abbr title='%{exact_time}'>%{when}</abbr>
+ closed_by_anonymous: Вырашана ананімным карыстальнікам <abbr title='%{exact_time}'>%{when}</abbr>
+ reopened_by: Паўторна актывавана карыстальнікам %{user} <abbr title='%{exact_time}'>%{when}</abbr>
+ reopened_by_anonymous: Пераадкрыта ананімным карыстальнікам <abbr title='%{exact_time}'>%{when}</abbr>
+ hidden_by: Схавана карыстальнікам %{user} <abbr title='%{exact_time}'>%{when}</abbr>
report: Паскардзіцца на гэтую заўвагу
query:
title: Пошук аб’ектаў
changeset_comments:
comment:
comment: Новы каментар на пакет правак %{changeset_id} ад %{author}
- commented_at_by_html: Абноўлена %{when} таму %{user}
+ commented_at_by_html: Абноўлена %{when} карыстальнікам %{user}
comments:
comment: Новы каментар на пакет правак %{changeset_id} ад %{author}
index:
other: 'Каментароў: %{count}'
edit_link: Правіць гэты запіс
hide_link: Схаваць гэты запіс
+ unhide_link: Паказаць гэты запіс
confirm: Пацвердзіць
report: Паскардзіцца на гэты запіс
diary_comment:
comment_from_html: Каментар ад %{link_user} у %{comment_created_at}
hide_link: Схаваць гэты каментар
+ unhide_link: Паказаць гэты каментарый
confirm: Пацвердзіць
report: Паскардзіцца на гэты каментар
location:
status: Статус
reports: Скаргі
last_updated: Апошняе змяненне
- last_updated_time_html: <abbr title='%{title}'>%{time} таму</abbr>
- last_updated_time_user_html: <abbr title='%{title}'>%{time} таму</abbr> карыстальнікам
+ last_updated_time_html: <abbr title='%{title}'>%{time}</abbr>
+ last_updated_time_user_html: <abbr title='%{title}'>%{time}</abbr> карыстальнікам
%{user}
link_to_reports: Глядзець скаргі
reports_count:
reopen:
reopened: Статус праблемы быў зменены на «Адкрыта»
comments:
+ comment_from_html: Каментарый ад %{user_link} у %{comment_created_at}
reassign_param: Пераназначыць праблему?
reports:
- reported_by_html: Паведамлена як %{category} карыстальнікам %{user}
+ reported_by_html: Паведамлена як %{category} карыстальнікам %{user} у %{updated_at}
helper:
reportable_title:
diary_comment: '%{entry_title}, каментар #%{comment_id}'
зменаў'
subject_other: '[OpenStreetMap] %{commenter} пракаментаваў цікавы вам набор
зменаў'
- your_changeset: '%{commenter} пакінуў каментар на адзін з вашых набораў зменаў,
- створаных %{time}'
- commented_changeset: '%{commenter}% пакінуў каментар да набору зменаў, які
- вÑ\8b адÑ\81оÑ\87ваеÑ\86е Ñ\96 Ñ\88Ñ\82о бÑ\8bÑ\9e Ñ\81Ñ\82воÑ\80анÑ\8b %{changeset_author} %{time}'
+ your_changeset: '%{commenter} пакінуў каментарый на адзін з вашых набораў
+ зменаў, створаных %{time}'
+ commented_changeset: '%{commenter}% у %{time} пакінуў каментарый да набору
+ зменаÑ\9e ад %{changeset_author}, Ñ\8fкÑ\96 вÑ\8b адÑ\81оÑ\87ваеÑ\86е'
partial_changeset_with_comment: з каментаром '%{changeset_comment}'
partial_changeset_without_comment: без каментароў
details: Дадатковыя звесткі аб наборы зьменаў можна знайсці ў %{url}.
\nліцэнзія</a>, каб атрымаць падрабязную інфармацыю."
legal_title: Прававыя пытанні
legal_1_html: |-
- Гэты сайт і многія іншыя звязаныя паслугі фармальна кіруюцца <a href='http://osmfoundation.org/'>OpenStreetMap Foundation</a> (OSMF) ад імя супольнасці.
+ Гэты сайт і многія іншыя звязаныя сэрвісы фармальна кіруюцца <a href='https://osmfoundation.org/'>OpenStreetMap Foundation</a> (OSMF) ад імя супольнасці.
+ Выкарыстанне сэрвісаў OSMF рэгулюецца <a href="https://wiki.osmfoundation.org/wiki/Terms_of_Use">Умовамі карыстання</a>, <a href="https://wiki.openstreetmap.org/wiki/Acceptable_Use_Policy">
+ Палітыкай дазволенага карыстання</a>, <a href="https://wiki.osmfoundation.org/wiki/Privacy_Policy">Палітыкай прыватнасці</a>.
+ legal_2_html: |-
+ Калі ласка, <a href='https://osmfoundation.org/Contact'>звярніцеся да OSMF</a>, калі ў вас есць ліцэнзійныя, аўтарскія ці іншыя прававыя пытанні.
<br>
- Калі ласка, <a href="http://osmfoundation.org/Contact">звярніцеся да OSMF</a>, калі ў вас есць ліцэнзійныя, аўтарскія ці іншыя прававыя пытанні і праблемы.
+ OpenStreetMap, лагатып павелічальнага шкла і State of the Map з'яўляюцца <a href="https://wiki.osmfoundation.org/wiki/Trademark_Policy">зарэгістраванымі гандлёвымі маркамі OSMF</a>.
partners_title: Партнёры
copyright:
foreign:
description: Супольнасць падтрымлівае дапаможнік для пачаткоўцаў.
help:
url: https://help.openstreetmap.org/
- title: help.openstreetmap.org
- description: Задаць пытанне або знайсці адказы на сайце пытанняў і адказаў
+ title: Пытанні і адказы
+ description: Задайце пытанне або шукайце адказы на сайце пытанняў і адказаў
OSM.
mailing_lists:
title: Рассылкі
wiki:
url: http://wiki.openstreetmap.org/
title: Вікі OpenStreetMap
- description: Паглядзець вікі з падрабязнай дакументацыяй па OSM
+ description: Паглядзець вікі з падрабязнай дакументацыяй па OpenStreetMap
sidebar:
search_results: Вынікі пошуку
close: Закрыць
newer: Свежыя сляды
trace:
pending: У ЧАРЗЕ
- count_points: '%{count} пунктаў'
+ count_points:
+ one: 1 пункт
+ few: '%{count} пункты'
+ many: '%{count} пунктаў'
+ other: '%{count} пункты(аў)'
more: яшчэ
trace_details: Прагледзець уласцівасці следу
view_map: Прагледзець карту
title: Умовы
heading: Умовы
heading_ct: Умовы ўдзелу
+ read and accept with tou: Калі ласка, азнаёмцеся з пагадненнем удзельнікаў і
+ з умовамі выкарыстання, пасля чаго пастаўце абедзьве птушкі і націсніце кнопку
+ "Працягнуть".
+ contributor_terms_explain: Гэтае пагадненне регулюе ўмовы вашага існага і будучага
+ ўкладу.
+ read_ct: Я прачытаў і пагаджаюся з пагадненнем удзельнікаў.
+ tou_explain_html: '%{tou_link} кіруе сайтам і іншай інфраструктурай OSMF. Калі
+ ласка, прайдзіце па спасылцы і азнаёмцеся з тэкстам.'
read_tou: Я згаджаюся з Умовамі выкарыстання
consider_pd: У дадатак да прыведзенага пагаднення, я пацвярджаю, што мой уклад
знаходзіцца ў грамадскім набытку
ct status: 'Умовы ўдзелу:'
ct undecided: Нявырашана
ct declined: Адхіленыя
- latest edit: 'Апошняе рэдагаванне %{ago}:'
+ latest edit: 'Апошняе рэдагаванне (%{ago}):'
email address: 'Адрас электроннай пошты:'
created from: 'Створана з:'
status: 'Статус:'
title: Зняць блакіроўку з %{block_on}
heading_html: Зняць блакіроўку з %{block_on}, створаную %{block_by}
time_future: Гэтая блакіроўка скончыцца ў %{time}.
- past: Ð\93Ñ\8dÑ\82аÑ\8f блакÑ\96Ñ\80оÑ\9eка Ñ\81конÑ\87Ñ\8bлаÑ\81Ñ\8f %{time} Ñ\82амÑ\83 Ñ\96 не можа бÑ\8bÑ\86Ñ\8c Ñ\86Ñ\8fпеÑ\80 адклÑ\96кана.
+ past: Гэтая блакіроўка скончылася %{time} і не можа быць цяпер адклікана.
confirm: Вы ўпэўнены, што жадаеце адклікаць гэтую блакіроўку?
revoke: Адазваць!
flash: Гэтая блакіроўка была адклікана.
title: Слаі
copyright: © <a href='%{copyright_url}'>OpenStreetMap contributors</a>
donate_link_text: <a class='donate-attr' href='%{donate_url}'>Зрабіць ахвяраванне</a>
+ terms: <a href='%{terms_url}' target='_blank'>Умовы выкарыстання сайта і API</a>
site:
edit_tooltip: Рэдагаваць карту
edit_disabled_tooltip: Наблізце, каб рэдагаваць карту
farmyard: landwirtschaftliche Betriebsfläche
forest: Wald
garages: Garagen
- grass: Wiese
+ grass: Gras
greenfield: unerschlossenes Bauland
industrial: Industriegebiet
landfill: Deponie
forest: Wald
geyser: Geysir
glacier: Gletscher
- grassland: Wiese
+ grassland: Grasland
heath: Heide
hill: Hügel
island: Insel
login_button: Ensaluti
register now: Registriĝi
with username: 'Ĉu vi jam havas OpenStreetMap-konton? Bonvolu ensaluti per vian
- salutnomon kaj pasvorton:'
+ uzantnomon kaj pasvorton:'
with external: 'Alimaniere, ensalutu uzante:'
new to osm: Ĉu vi estas nova al OpenStreetMap?
to make changes: Por fari ŝanĝojn al datumoj de OpenStreetMap, vi devas havi
are_you_sure: Ĉu vi certe volas doni la rolon '%{role}' al la uzanto '%{name}'?
confirm: Konfirmi
fail: Ne povas doni rolon '%{role}' al la uzanto '%{name}'. Bonvolu kontroli,
- ĉu kaj uzanto kaj rolo estas korektaj.
+ ĉu kaj uzanto kaj rolo estas ĝustaj.
revoke:
title: Konfirmi nuligo de rolo
heading: Konfirmi nuligon de rolo
are_you_sure: Ĉu vi certe volas nuligi la rolon '%{role}' de la uzanto '%{name}'?
confirm: Konfirmi
fail: Ne povas nuligi la rolon '%{role}' de la uzanto '%{name}'. Bonvolu kontroli,
- ĉu kaj uzanto kaj rolo estas korektaj.
+ ĉu kaj uzanto kaj rolo estas ĝustaj.
user_blocks:
model:
non_moderator_update: Vi devas esti kontrolanto por doni aŭ ĝisdatigi blokadon.
gpx_notification:
greeting: Hei!
your_gpx_file: Ylöslattaamasi GPX-fiili
- with_description: ', jonka kuvvaus on'
+ with_description: ', jonka kuvvaus oon'
failure:
failed_to_import: 'epäonnistui importeerata. Täsä virhe:'
more_info_1: Lissää tietoja GPX-importeerausongelmista ja miten niitä voi
latitude: 'Lev:'
longitude: 'Pit:'
output: Tulos
- paste_html: Kopioi ja liitä tämä HTML-kooti verkkosivulesi
+ paste_html: Jäljennä ja liitä tämä HTML-kooti verkkosivulesi
export_button: Eksporteeraa
fixthemap:
title: Ilmota ongelmasta / Korjaa karttaa
title: Mookkaa sovellustasi
show:
edit: Mookkaa yksityiskohtia
+ delete: Ota poies kynti
confirm: Oletko varma?
form:
name: Nimi
title: Luodaan uusi redaktio
show:
description: 'Kuvvaus:'
- heading: Näytetään redaktio ”%{title}”
- title: Näytetään redaktio
+ heading: Näytethään redaktio ”%{title}”
+ title: Näytethään redaktio
user: 'Luoja:'
edit: Mookkaa tätä laitosta
destroy: Ota poies tämä redaktio
open: Opmaachen
resolved: Geléist
update:
- provide_details: Gitt w.e.g. déi gefroten Detailer un
+ provide_details: Gitt wgl. déi gefroten Detailer un
show:
resolve: Léisen
ignore: Ignoréieren
spam_label: Dës Notiz ass Spam
abusive_label: Dës Notiz ass abusiv
create:
- provide_details: Gitt w.e.g. déi gefroten Detailer un
+ provide_details: Gitt wgl. déi gefroten Detailer un
layouts:
logo:
alt_text: OpenStreetMap Logo
subject: '[OpenStreetMap] Ufro fir d''Passwuert zréckzesetzen'
lost_password_plain:
greeting: Salut,
- click_the_link: Wann Dir dat sidd da klickt w.e.g. op de Link hei drënner fir
+ click_the_link: Wann Dir dat sidd da klickt wgl. op de Link hei drënner fir
Äert Passwuert zréckzesetzen.
lost_password_html:
greeting: Salut,
- click_the_link: Wann Dir dat sidd da klickt w.e.g. op de Link hei drënner fir
+ click_the_link: Wann Dir dat sidd da klickt wgl. op de Link hei drënner fir
Ärt Passwuert zréckzesetzen.
note_comment_notification:
anonymous: En anonyme Benotzer
whats_on_the_map:
title: Wat ass op der Kaart
rules:
- title: Regelen!
+ title: Reegelen!
questions:
title: Nach Froen?
add_a_note:
terms:
heading: Bedingungen
consider_pd_why: wat ass dat?
- legale_select: 'Sicht w.e.g. d''Land eraus wou Dir wunnt:'
+ legale_select: 'Sicht wgl. d''Land eraus wou Dir wunnt:'
legale_names:
france: Frankräich
italy: Italien
confirm:
heading: Iwwerpréift Är E-Mail!
introduction_1: Mir hunn Iech eng Confirmatiouns-E-Mail geschéckt.
- press confirm button: Klickt w.e.g. op de Knäppchen confirméieren fir Äre Benotzerkont
+ press confirm button: Klickt wgl. op de Knäppchen confirméieren fir Äre Benotzerkont
z'aktivéieren.
button: Confirméieren
already active: Dëse Kont gouf scho confirméiert.
auth_failure:
no_authorization_code: Keen Autorisatiouns-Code
auth_association:
- option_1: Wann Dir nei sidd bei OpenSrreetMap da leet w.e.g. e Benotzerkont
- un andeem Dir de Formulaire hei drënner benotzt.
+ option_1: Wann Dir nei sidd bei OpenSrreetMap da leet wgl. e Benotzerkont un
+ andeem Dir de Formulaire hei drënner benotzt.
user_role:
filter:
not_a_role: D'Zeechen '%{role}' ass keng valabel Roll.
ofhuele wëllt?
confirm: Confirméieren
fail: D'Roll '%{role}' konnt net vum Benotzer '%{name}' ewechgeholl ginn. Kuckt
- w.e.g. no ob de Benotzer an d'Roll allen zwee valabel sinn.
+ wgl. no ob de Benotzer an d'Roll allen zwee valabel sinn.
user_blocks:
not_found:
back: Zréck op d'Iwwersiicht
create: सङ्ग्रह गर्नुहोस्
diary_entry:
create: प्रकाशन गर्नुहोस्
+ update: अद्यावधिक गर्नुहोस्
+ issue_comment:
+ create: टिप्पणी थप्नुहाेस्
message:
create: पठाउनुहोस्
client_application:
+ create: दर्ता गर्नुहाेस्
update: सम्पादन
trace:
create: अपलोड गर्ने
ब्राउजर सुस्त वा अनुत्तरदायी बनाउन सक्छ । तपाईं साँच्चै यो जानकारी हेर्न चाहनुहुन्छ
?'
load_data: डेटा लोडगर्ने
- loading: लà¥\8bड हà¥\81दà¥\88à¤\9b...
+ loading: à¤\96à¥\81लà¥\8dदà¥\88 à¤\9bâ\80¦
tag_details:
tags: ट्यागहरू
wiki_link:
comment: टिप्पणी
area: क्षेत्र
index:
- title: à¤\9aà¥\87नà¥\8dà¤\9cसà¥\87à¤\9fहरू
+ title: परिवरà¥\8dनहरू
title_user: '%{user}द्वरा गरिएका परिवर्तनहरू'
title_friend: तपाईंको मित्रहरूद्वारा गरिएका परिवर्तनहरू
title_nearby: तपाईंनजिक हुनुभएका प्रयोगकर्ताहरूद्वारा गरिएका परिवर्तनहरू
no_results: कुनै नतिजाहरू भेटिएनन्
more_results: थप नतिजाहरू
issues:
+ index:
+ search: खोज्नुहोस्
+ status: स्थिति
+ states:
+ open: खोल्नुहोस्
show:
+ ignore: वेवास्ता गर्नुहाेस्
new_reports: नयाँ प्रतिवेदनहरू
+ reports:
+ new:
+ categories:
+ note:
+ other_label: अन्य
layouts:
logo:
alt_text: OpenStreetMap लोगो
logout: निर्गमन
- log_in: लà¤\97 à¤\87न
- sign_up: साà¤\87न à¤\85प
+ log_in: पà¥\8dरवà¥\87श
+ sign_up: à¤\96ाता à¤\96ाà¥\87लà¥\8dनà¥\81हाà¥\87सà¥\8d
start_mapping: म्यापिङ गर्न सुरु गर्नुहोस्
edit: सम्पादन
history: इतिहास
title: नियमहरू !
traces:
new:
- upload_gpx: 'GPX फाइल अपलोड गर्ने:'
+ upload_gpx: 'जिपिएक्स फाइल उर्ध्वभरण गर्नुहाेस्:'
description: 'विवरण:'
tags: ट्यागहरूः
tags_help: अल्पविरामले छुट्याएको
no account: खाता छैन?
auth_providers:
wikipedia:
- title: विà¤\95िपिडियालà¥\87 लà¤\97 à¤\87न à¤\97रà¥\8dनà¥\81हà¥\8bस्
- alt: विà¤\95िपिडिया à¤\96ातादà¥\8dवारा लà¤\97à¤\87न गर्नुहोस्
+ title: विà¤\95िपिडियाà¤\95ाà¥\87 पà¥\8dरयाà¥\87à¤\97 à¤\97रि पà¥\8dरवà¥\87श à¤\97रà¥\8dनà¥\81हाà¥\87स्
+ alt: विà¤\95िपिडिया à¤\96ातादà¥\8dवारा पà¥\8dरवà¥\87श गर्नुहोस्
logout:
title: लगआउट
- logout_button: लà¤\97 à¤\86à¤\89à¤\9f
+ logout_button: निरà¥\8dà¤\97मन
lost_password:
title: पासवर्ड बिर्सियो
heading: पासवर्ड बिर्सिनुभयो ?
reset: नयाँ प्रवेशशव्द
flash changed: तपाईंको प्रवेश शब्द परिवर्तन गरिएको छ।
new:
- title: साà¤\87न à¤\85प
+ title: à¤\96ाता à¤\96ाà¥\87लà¥\8dनà¥\81हाà¥\87सà¥\8d
about:
header: खुल्ला र सम्पादन गर्न मिल्ने
email address: 'इमेल ठेगाना:'
display name: 'देखाउने नाम:'
password: 'पासवर्ड:'
confirm password: 'पासवर्ड निश्चित गर्नुहोस्:'
- continue: साà¤\87न à¤\85प
+ continue: à¤\96ाता à¤\96ाà¥\87लà¥\8dनà¥\81हाà¥\87सà¥\8d
terms:
consider_pd_why: यो के हो ?
decline: असहमत
# Author: Kastanoto
# Author: Kocio
# Author: Krottyianock
+# Author: Krzyz23
# Author: M4sk1n
# Author: Macofe
# Author: Maraf24
out: Oddal
locate:
title: Wyświetl dla mojego aktualnego położenia
+ metersUnit: Metrów
popup: Jesteś w promieniu {distance} {unit} od tego punktu
base:
standard: Podstawowa
x_seconds:
one: '%{count} секунда назад'
few: '%{count} секунды назад'
- other: '%{count} секунд назад'
+ many: '%{count} секунд назад'
x_minutes:
one: '%{count} минута назад'
few: '%{count} минуты назад'
- other: '%{count} минут назад'
+ many: '%{count} минут назад'
x_days:
one: '%{count} день назад'
few: '%{count} дня назад'
- other: '%{count} дней назад'
+ many: '%{count} дней назад'
x_months:
one: 1 месяц назад
few: '%{count} месяца назад'
tag: Страница вики, описывающая тег %{key}=%{value}
wikidata_link: Элемент %{page} в Викиданных
wikipedia_link: Статья %{page} в Википедии
+ wikimedia_commons_link: Элемент %{page} на Викискладе
telephone_link: Позвонить %{phone_number}
colour_preview: Просмотр цвета %{colour_value}
note:
comments:
reassign_param: Переназначить проблему?
reports:
- reported_by_html: Указано как %{category} пользователем %{user}
+ reported_by_html: Указано как %{category} пользователем %{user} в %{updated_at}
helper:
reportable_title:
diary_comment: '%{entry_title}, коммент. #%{comment_id}'
под той же лицензией. Смотрите <a href=''%{copyright_path}''>Авторские права
и лицензирование</a> для более подробной информации.'
legal_title: Юридические вопросы
- legal_1_html: |-
- Этот веб-сайт и многие связанные с ними услуги находятся в ведении <a href='https://osmfoundation.org/'>OpenStreetMap Foundation</a> (OSMF), действующего от имени сообщества OSM. Использование предоставляемых OSMF услуг является предметом нашей <a href="https://wiki.osmfoundation.org/wiki/Privacy_Policy">Политики конфиденциальности</a> и «<a href="https://wiki.openstreetmap.org/wiki/Acceptable_Use_Policy">Политики приемлемого использования</a>».<br>Пожалуйста, <a href='https://osmfoundation.org/Contact'>свяжитесь с OSMF</a>, если есть вопросы относительно лицензирования, авторских прав, либо другие правовые вопросы.
+ legal_1_html: Этот веб-сайт и многие связанные с ними услуги находятся в ведении
+ <a href='https://osmfoundation.org/'>OpenStreetMap Foundation</a> (OSMF),
+ действующего от имени сообщества OSM. Использование предоставляемых OSMF услуг
+ является предметом наших <a href="https://wiki.osmfoundation.org/wiki/Terms_of_Use">Условий
+ использования</a>, <a href="https://wiki.openstreetmap.org/wiki/Acceptable_Use_Policy">Политики
+ приемлемого использования</a> и нашей <a href="https://wiki.osmfoundation.org/wiki/Privacy_Policy">Политики
+ конфиденциальности</a>.
+ legal_2_html: |-
+ Пожалуйста, <a href='https://osmfoundation.org/Contact'>свяжитесь с OSMF</a>, если у вас есть вопросы относительно лицензирования, авторских прав либо других правовых вопросов.
<br>
- Логотип OpenStreetMap в виде увеличительного стекла и логотип State of the Map — <a href="https://wiki.osmfoundation.org/wiki/Trademark_Policy">зарегистрированные товарные знаки организации OSMF</a>.
+ OpenStreetMap, логотип OpenStreetMap в виде увеличительного стекла и State of the Map — <a href="https://wiki.osmfoundation.org/wiki/Trademark_Policy">зарегистрированные товарные знаки организации OSMF</a>.
partners_title: Партнёры
copyright:
foreign:
для взаимодействия с нами через стандарт %{oauth}? Вы должны зарегистрировать
ваше веб-приложение перед тем, как оно сможет сделать OAuth-запрос к этой
службе.
+ oauth: OAuth
registered_apps: 'У вас зарегистрированы следующие клиентские приложения:'
register_new: Зарегистрировать ваше приложение
form:
protected_area: Khu bảo tồn
bridge:
aqueduct: Cống nước
+ boardwalk: Lối đi có Lót Ván
suspension: Cầu Treo
swing: Cầu Quay
viaduct: Cầu Cạn
"yes": Doanh nghiệp Thủ công
emergency:
ambulance_station: Trạm Xe cứu thương
+ assembly_point: Điểm Tập trung Khẩn cấp
defibrillator: Máy Khử Rung Tim
landing_site: Nơi Hạ cánh Khẩn cấp
phone: Điện thoại Khẩn cấp
viewpoint: Thắng cảnh
zoo: Vườn thú
tunnel:
+ building_passage: Lối Xuyên thủng Tòa nhà
culvert: Cống
"yes": Đường hầm
waterway:
reopen:
reopened: Trạng thái vấn đề được đánh dấu là “Mở”
comments:
+ comment_from_html: Bình luận của %{user_link} vào %{comment_created_at}
reassign_param: Chỉ định lại Vấn đề?
reports:
- reported_by_html: Báo cáo là %{category} bởi %{user}
+ reported_by_html: Báo cáo là %{category} bởi %{user} vào %{updated_at}
helper:
reportable_title:
diary_comment: '%{entry_title}, bình luận #%{comment_id}'
+BUNDLE ?= bundle
PG_CONFIG ?= pg_config
DESTDIR ?= .
-QTDIR=$(shell bundle show quad_tile | tail -n 1)/ext/quad_tile
+QTDIR=$(shell ${BUNDLE} show quad_tile | tail -n 1)/ext/quad_tile
OS=$(shell uname -s)
ifeq (${OS},Darwin)
{ :path => "/api/0.6/map", :method => :get },
{ :controller => "api/map", :action => "index" }
)
+ assert_routing(
+ { :path => "/api/0.6/map.json", :method => :get },
+ { :controller => "api/map", :action => "index", :format => "json" }
+ )
+ end
+
+ ##
+ # test http accept headers
+ def test_http_accept_header
+ node = create(:node)
+
+ minlon = node.lon - 0.1
+ minlat = node.lat - 0.1
+ maxlon = node.lon + 0.1
+ maxlat = node.lat + 0.1
+ bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
+
+ # Accept: XML format -> use XML
+ http_accept_format("text/xml")
+ get :index, :params => { :bbox => bbox }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/xml; charset=utf-8", @response.header["Content-Type"]
+
+ # Accept: Any format -> use XML
+ http_accept_format("*/*")
+ get :index, :params => { :bbox => bbox }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/xml; charset=utf-8", @response.header["Content-Type"]
+
+ # Accept: Any format, .json URL suffix -> use json
+ http_accept_format("*/*")
+ get :index, :params => { :bbox => bbox, :format => "json" }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/json; charset=utf-8", @response.header["Content-Type"]
+
+ # Accept: Firefox header -> use XML
+ http_accept_format("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
+ get :index, :params => { :bbox => bbox }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/xml; charset=utf-8", @response.header["Content-Type"]
+
+ # Accept: JOSM header text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 -> use XML
+ # Note: JOSM's header does not comply with RFC 7231, section 5.3.1
+ http_accept_format("text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2")
+ get :index, :params => { :bbox => bbox }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/xml; charset=utf-8", @response.header["Content-Type"]
+
+ # Accept: text/plain, */* -> use XML
+ http_accept_format("text/plain, */*")
+ get :index, :params => { :bbox => bbox }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/xml; charset=utf-8", @response.header["Content-Type"]
+
+ # Accept: text/* -> use XML
+ http_accept_format("text/*")
+ get :index, :params => { :bbox => bbox }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/xml; charset=utf-8", @response.header["Content-Type"]
+
+ # Accept: json, */* format -> use json
+ http_accept_format("application/json, */*")
+ get :index, :params => { :bbox => bbox }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/json; charset=utf-8", @response.header["Content-Type"]
+
+ # Accept: json format -> use json
+ http_accept_format("application/json")
+ get :index, :params => { :bbox => bbox }
+ assert_response :success, "Expected success with the map call"
+ assert_equal "application/json; charset=utf-8", @response.header["Content-Type"]
+
+ # text/json is in invalid format, return HTTP 406 Not acceptable
+ http_accept_format("text/json")
+ get :index, :params => { :bbox => bbox }
+ assert_response :not_acceptable, "text/json should fail"
+
+ # image/jpeg is a format which we don't support, return HTTP 406 Not acceptable
+ http_accept_format("image/jpeg")
+ get :index, :params => { :bbox => bbox }
+ assert_response :not_acceptable, "text/json should fail"
end
# -------------------------------------
end
end
+ def test_map_json
+ node = create(:node, :lat => 7, :lon => 7)
+ tag = create(:node_tag, :node => node)
+ way1 = create(:way_node, :node => node).way
+ way2 = create(:way_node, :node => node).way
+ relation = create(:relation_member, :member => node).relation
+
+ # Need to split the min/max lat/lon out into their own variables here
+ # so that we can test they are returned later.
+ minlon = node.lon - 0.1
+ minlat = node.lat - 0.1
+ maxlon = node.lon + 0.1
+ maxlat = node.lat + 0.1
+ bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
+ get :index, :params => { :bbox => bbox, :format => "json" }
+ if $VERBOSE
+ print @request.to_yaml
+ print @response.body
+ end
+ assert_response :success, "Expected success with the map call"
+ js = ActiveSupport::JSON.decode(@response.body)
+ assert_not_nil js
+
+ assert_equal Settings.api_version, js["version"]
+ assert_equal Settings.generator, js["generator"]
+ assert_equal GeoRecord::Coord.new(minlon), js["bounds"]["minlon"]
+ assert_equal GeoRecord::Coord.new(minlat), js["bounds"]["minlat"]
+ assert_equal GeoRecord::Coord.new(maxlon), js["bounds"]["maxlon"]
+ assert_equal GeoRecord::Coord.new(maxlat), js["bounds"]["maxlat"]
+
+ result_nodes = js["elements"].select { |a| a["type"] == "node" }
+ .select { |a| a["id"] == node.id }
+ .select { |a| a["lat"] == GeoRecord::Coord.new(node.lat) }
+ .select { |a| a["lon"] == GeoRecord::Coord.new(node.lon) }
+ .select { |a| a["version"] == node.version }
+ .select { |a| a["changeset"] == node.changeset_id }
+ .select { |a| a["timestamp"] == node.timestamp.xmlschema }
+ assert_equal result_nodes.count, 1
+ result_node = result_nodes.first
+
+ assert_equal result_node["tags"], tag.k => tag.v
+ assert_equal 2, (js["elements"].count { |a| a["type"] == "way" })
+ assert_equal 1, (js["elements"].count { |a| a["type"] == "way" && a["id"] == way1.id })
+ assert_equal 1, (js["elements"].count { |a| a["type"] == "way" && a["id"] == way2.id })
+ assert_equal 1, (js["elements"].count { |a| a["type"] == "relation" })
+ assert_equal 1, (js["elements"].count { |a| a["type"] == "relation" && a["id"] == relation.id })
+ end
+
# This differs from the above test in that we are making the bbox exactly
# the same as the node we are looking at
def test_map_inclusive
{ :path => "/api/0.6/node/1", :method => :get },
{ :controller => "api/nodes", :action => "show", :id => "1" }
)
+ assert_routing(
+ { :path => "/api/0.6/node/1.json", :method => :get },
+ { :controller => "api/nodes", :action => "show", :id => "1", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/node/1", :method => :put },
{ :controller => "api/nodes", :action => "update", :id => "1" }
{ :path => "/api/0.6/nodes", :method => :get },
{ :controller => "api/nodes", :action => "index" }
)
+ assert_routing(
+ { :path => "/api/0.6/nodes.json", :method => :get },
+ { :controller => "api/nodes", :action => "index", :format => "json" }
+ )
end
def test_create
assert_select "node[id='#{node5.id}'][visible='false']", :count => 1
end
+ # test a working call with json format
+ get :index, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}", :format => "json" }
+
+ js = ActiveSupport::JSON.decode(@response.body)
+ assert_not_nil js
+ assert_equal 5, js["elements"].count
+ assert_equal 5, (js["elements"].count { |a| a["type"] == "node" })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == node1.id && a["visible"].nil? })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == node2.id && a["visible"] == false })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == node3.id && a["visible"].nil? })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == node4.id && a["visible"].nil? })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == node5.id && a["visible"] == false })
+
# check error when a non-existent node is included
get :index, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0" }
assert_response :not_found
{ :path => "/api/0.6/node/1/2", :method => :get },
{ :controller => "api/old_nodes", :action => "version", :id => "1", :version => "2" }
)
+ assert_routing(
+ { :path => "/api/0.6/node/1/history.json", :method => :get },
+ { :controller => "api/old_nodes", :action => "history", :id => "1", :format => "json" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/node/1/2.json", :method => :get },
+ { :controller => "api/old_nodes", :action => "version", :id => "1", :version => "2", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/node/1/2/redact", :method => :post },
{ :controller => "api/old_nodes", :action => "redact", :id => "1", :version => "2" }
{ :path => "/api/0.6/relation/1/2", :method => :get },
{ :controller => "api/old_relations", :action => "version", :id => "1", :version => "2" }
)
+ assert_routing(
+ { :path => "/api/0.6/relation/1/history.json", :method => :get },
+ { :controller => "api/old_relations", :action => "history", :id => "1", :format => "json" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/relation/1/2.json", :method => :get },
+ { :controller => "api/old_relations", :action => "version", :id => "1", :version => "2", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/relation/1/2/redact", :method => :post },
{ :controller => "api/old_relations", :action => "redact", :id => "1", :version => "2" }
{ :path => "/api/0.6/way/1/2", :method => :get },
{ :controller => "api/old_ways", :action => "version", :id => "1", :version => "2" }
)
+ assert_routing(
+ { :path => "/api/0.6/way/1/history.json", :method => :get },
+ { :controller => "api/old_ways", :action => "history", :id => "1", :format => "json" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/way/1/2.json", :method => :get },
+ { :controller => "api/old_ways", :action => "version", :id => "1", :version => "2", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/way/1/2/redact", :method => :post },
{ :controller => "api/old_ways", :action => "redact", :id => "1", :version => "2" }
{ :path => "/api/0.6/relation/1/full", :method => :get },
{ :controller => "api/relations", :action => "full", :id => "1" }
)
+ assert_routing(
+ { :path => "/api/0.6/relation/1/full.json", :method => :get },
+ { :controller => "api/relations", :action => "full", :id => "1", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/relation/1", :method => :get },
{ :controller => "api/relations", :action => "show", :id => "1" }
)
+ assert_routing(
+ { :path => "/api/0.6/relation/1.json", :method => :get },
+ { :controller => "api/relations", :action => "show", :id => "1", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/relation/1", :method => :put },
{ :controller => "api/relations", :action => "update", :id => "1" }
{ :path => "/api/0.6/relations", :method => :get },
{ :controller => "api/relations", :action => "index" }
)
+ assert_routing(
+ { :path => "/api/0.6/relations.json", :method => :get },
+ { :controller => "api/relations", :action => "index", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/node/1/relations", :method => :get },
{ :path => "/api/0.6/relation/1/relations", :method => :get },
{ :controller => "api/relations", :action => "relations_for_relation", :id => "1" }
)
+ assert_routing(
+ { :path => "/api/0.6/node/1/relations.json", :method => :get },
+ { :controller => "api/relations", :action => "relations_for_node", :id => "1", :format => "json" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/way/1/relations.json", :method => :get },
+ { :controller => "api/relations", :action => "relations_for_way", :id => "1", :format => "json" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/relation/1/relations.json", :method => :get },
+ { :controller => "api/relations", :action => "relations_for_relation", :id => "1", :format => "json" }
+ )
end
# -------------------------------------
assert_select "relation[id='#{relation4.id}'][visible='true']", :count => 1
end
+ # test a working call with json format
+ get :index, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}", :format => "json" }
+
+ js = ActiveSupport::JSON.decode(@response.body)
+ assert_not_nil js
+ assert_equal 4, js["elements"].count
+ assert_equal 4, (js["elements"].count { |a| a["type"] == "relation" })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == relation1.id && a["visible"].nil? })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == relation2.id && a["visible"] == false })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == relation3.id && a["visible"].nil? })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == relation4.id && a["visible"].nil? })
+
# check error when a non-existent relation is included
get :index, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0" }
assert_response :not_found
{ :path => "/api/0.6/way/1/full", :method => :get },
{ :controller => "api/ways", :action => "full", :id => "1" }
)
+ assert_routing(
+ { :path => "/api/0.6/way/1/full.json", :method => :get },
+ { :controller => "api/ways", :action => "full", :id => "1", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/way/1", :method => :get },
{ :controller => "api/ways", :action => "show", :id => "1" }
)
+ assert_routing(
+ { :path => "/api/0.6/way/1.json", :method => :get },
+ { :controller => "api/ways", :action => "show", :id => "1", :format => "json" }
+ )
assert_routing(
{ :path => "/api/0.6/way/1", :method => :put },
{ :controller => "api/ways", :action => "update", :id => "1" }
{ :path => "/api/0.6/ways", :method => :get },
{ :controller => "api/ways", :action => "index" }
)
+ assert_routing(
+ { :path => "/api/0.6/ways.json", :method => :get },
+ { :controller => "api/ways", :action => "index", :format => "json" }
+ )
end
# -------------------------------------
assert_select "way[id='#{way4.id}'][visible='true']", :count => 1
end
+ # test a working call with json format
+ get :index, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}", :format => "json" }
+
+ js = ActiveSupport::JSON.decode(@response.body)
+ assert_not_nil js
+ assert_equal 4, js["elements"].count
+ assert_equal 4, (js["elements"].count { |a| a["type"] == "way" })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == way1.id && a["visible"].nil? })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == way2.id && a["visible"] == false })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == way3.id && a["visible"].nil? })
+ assert_equal 1, (js["elements"].count { |a| a["id"] == way4.id && a["visible"].nil? })
+
# check error when a non-existent way is included
get :index, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0" }
assert_response :not_found
@request.env["HTTP_AUTHORIZATION"] = format("Basic %{auth}", :auth => Base64.encode64("#{user}:#{pass}"))
end
+ ##
+ # set request header for HTTP Accept
+ def http_accept_format(format)
+ @request.env["HTTP_ACCEPT"] = format
+ end
+
##
# set request readers to ask for a particular error format
def error_format(format)