diff --git a/app/assets/javascripts/app/config.js.coffee b/app/assets/javascripts/app/config.js.coffee new file mode 100644 index 000000000..86c49232d --- /dev/null +++ b/app/assets/javascripts/app/config.js.coffee @@ -0,0 +1 @@ +App.Config.set('api_path', 'api/v1') \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index a49d14180..a0bf695c2 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -375,7 +375,7 @@ class App.Controller extends Spine.Controller tickets = {} App.Com.ajax( type: 'GET', - url: 'api/ticket_customer', + url: @Config.get('api_path') + '/ticket_customer', data: { customer_id: data.user_id, } diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index b70c44dec..937b9b719 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -358,7 +358,7 @@ class App.ControllerForm extends App.Controller u = => @el.find('#' + fileUploaderId ).fineUploader( request: - endpoint: 'api/ticket_attachment_new' + endpoint: App.Config.get('api_path') + '/ticket_attachment_new' params: form_id: @form_id text: diff --git a/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee index 978bbf20a..5125b4258 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee @@ -23,7 +23,7 @@ class App.DashboardActivityStream extends App.Controller App.Com.ajax( id: 'dashoard_activity_stream' type: 'GET' - url: 'api/activity_stream' + url: @Config.get('api_path') + '/activity_stream' data: { limit: 8 } diff --git a/app/assets/javascripts/app/controllers/_dashboard/recent_viewed.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/recent_viewed.js.coffee index dfca5830c..e394503b3 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/recent_viewed.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/recent_viewed.js.coffee @@ -11,7 +11,7 @@ class App.DashboardRecentViewed extends App.Controller App.Com.ajax( id: 'dashboard_recent_viewed', type: 'GET', - url: 'api/recent_viewed', + url: @Config.get('api_path') + '/recent_viewed', data: { limit: 5, } diff --git a/app/assets/javascripts/app/controllers/_dashboard/rss.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/rss.js.coffee index 395355282..0f75ac7a1 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/rss.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/rss.js.coffee @@ -21,7 +21,7 @@ class App.DashboardRss extends App.Controller App.Com.ajax( id: 'dashboard_rss' type: 'GET' - url: 'api/rss_fetch' + url: @Config.get('api_path') + '/rss_fetch' data: { limit: 8 url: 'http://www.heise.de/newsticker/heise-atom.xml' diff --git a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee index ca4ee62cd..3f56ed71a 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee @@ -30,7 +30,7 @@ class App.DashboardTicket extends App.Controller App.Com.ajax( id: 'dashboard_ticket_' + @key, type: 'GET', - url: 'api/ticket_overviews', + url: @Config.get('api_path') + '/ticket_overviews', data: { view: @view, view_mode: 'd', diff --git a/app/assets/javascripts/app/controllers/_profile/language.js.coffee b/app/assets/javascripts/app/controllers/_profile/language.js.coffee index a86a78ba2..c0b92129a 100644 --- a/app/assets/javascripts/app/controllers/_profile/language.js.coffee +++ b/app/assets/javascripts/app/controllers/_profile/language.js.coffee @@ -37,7 +37,7 @@ class App.ProfileLanguage extends App.Controller App.Com.ajax( id: 'preferences' type: 'PUT' - url: 'api/users/preferences' + url: @Config.get('api_path') + '/users/preferences' data: JSON.stringify(params) processData: true success: @success diff --git a/app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee b/app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee index 9ac63a957..adb7d3f0d 100644 --- a/app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee +++ b/app/assets/javascripts/app/controllers/_profile/linked_accounts.js.coffee @@ -53,7 +53,7 @@ class App.ProfileLinkedAccounts extends App.Controller App.Com.ajax( id: 'account' type: 'DELETE' - url: 'api/users/account' + url: @Config.get('api_path') + '/users/account' data: JSON.stringify({ provider: provider, uid: uid }) processData: true success: @success diff --git a/app/assets/javascripts/app/controllers/_profile/password.js.coffee b/app/assets/javascripts/app/controllers/_profile/password.js.coffee index 1c12a4abb..1d7cedbea 100644 --- a/app/assets/javascripts/app/controllers/_profile/password.js.coffee +++ b/app/assets/javascripts/app/controllers/_profile/password.js.coffee @@ -38,7 +38,7 @@ class App.ProfilePassword extends App.Controller App.Com.ajax( id: 'password_reset' type: 'POST' - url: 'api/users/password_change' + url: @Config.get('api_path') + '/users/password_change' data: JSON.stringify(params) processData: true success: @success diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee index 26b93583f..bb1258872 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee @@ -105,7 +105,7 @@ class App.TicketCreate extends App.Controller App.Com.ajax( id: 'ticket_create' type: 'GET' - url: 'api/ticket_create' + url: @Config.get('api_path') + '/ticket_create' data: ticket_id: params.ticket_id article_id: params.article_id @@ -149,7 +149,7 @@ class App.TicketCreate extends App.Controller # generate form configure_attributes = [ - { name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 200, null: false, relation: 'User', class: 'span7', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '»', callback: @localUserInfo, source: 'api/users/search', minLengt: 2 }, + { name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 200, null: false, relation: 'User', class: 'span7', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '»', callback: @localUserInfo, source: @Config.get('api_path') + '/users/search', minLengt: 2 }, { name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: false, filter: @edit_form, nulloption: true, relation: 'Group', default: defaults['group_id'], class: 'span7', }, { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, filter: @edit_form, nulloption: true, relation: 'User', default: defaults['owner_id'], class: 'span7', }, { name: 'tags', display: 'Tags', tag: 'tag', type: 'text', null: true, default: defaults['tags'], class: 'span7', }, diff --git a/app/assets/javascripts/app/controllers/agent_ticket_history.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_history.js.coffee index 7ef9d98aa..275b575fa 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_history.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_history.js.coffee @@ -13,7 +13,7 @@ class App.TicketHistory extends App.ControllerModal App.Com.ajax( id: 'ticket_history', type: 'GET', - url: 'api/ticket_history/' + ticket_id, + url: @Config.get('api_path') + '/ticket_history/' + ticket_id, success: (data, status, xhr) => # remember ticket @ticket = data.ticket diff --git a/app/assets/javascripts/app/controllers/agent_ticket_merge.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_merge.js.coffee index ab46ca86a..313c4237e 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_merge.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_merge.js.coffee @@ -9,7 +9,7 @@ class App.TicketMerge extends App.ControllerModal App.Com.ajax( id: 'ticket_merge_list', type: 'GET', - url: 'api/ticket_merge_list/' + @ticket_id, + url: @Config.get('api_path') + '/ticket_merge_list/' + @ticket_id, data: { # view: @view } @@ -107,7 +107,7 @@ class App.TicketMerge extends App.ControllerModal App.Com.ajax( id: 'ticket_merge', type: 'GET', - url: 'api/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'], + url: @Config.get('api_path') + '/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'], data: { # view: @view } diff --git a/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee index f0275f221..e7d38b1fd 100644 --- a/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee @@ -37,7 +37,7 @@ class Index extends App.ControllerContent App.Com.ajax( id: 'ticket_create', type: 'GET', - url: 'api/ticket_create', + url: @Config.get('api_path') + '/ticket_create', data: { ticket_id: params.ticket_id, article_id: params.article_id, diff --git a/app/assets/javascripts/app/controllers/getting_started.js.coffee b/app/assets/javascripts/app/controllers/getting_started.js.coffee index 2325f73e0..93c9d68ca 100644 --- a/app/assets/javascripts/app/controllers/getting_started.js.coffee +++ b/app/assets/javascripts/app/controllers/getting_started.js.coffee @@ -21,7 +21,7 @@ class Index extends App.ControllerContent App.Com.ajax( id: 'getting_started', type: 'GET', - url: 'api/getting_started', + url: @Config.get('api_path') + '/getting_started', data: { # view: @view, } diff --git a/app/assets/javascripts/app/controllers/link_info_widget.js.coffee b/app/assets/javascripts/app/controllers/link_info_widget.js.coffee index ac7730bbf..7a2c74f08 100644 --- a/app/assets/javascripts/app/controllers/link_info_widget.js.coffee +++ b/app/assets/javascripts/app/controllers/link_info_widget.js.coffee @@ -14,7 +14,7 @@ class App.LinkInfo extends App.Controller App.Com.ajax( id: 'links_' + @object.id + '_' + @object_type, type: 'GET', - url: 'api/links', + url: @Config.get('api_path') + '/links', data: { link_object: @object_type, link_object_value: @object.id, @@ -83,7 +83,7 @@ class App.LinkInfo extends App.Controller App.Com.ajax( id: 'links_remove_' + @object.id + '_' + @object_type, type: 'GET', - url: 'api/links/remove', + url: @Config.get('api_path') + '/links/remove', data: { link_type: link_type, link_object_source: link_object_source, @@ -126,7 +126,7 @@ class App.LinkAdd extends App.ControllerModal App.Com.ajax( id: 'links_add_' + @object.id + '_' + @object_type, type: 'GET', - url: 'api/links/add', + url: @Config.get('api_path') + '/links/add', data: { link_type: params['link_type'], link_object_target: 'Ticket', diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index 4b5e1c546..bba841afd 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -86,7 +86,7 @@ class App.Navigation extends App.Controller App.Com.ajax( id: 'ticket_search' type: 'GET' - url: 'api/search' + url: @Config.get('api_path') + '/search' data: term: @term processData: true, diff --git a/app/assets/javascripts/app/controllers/package.js.coffee b/app/assets/javascripts/app/controllers/package.js.coffee index 4f7b5b402..e460daf19 100644 --- a/app/assets/javascripts/app/controllers/package.js.coffee +++ b/app/assets/javascripts/app/controllers/package.js.coffee @@ -16,7 +16,7 @@ class Index extends App.ControllerContent App.Com.ajax( id: 'packages', type: 'GET', - url: 'api/packages', + url: @Config.get('api_path') + '/packages', processData: true, success: (data) => @render(data) diff --git a/app/assets/javascripts/app/controllers/reset_password.js.coffee b/app/assets/javascripts/app/controllers/reset_password.js.coffee index ca00958d5..048379258 100644 --- a/app/assets/javascripts/app/controllers/reset_password.js.coffee +++ b/app/assets/javascripts/app/controllers/reset_password.js.coffee @@ -46,7 +46,7 @@ class Index extends App.ControllerContent App.Com.ajax( id: 'password_reset' type: 'POST' - url: 'api/users/password_reset' + url: @Config.get('api_path') + '/users/password_reset' data: JSON.stringify(params) processData: true success: @success @@ -86,7 +86,7 @@ class Verify extends App.ControllerContent App.Com.ajax( id: 'password_reset_verify' type: 'POST' - url: 'api/users/password_reset_verify' + url: @Config.get('api_path') + '/users/password_reset_verify' data: JSON.stringify(params) processData: true success: @render_success @@ -122,7 +122,7 @@ class Verify extends App.ControllerContent App.Com.ajax( id: 'password_reset_verify' type: 'POST' - url: 'api/users/password_reset_verify' + url: @Config.get('api_path') + '/users/password_reset_verify' data: JSON.stringify(params) processData: true success: @render_changed_success diff --git a/app/assets/javascripts/app/controllers/session.js.coffee b/app/assets/javascripts/app/controllers/session.js.coffee index 9b704a006..5f9c77b3e 100644 --- a/app/assets/javascripts/app/controllers/session.js.coffee +++ b/app/assets/javascripts/app/controllers/session.js.coffee @@ -19,7 +19,7 @@ class Session extends App.ControllerContent App.Com.ajax( id: 'sessions' type: 'GET' - url: 'api/sessions' + url: @Config.get('api_path') + '/sessions' success: (data) => @render(data) ) @@ -45,7 +45,7 @@ class Session extends App.ControllerContent App.Com.ajax( id: 'sessions/' + sessionId type: 'DELETE' - url: 'api/sessions/' + sessionId + url: @Config.get('api_path') + '/sessions/' + sessionId success: (data) => @load() ) diff --git a/app/assets/javascripts/app/controllers/tag_widget.js.coffee b/app/assets/javascripts/app/controllers/tag_widget.js.coffee index 60f66809f..72ba12ffd 100644 --- a/app/assets/javascripts/app/controllers/tag_widget.js.coffee +++ b/app/assets/javascripts/app/controllers/tag_widget.js.coffee @@ -12,7 +12,7 @@ class App.TagWidget extends App.Controller App.Com.ajax( id: @attribute_id type: 'GET' - url: 'api/tags' + url: @Config.get('api_path') + '/tags' data: object: @object_type o_id: @object.id @@ -42,7 +42,7 @@ class App.TagWidget extends App.Controller onAddTag: (item) => App.Com.ajax( type: 'GET', - url: 'api/tags/add', + url: @Config.get('api_path') + '/tags/add', data: object: @object_type, o_id: @object.id, @@ -55,7 +55,7 @@ class App.TagWidget extends App.Controller onRemoveTag: (item) => App.Com.ajax( type: 'GET' - url: 'api/tags/remove' + url: @Config.get('api_path') + '/tags/remove' data: object: @object_type o_id: @object.id diff --git a/app/assets/javascripts/app/controllers/ticket_customer.js.coffee b/app/assets/javascripts/app/controllers/ticket_customer.js.coffee index 8fc9ae6eb..506b16b03 100644 --- a/app/assets/javascripts/app/controllers/ticket_customer.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_customer.js.coffee @@ -5,7 +5,7 @@ class App.TicketCustomer extends App.ControllerModal render: -> configure_attributes = [ - { name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 100, null: false, relation: 'User', class: 'span5', autocapitalize: false, help: 'Select the new customer of the Ticket.', source: 'api/users/search', minLengt: 2 }, + { name: 'customer_id', display: 'Customer', tag: 'autocompletion', type: 'text', limit: 100, null: false, relation: 'User', class: 'span5', autocapitalize: false, help: 'Select the new customer of the Ticket.', source: @Config.get('api_path') + '/users/search', minLengt: 2 }, ] @html App.view('agent_ticket_customer')() diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index 3e503a475..74b34ac6a 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -42,7 +42,7 @@ class Index extends App.ControllerContent App.Com.ajax( id: 'ticket_overview_' + @key, type: 'GET', - url: 'api/ticket_overviews', + url: @Config.get('api_path') + '/ticket_overviews', data: { view: @view, view_mode: @view_mode, @@ -502,7 +502,7 @@ class Router extends App.Controller else App.Com.ajax( type: 'GET' - url: 'api/ticket_overviews' + url: @Config.get('api_path') + '/ticket_overviews' data: view: @view array: true diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index f51393683..94880f705 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -67,7 +67,7 @@ class App.TicketZoom extends App.Controller App.Com.ajax( id: 'ticket_zoom_' + ticket_id type: 'GET' - url: 'api/ticket_full/' + ticket_id + '?do_not_log=' + @doNotLog + url: @Config.get('api_path') + '/ticket_full/' + ticket_id + '?do_not_log=' + @doNotLog data: view: @view processData: true diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee index b1b5fc0a5..ad4042f9f 100644 --- a/app/assets/javascripts/app/index.js.coffee +++ b/app/assets/javascripts/app/index.js.coffee @@ -1,6 +1,7 @@ #= require_self #= require_tree ./lib/app_init +#= require ./config.js.coffee #= require_tree ./models #= require_tree ./controllers #= require_tree ./views diff --git a/app/assets/javascripts/app/lib/app_post/auth.js.coffee b/app/assets/javascripts/app/lib/app_post/auth.js.coffee index 72f471fa7..beb9c7832 100644 --- a/app/assets/javascripts/app/lib/app_post/auth.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/auth.js.coffee @@ -5,7 +5,7 @@ class App.Auth App.Com.ajax( id: 'login', type: 'POST', - url: '/signin', + url: App.Config.get('api_path') + '/signin', data: JSON.stringify(params.data), success: (data, status, xhr) => @@ -26,7 +26,7 @@ class App.Auth id: 'login_check' async: false type: 'GET' - url: '/signshow' + url: App.Config.get('api_path') + '/signshow' success: (data, status, xhr) => # set login (config, session, ...) @@ -41,7 +41,7 @@ class App.Auth App.Com.ajax( id: 'logout' type: 'DELETE' - url: '/signout' + url: App.Config.get('api_path') + '/signout' success: => # set logout (config, session, ...) diff --git a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee index 8edf82ed2..8c2a442ff 100644 --- a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee @@ -103,7 +103,7 @@ class _i18nSingleton extends Spine.Module App.Com.ajax( id: 'i18n-set-' + locale, type: 'GET', - url: '/translations/lang/' + locale, + url: App.Config.get('api_path') + '/translations/lang/' + locale, async: false, success: (data, status, xhr) => diff --git a/app/assets/javascripts/app/lib/app_post/websocket.js.coffee b/app/assets/javascripts/app/lib/app_post/websocket.js.coffee index a8ccd597f..e5be0b9ba 100644 --- a/app/assets/javascripts/app/lib/app_post/websocket.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/websocket.js.coffee @@ -293,7 +293,7 @@ class _webSocketSingleton extends App.Controller # call init request @_ajaxInitWorking = App.Com.ajax( type: 'POST' - url: 'api/message_send' + url: @Config.get('api_path') + '/message_send' data: JSON.stringify({ data: { action: 'login' } }) processData: false queue: false @@ -329,7 +329,7 @@ class _webSocketSingleton extends App.Controller data = @queue.shift() App.Com.ajax( type: 'POST' - url: 'api/message_send' + url: @Config.get('api_path') + '/message_send' data: JSON.stringify({ client_id: @client_id, data: data }) processData: false queue: true @@ -349,7 +349,7 @@ class _webSocketSingleton extends App.Controller App.Com.ajax( id: 'message_receive', type: 'POST' - url: 'api/message_receive' + url: @Config.get('api_path') + '/message_receive' data: JSON.stringify({ client_id: @client_id }) processData: false success: (data) => diff --git a/app/assets/javascripts/app/models/_application_model.js.coffee b/app/assets/javascripts/app/models/_application_model.js.coffee index 5b2d8fccd..809815ee7 100644 --- a/app/assets/javascripts/app/models/_application_model.js.coffee +++ b/app/assets/javascripts/app/models/_application_model.js.coffee @@ -1,5 +1,6 @@ class App.Model extends Spine.Model @destroyBind: false + @api_path: App.Config.get('api_path') constructor: -> super diff --git a/app/assets/javascripts/app/models/channel.js.coffee b/app/assets/javascripts/app/models/channel.js.coffee index 73c8ed7fe..ab327d4d3 100644 --- a/app/assets/javascripts/app/models/channel.js.coffee +++ b/app/assets/javascripts/app/models/channel.js.coffee @@ -1,4 +1,4 @@ class App.Channel extends App.Model @configure 'Channel', 'adapter', 'area', 'options', 'group_id', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/channels' + @url: @api_path + '/channels' diff --git a/app/assets/javascripts/app/models/email_address.js.coffee b/app/assets/javascripts/app/models/email_address.js.coffee index b24233c6b..378d62449 100644 --- a/app/assets/javascripts/app/models/email_address.js.coffee +++ b/app/assets/javascripts/app/models/email_address.js.coffee @@ -1,7 +1,7 @@ class App.EmailAddress extends App.Model @configure 'EmailAddress', 'realname', 'email', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/email_addresses' + @url: @api_path + '/email_addresses' @configure_attributes = [ { name: 'realname', display: 'Realname', tag: 'input', type: 'text', limit: 250, 'null': false, 'class': 'span4' }, diff --git a/app/assets/javascripts/app/models/group.js.coffee b/app/assets/javascripts/app/models/group.js.coffee index 4d5d1b067..8780bdbe7 100644 --- a/app/assets/javascripts/app/models/group.js.coffee +++ b/app/assets/javascripts/app/models/group.js.coffee @@ -1,7 +1,7 @@ class App.Group extends App.Model @configure 'Group', 'name', 'assignment_timeout', 'follow_up_possible', 'follow_up_assignment', 'email_address_id', 'signature_id', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/groups' + @url: @api_path + '/groups' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, diff --git a/app/assets/javascripts/app/models/history.js.coffee b/app/assets/javascripts/app/models/history.js.coffee index b18b32ab3..d11ee8674 100644 --- a/app/assets/javascripts/app/models/history.js.coffee +++ b/app/assets/javascripts/app/models/history.js.coffee @@ -1,7 +1,7 @@ class App.History extends App.Model @configure 'History', 'name' @extend Spine.Model.Ajax - @url: '/histories' + @url: @api_path + '/histories' @_fillUp: (data) -> diff --git a/app/assets/javascripts/app/models/history_attributes.js.coffee b/app/assets/javascripts/app/models/history_attributes.js.coffee index 8d720b912..d263df015 100644 --- a/app/assets/javascripts/app/models/history_attributes.js.coffee +++ b/app/assets/javascripts/app/models/history_attributes.js.coffee @@ -1,4 +1,4 @@ class App.HistoryAttribute extends App.Model @configure 'HistoryAttribute', 'name' @extend Spine.Model.Ajax - @url: '/history_attributes' + @url: @api_path + '/history_attributes' diff --git a/app/assets/javascripts/app/models/history_object.js.coffee b/app/assets/javascripts/app/models/history_object.js.coffee index b2ebcf859..388c6b507 100644 --- a/app/assets/javascripts/app/models/history_object.js.coffee +++ b/app/assets/javascripts/app/models/history_object.js.coffee @@ -1,4 +1,4 @@ class App.HistoryObject extends App.Model @configure 'HistoryObject', 'name' @extend Spine.Model.Ajax - @url: '/history_objects' + @url: @api_path + '/history_objects' diff --git a/app/assets/javascripts/app/models/history_type.js.coffee b/app/assets/javascripts/app/models/history_type.js.coffee index d35389730..e4bdaf69c 100644 --- a/app/assets/javascripts/app/models/history_type.js.coffee +++ b/app/assets/javascripts/app/models/history_type.js.coffee @@ -1,4 +1,4 @@ class App.HistoryType extends App.Model @configure 'HistoryType', 'name' @extend Spine.Model.Ajax - @url: '/history_types' + @url: @api_path + '/history_types' diff --git a/app/assets/javascripts/app/models/organization.js.coffee b/app/assets/javascripts/app/models/organization.js.coffee index 1dd39f398..d7d32b365 100644 --- a/app/assets/javascripts/app/models/organization.js.coffee +++ b/app/assets/javascripts/app/models/organization.js.coffee @@ -1,7 +1,7 @@ class App.Organization extends App.Model @configure 'Organization', 'name', 'shared', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/organizations' + @url: @api_path + '/organizations' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, { name: 'shared', display: 'Shared organiztion', tag: 'boolean', note: 'Customers in the organiztion can view each other items.', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' }, diff --git a/app/assets/javascripts/app/models/overview.js.coffee b/app/assets/javascripts/app/models/overview.js.coffee index 1e48a171c..05a8d77a1 100644 --- a/app/assets/javascripts/app/models/overview.js.coffee +++ b/app/assets/javascripts/app/models/overview.js.coffee @@ -1,7 +1,7 @@ class App.Overview extends Spine.Model @configure 'Overview', 'name', 'link', 'prio', 'condition', 'order', 'group_by', 'view', 'user_id', 'organization_shared', 'role_id', 'order', 'group_by', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/overviews' + @url: @api_path + '/overviews' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, { name: 'link', display: 'URL', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, diff --git a/app/assets/javascripts/app/models/postmaster_filter.js.coffee b/app/assets/javascripts/app/models/postmaster_filter.js.coffee index 9749b9121..65e88d626 100644 --- a/app/assets/javascripts/app/models/postmaster_filter.js.coffee +++ b/app/assets/javascripts/app/models/postmaster_filter.js.coffee @@ -1,7 +1,7 @@ class App.PostmasterFilter extends App.Model @configure 'PostmasterFilter', 'name', 'channel', 'match', 'perform', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/postmaster_filters' + @url: @api_path + '/postmaster_filters' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 250, 'null': false, 'class': 'span4' }, diff --git a/app/assets/javascripts/app/models/role.js.coffee b/app/assets/javascripts/app/models/role.js.coffee index 7eee5d349..1250c9b92 100644 --- a/app/assets/javascripts/app/models/role.js.coffee +++ b/app/assets/javascripts/app/models/role.js.coffee @@ -1,7 +1,7 @@ class App.Role extends App.Model @configure 'Role', 'name', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/roles' + @url: @api_path + '/roles' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, 'class': 'span4' }, diff --git a/app/assets/javascripts/app/models/setting.js.coffee b/app/assets/javascripts/app/models/setting.js.coffee index ac35d5944..43c24a327 100644 --- a/app/assets/javascripts/app/models/setting.js.coffee +++ b/app/assets/javascripts/app/models/setting.js.coffee @@ -1,4 +1,4 @@ class App.Setting extends App.Model @configure 'Setting', 'name', 'state' @extend Spine.Model.Ajax - @url: 'api/settings' + @url: @api_path + '/settings' diff --git a/app/assets/javascripts/app/models/signature.js.coffee b/app/assets/javascripts/app/models/signature.js.coffee index 0422fe669..ef338759c 100644 --- a/app/assets/javascripts/app/models/signature.js.coffee +++ b/app/assets/javascripts/app/models/signature.js.coffee @@ -1,7 +1,7 @@ class App.Signature extends App.Model @configure 'Signature', 'name', 'body', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/signatures' + @url: @api_path + '/signatures' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, diff --git a/app/assets/javascripts/app/models/sla.js.coffee b/app/assets/javascripts/app/models/sla.js.coffee index ebd331d5c..0d4955ab5 100644 --- a/app/assets/javascripts/app/models/sla.js.coffee +++ b/app/assets/javascripts/app/models/sla.js.coffee @@ -1,7 +1,7 @@ class App.Sla extends App.Model @configure 'Sla', 'name', 'first_response_time', 'update_time', 'close_time', 'condition', 'timezone', 'data', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/slas' + @url: @api_path + '/slas' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'span4' }, { name: 'first_response_time', display: 'First Response Time', tag: 'input', type: 'text', limit: 100, null: true, 'class': 'span4', note: 'In minutes, only business times are counted.' }, diff --git a/app/assets/javascripts/app/models/taskbar.js.coffee b/app/assets/javascripts/app/models/taskbar.js.coffee index 2753bba11..7010f38f4 100644 --- a/app/assets/javascripts/app/models/taskbar.js.coffee +++ b/app/assets/javascripts/app/models/taskbar.js.coffee @@ -2,4 +2,4 @@ class App.Taskbar extends App.Model @configure 'Taskbar', 'key', 'client_id', 'callback', 'state', 'params', 'prio', 'notify', 'active', 'updated_at' # @extend Spine.Model.Local @extend Spine.Model.Ajax - @url: 'api/taskbar' + @url: @api_path + '/taskbar' diff --git a/app/assets/javascripts/app/models/template.js.coffee b/app/assets/javascripts/app/models/template.js.coffee index 10afe2d2c..e051d3755 100644 --- a/app/assets/javascripts/app/models/template.js.coffee +++ b/app/assets/javascripts/app/models/template.js.coffee @@ -1,4 +1,4 @@ class App.Template extends App.Model @configure 'Template', 'name', 'options', 'group_ids', 'user_id', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/templates' + @url: @api_path + '/templates' diff --git a/app/assets/javascripts/app/models/text_module.js.coffee b/app/assets/javascripts/app/models/text_module.js.coffee index 46a7ee38c..b31c3d4a6 100644 --- a/app/assets/javascripts/app/models/text_module.js.coffee +++ b/app/assets/javascripts/app/models/text_module.js.coffee @@ -1,7 +1,7 @@ class App.TextModule extends App.Model @configure 'TextModule', 'name', 'keywords', 'content', 'active', 'group_ids', 'user_id', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/text_modules' + @url: @api_path + '/text_modules' @configure_attributes = [ { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, { name: 'keywords', display: 'Keywords', tag: 'input', type: 'text', limit: 100, 'null': true, 'class': 'span4' }, diff --git a/app/assets/javascripts/app/models/ticket.js.coffee b/app/assets/javascripts/app/models/ticket.js.coffee index 6c296cde0..33a6d068d 100644 --- a/app/assets/javascripts/app/models/ticket.js.coffee +++ b/app/assets/javascripts/app/models/ticket.js.coffee @@ -1,7 +1,7 @@ class App.Ticket extends App.Model @configure 'Ticket', 'number', 'title', 'group_id', 'owner_id', 'customer_id', 'ticket_state_id', 'ticket_priority_id', 'article', 'tags', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/tickets' + @url: @api_path + '/tickets' @configure_attributes = [ { name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, read_only: true, style: 'width: 8%' }, { name: 'customer_id', display: 'Customer', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '»' }, diff --git a/app/assets/javascripts/app/models/ticket_article.js.coffee b/app/assets/javascripts/app/models/ticket_article.js.coffee index fa3e58df0..b3364e42a 100644 --- a/app/assets/javascripts/app/models/ticket_article.js.coffee +++ b/app/assets/javascripts/app/models/ticket_article.js.coffee @@ -1,7 +1,7 @@ class App.TicketArticle extends App.Model @configure 'TicketArticle', 'from', 'to', 'cc', 'subject', 'body', 'ticket_id', 'ticket_article_type_id', 'ticket_article_sender_id', 'internal', 'in_reply_to', 'form_id', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/ticket_articles' + @url: @api_path + '/ticket_articles' @configure_attributes = [ { name: 'ticket_id', display: 'TicketID', null: false, readonly: 1, }, { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', }, diff --git a/app/assets/javascripts/app/models/ticket_article_sender.js.coffee b/app/assets/javascripts/app/models/ticket_article_sender.js.coffee index fe8f0741d..d3a9d5fd8 100644 --- a/app/assets/javascripts/app/models/ticket_article_sender.js.coffee +++ b/app/assets/javascripts/app/models/ticket_article_sender.js.coffee @@ -1,4 +1,4 @@ class App.TicketArticleSender extends App.Model @configure 'TicketArticleSender', 'name', 'updated_at' @extend Spine.Model.Ajax - @url: '/ticket_article_senders' + @url: @api_path + '/ticket_article_senders' diff --git a/app/assets/javascripts/app/models/ticket_article_type.js.coffee b/app/assets/javascripts/app/models/ticket_article_type.js.coffee index e0cfc4189..777db0940 100644 --- a/app/assets/javascripts/app/models/ticket_article_type.js.coffee +++ b/app/assets/javascripts/app/models/ticket_article_type.js.coffee @@ -1,4 +1,4 @@ class App.TicketArticleType extends App.Model @configure 'TicketArticleType', 'name', 'updated_at' @extend Spine.Model.Ajax - @url: '/ticket_article_types' + @url: @api_path + '/ticket_article_types' diff --git a/app/assets/javascripts/app/models/ticket_priority.js.coffee b/app/assets/javascripts/app/models/ticket_priority.js.coffee index 4a0264c31..66ada53ff 100644 --- a/app/assets/javascripts/app/models/ticket_priority.js.coffee +++ b/app/assets/javascripts/app/models/ticket_priority.js.coffee @@ -1,4 +1,4 @@ class App.TicketPriority extends App.Model @configure 'TicketPriority', 'name', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/ticket_priorities' + @url: @api_path + '/ticket_priorities' diff --git a/app/assets/javascripts/app/models/ticket_state.js.coffee b/app/assets/javascripts/app/models/ticket_state.js.coffee index 41e1ee2ca..6b9d5d22a 100644 --- a/app/assets/javascripts/app/models/ticket_state.js.coffee +++ b/app/assets/javascripts/app/models/ticket_state.js.coffee @@ -1,4 +1,4 @@ class App.TicketState extends App.Model @configure 'TicketState', 'name', 'note', 'active' @extend Spine.Model.Ajax - @url: 'api/ticket_states' + @url: @api_path + '/ticket_states' diff --git a/app/assets/javascripts/app/models/ticket_state_type.js.coffee b/app/assets/javascripts/app/models/ticket_state_type.js.coffee index 71310261b..8f97da215 100644 --- a/app/assets/javascripts/app/models/ticket_state_type.js.coffee +++ b/app/assets/javascripts/app/models/ticket_state_type.js.coffee @@ -1,4 +1,4 @@ class App.TicketStateType extends App.Model @configure 'TicketStateType', 'name', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax - @url: '/ticket_state_types' + @url: @api_path + '/ticket_state_types' diff --git a/app/assets/javascripts/app/models/translation.js.coffee b/app/assets/javascripts/app/models/translation.js.coffee index 293513495..a5876ba5e 100644 --- a/app/assets/javascripts/app/models/translation.js.coffee +++ b/app/assets/javascripts/app/models/translation.js.coffee @@ -1,3 +1,4 @@ class App.Translation extends App.Model @configure 'Translation', 'source', 'target', 'locale' - @extend Spine.Model.Ajax \ No newline at end of file + @extend Spine.Model.Ajax + @url: @api_path + '/translations' \ No newline at end of file diff --git a/app/assets/javascripts/app/models/user.js.coffee b/app/assets/javascripts/app/models/user.js.coffee index 0f7461ea4..21d7c00f9 100644 --- a/app/assets/javascripts/app/models/user.js.coffee +++ b/app/assets/javascripts/app/models/user.js.coffee @@ -1,7 +1,7 @@ class App.User extends App.Model @configure 'User', 'login', 'firstname', 'lastname', 'email', 'web', 'password', 'phone', 'fax', 'mobile', 'street', 'zip', 'city', 'country', 'organization_id', 'department', 'note', 'role_ids', 'group_ids', 'active', 'invite', 'updated_at' @extend Spine.Model.Ajax - @url: 'api/users' + @url: @api_path + '/users' # @hasMany 'roles', 'App.Role' @configure_attributes = [ diff --git a/app/controllers/activity_controller.rb b/app/controllers/activity_controller.rb index fb74badc1..d85f73aed 100644 --- a/app/controllers/activity_controller.rb +++ b/app/controllers/activity_controller.rb @@ -3,7 +3,7 @@ class ActivityController < ApplicationController before_filter :authentication_check - # GET /api/activity_stream + # GET /api/v1/activity_stream def activity_stream activity_stream = History.activity_stream_fulldata( current_user, params[:limit] ) diff --git a/app/controllers/channels_controller.rb b/app/controllers/channels_controller.rb index 7b59fb0bf..6e63879fd 100644 --- a/app/controllers/channels_controller.rb +++ b/app/controllers/channels_controller.rb @@ -70,7 +70,7 @@ Example: =begin Resource: -GET /api/channels.json +GET /api/v1/channels.json Response: [ @@ -89,7 +89,7 @@ Response: ] Test: -curl http://localhost/api/channels.json -v -u #{login}:#{password} +curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} =end @@ -101,7 +101,7 @@ curl http://localhost/api/channels.json -v -u #{login}:#{password} =begin Resource: -GET /api/channels/#{id}.json +GET /api/v1/channels/#{id}.json Response: { @@ -112,7 +112,7 @@ Response: } Test: -curl http://localhost/api/channels/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/channels/#{id}.json -v -u #{login}:#{password} =end @@ -124,7 +124,7 @@ curl http://localhost/api/channels/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/channels.json +POST /api/v1/channels.json Payload: { @@ -148,7 +148,7 @@ Response: } Test: -curl http://localhost/api/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -160,7 +160,7 @@ curl http://localhost/api/channels.json -v -u #{login}:#{password} -H "Content-T =begin Resource: -PUT /api/channels/{id}.json +PUT /api/v1/channels/{id}.json Payload: { @@ -185,7 +185,7 @@ Response: } Test: -curl http://localhost/api/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -197,13 +197,13 @@ curl http://localhost/api/channels.json -v -u #{login}:#{password} -H "Content-T =begin Resource: -DELETE /api/channels/{id}.json +DELETE /api/v1/channels/{id}.json Response: {} Test: -curl http://localhost/api/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE +curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE =end diff --git a/app/controllers/email_addresses_controller.rb b/app/controllers/email_addresses_controller.rb index 52a395c92..1074c3219 100644 --- a/app/controllers/email_addresses_controller.rb +++ b/app/controllers/email_addresses_controller.rb @@ -24,7 +24,7 @@ Example: =begin Resource: -GET /api/email_addresses.json +GET /api/v1/email_addresses.json Response: [ @@ -41,7 +41,7 @@ Response: ] Test: -curl http://localhost/api/email_addresses.json -v -u #{login}:#{password} +curl http://localhost/api/v1/email_addresses.json -v -u #{login}:#{password} =end @@ -52,7 +52,7 @@ curl http://localhost/api/email_addresses.json -v -u #{login}:#{password} =begin Resource: -GET /api/email_addresses/#{id}.json +GET /api/v1/email_addresses/#{id}.json Response: { @@ -62,7 +62,7 @@ Response: } Test: -curl http://localhost/api/email_addresses/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/email_addresses/#{id}.json -v -u #{login}:#{password} =end @@ -73,7 +73,7 @@ curl http://localhost/api/email_addresses/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/email_addresses.json +POST /api/v1/email_addresses.json Payload: { @@ -92,7 +92,7 @@ Response: } Test: -curl http://localhost/api/email_addresses.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/email_addresses.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -104,7 +104,7 @@ curl http://localhost/api/email_addresses.json -v -u #{login}:#{password} -H "Co =begin Resource: -PUT /api/email_addresses/{id}.json +PUT /api/v1/email_addresses/{id}.json Payload: { @@ -123,7 +123,7 @@ Response: } Test: -curl http://localhost/api/email_addresses.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/email_addresses.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index e0ece73b3..f34678a07 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -5,7 +5,7 @@ class GettingStartedController < ApplicationController =begin Resource: -GET /api/getting_started.json +GET /api/v1/getting_started.json Response: { @@ -23,7 +23,7 @@ Response: } Test: -curl http://localhost/api/getting_started.json -v -u #{login}:#{password} +curl http://localhost/api/v1/getting_started.json -v -u #{login}:#{password} =end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 32cf1686c..168d05e51 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -27,7 +27,7 @@ Example: =begin Resource: -GET /api/groups.json +GET /api/v1/groups.json Response: [ @@ -44,7 +44,7 @@ Response: ] Test: -curl http://localhost/api/groups.json -v -u #{login}:#{password} +curl http://localhost/api/v1/groups.json -v -u #{login}:#{password} =end @@ -55,7 +55,7 @@ curl http://localhost/api/groups.json -v -u #{login}:#{password} =begin Resource: -GET /api/groups/#{id}.json +GET /api/v1/groups/#{id}.json Response: { @@ -65,7 +65,7 @@ Response: } Test: -curl http://localhost/api/groups/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/groups/#{id}.json -v -u #{login}:#{password} =end @@ -76,7 +76,7 @@ curl http://localhost/api/groups/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/groups.json +POST /api/v1/groups.json Payload: { @@ -96,7 +96,7 @@ Response: } Test: -curl http://localhost/api/groups.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/groups.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -108,7 +108,7 @@ curl http://localhost/api/groups.json -v -u #{login}:#{password} -H "Content-Typ =begin Resource: -PUT /api/groups/{id}.json +PUT /api/v1/groups/{id}.json Payload: { @@ -128,7 +128,7 @@ Response: } Test: -curl http://localhost/api/groups.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/groups.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end diff --git a/app/controllers/links_controller.rb b/app/controllers/links_controller.rb index e9e53900d..001c0d7f2 100644 --- a/app/controllers/links_controller.rb +++ b/app/controllers/links_controller.rb @@ -3,7 +3,7 @@ class LinksController < ApplicationController before_filter :authentication_check - # GET /api/links + # GET /api/v1/links def index links = Link.list( :link_object => params[:link_object], @@ -39,7 +39,7 @@ class LinksController < ApplicationController } end - # POST /api/links/add + # POST /api/v1/links/add def add # lookup object id @@ -59,7 +59,7 @@ class LinksController < ApplicationController end end - # DELETE /api/links/remove + # DELETE /api/v1/links/remove def remove link = Link.remove(params) diff --git a/app/controllers/long_polling_controller.rb b/app/controllers/long_polling_controller.rb index e19efa191..5903af634 100644 --- a/app/controllers/long_polling_controller.rb +++ b/app/controllers/long_polling_controller.rb @@ -2,7 +2,7 @@ class LongPollingController < ApplicationController - # GET /api/message_send + # GET /api/v1/message_send def message_send new_connection = false @@ -104,7 +104,7 @@ class LongPollingController < ApplicationController end end - # GET /api/message_receive + # GET /api/v1/message_receive def message_receive # check client id diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 38b2faf40..b913e8312 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -25,7 +25,7 @@ Example: =begin Resource: -GET /api/organizations.json +GET /api/v1/organizations.json Response: [ @@ -42,7 +42,7 @@ Response: ] Test: -curl http://localhost/api/organizations.json -v -u #{login}:#{password} +curl http://localhost/api/v1/organizations.json -v -u #{login}:#{password} =end @@ -63,7 +63,7 @@ curl http://localhost/api/organizations.json -v -u #{login}:#{password} =begin Resource: -GET /api/organizations/#{id}.json +GET /api/v1/organizations/#{id}.json Response: { @@ -73,7 +73,7 @@ Response: } Test: -curl http://localhost/api/organizations/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/organizations/#{id}.json -v -u #{login}:#{password} =end @@ -96,7 +96,7 @@ curl http://localhost/api/organizations/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/organizations.json +POST /api/v1/organizations.json Payload: { @@ -114,7 +114,7 @@ Response: } Test: -curl http://localhost/api/organizations.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true,"shared": true,"note": "some note"}' +curl http://localhost/api/v1/organizations.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true,"shared": true,"note": "some note"}' =end @@ -126,7 +126,7 @@ curl http://localhost/api/organizations.json -v -u #{login}:#{password} -H "Cont =begin Resource: -PUT /api/organizations/{id}.json +PUT /api/v1/organizations/{id}.json Payload: { @@ -145,7 +145,7 @@ Response: } Test: -curl http://localhost/api/organizations.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"id": 1,"name": "some_name","active": true,"shared": true,"note": "some note"}' +curl http://localhost/api/v1/organizations.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"id": 1,"name": "some_name","active": true,"shared": true,"note": "some note"}' =end diff --git a/app/controllers/overviews_controller.rb b/app/controllers/overviews_controller.rb index 300a09b47..48650c5eb 100644 --- a/app/controllers/overviews_controller.rb +++ b/app/controllers/overviews_controller.rb @@ -30,7 +30,7 @@ Example: =begin Resource: -GET /api/overviews.json +GET /api/v1/overviews.json Response: [ @@ -47,7 +47,7 @@ Response: ] Test: -curl http://localhost/api/overviews.json -v -u #{login}:#{password} +curl http://localhost/api/v1/overviews.json -v -u #{login}:#{password} =end @@ -59,7 +59,7 @@ curl http://localhost/api/overviews.json -v -u #{login}:#{password} =begin Resource: -GET /api/overviews/#{id}.json +GET /api/v1/overviews/#{id}.json Response: { @@ -69,7 +69,7 @@ Response: } Test: -curl http://localhost/api/overviews/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/overviews/#{id}.json -v -u #{login}:#{password} =end @@ -81,7 +81,7 @@ curl http://localhost/api/overviews/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/overviews.json +POST /api/v1/overviews.json Payload: { @@ -103,7 +103,7 @@ Response: } Test: -curl http://localhost/api/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -115,7 +115,7 @@ curl http://localhost/api/overviews.json -v -u #{login}:#{password} -H "Content- =begin Resource: -PUT /api/overviews/{id}.json +PUT /api/v1/overviews/{id}.json Payload: { @@ -137,7 +137,7 @@ Response: } Test: -curl http://localhost/api/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -149,13 +149,13 @@ curl http://localhost/api/overviews.json -v -u #{login}:#{password} -H "Content- =begin Resource: -DELETE /api/overviews/{id}.json +DELETE /api/v1/overviews/{id}.json Response: {} Test: -curl http://localhost/api/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE +curl http://localhost/api/v1/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE =end diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb index 5abf5066a..8f4ed87d1 100644 --- a/app/controllers/packages_controller.rb +++ b/app/controllers/packages_controller.rb @@ -3,7 +3,7 @@ class PackagesController < ApplicationController before_filter :authentication_check - # GET /api/packages + # GET /api/v1/packages def index return if deny_if_not_role('Admin') packages = Package.all( :order => 'name' ) @@ -12,7 +12,7 @@ class PackagesController < ApplicationController } end - # POST /api/packages + # POST /api/v1/packages def install return if deny_if_not_role('Admin') @@ -21,7 +21,7 @@ class PackagesController < ApplicationController redirect_to '/#package' end - # DELETE /api/packages + # DELETE /api/v1/packages def uninstall return if deny_if_not_role('Admin') diff --git a/app/controllers/postmaster_filters_controller.rb b/app/controllers/postmaster_filters_controller.rb index 23b1d164b..dcb23c057 100644 --- a/app/controllers/postmaster_filters_controller.rb +++ b/app/controllers/postmaster_filters_controller.rb @@ -32,7 +32,7 @@ Example: =begin Resource: -GET /api/postmaster_filters.json +GET /api/v1/postmaster_filters.json Response: [ @@ -49,7 +49,7 @@ Response: ] Test: -curl http://localhost/api/postmaster_filters.json -v -u #{login}:#{password} +curl http://localhost/api/v1/postmaster_filters.json -v -u #{login}:#{password} =end @@ -61,7 +61,7 @@ curl http://localhost/api/postmaster_filters.json -v -u #{login}:#{password} =begin Resource: -GET /api/postmaster_filters/#{id}.json +GET /api/v1/postmaster_filters/#{id}.json Response: { @@ -71,7 +71,7 @@ Response: } Test: -curl http://localhost/api/postmaster_filters/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/postmaster_filters/#{id}.json -v -u #{login}:#{password} =end @@ -83,7 +83,7 @@ curl http://localhost/api/postmaster_filters/#{id}.json -v -u #{login}:#{passwor =begin Resource: -POST /api/postmaster_filters.json +POST /api/v1/postmaster_filters.json Payload: { @@ -116,7 +116,7 @@ Response: } Test: -curl http://localhost/api/postmaster_filters.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/postmaster_filters.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -128,7 +128,7 @@ curl http://localhost/api/postmaster_filters.json -v -u #{login}:#{password} -H =begin Resource: -PUT /api/postmaster_filters/{id}.json +PUT /api/v1/postmaster_filters/{id}.json Payload: { @@ -159,7 +159,7 @@ Response: } Test: -curl http://localhost/api/postmaster_filters.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/postmaster_filters.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end diff --git a/app/controllers/recent_viewed_controller.rb b/app/controllers/recent_viewed_controller.rb index 97c443ac1..5112e0f18 100644 --- a/app/controllers/recent_viewed_controller.rb +++ b/app/controllers/recent_viewed_controller.rb @@ -6,7 +6,7 @@ class RecentViewedController < ApplicationController =begin Resource: -GET /api/recent_viewed +GET /api/v1/recent_viewed Response: { @@ -14,7 +14,7 @@ Response: } Test: -curl http://localhost/api/recent_viewed.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X GET +curl http://localhost/api/v1/recent_viewed.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X GET =end diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index a6724beff..a13b024ff 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -24,7 +24,7 @@ Example: =begin Resource: -GET /api/roles.json +GET /api/v1/roles.json Response: [ @@ -41,7 +41,7 @@ Response: ] Test: -curl http://localhost/api/roles.json -v -u #{login}:#{password} +curl http://localhost/api/v1/roles.json -v -u #{login}:#{password} =end @@ -52,7 +52,7 @@ curl http://localhost/api/roles.json -v -u #{login}:#{password} =begin Resource: -GET /api/roles/#{id}.json +GET /api/v1/roles/#{id}.json Response: { @@ -62,7 +62,7 @@ Response: } Test: -curl http://localhost/api/roles/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/roles/#{id}.json -v -u #{login}:#{password} =end @@ -73,7 +73,7 @@ curl http://localhost/api/roles/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/roles.json +POST /api/v1/roles.json Payload: { @@ -90,7 +90,7 @@ Response: } Test: -curl http://localhost/api/roles.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/roles.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -102,7 +102,7 @@ curl http://localhost/api/roles.json -v -u #{login}:#{password} -H "Content-Type =begin Resource: -PUT /api/roles/{id}.json +PUT /api/v1/roles/{id}.json Payload: { @@ -119,7 +119,7 @@ Response: } Test: -curl http://localhost/api/roles.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/roles.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end diff --git a/app/controllers/rss_controller.rb b/app/controllers/rss_controller.rb index c64f06138..c249e61ba 100644 --- a/app/controllers/rss_controller.rb +++ b/app/controllers/rss_controller.rb @@ -6,7 +6,7 @@ class RssController < ApplicationController =begin Resource: -GET /api/rss_fetch +GET /api/v1/rss_fetch Response: { @@ -14,7 +14,7 @@ Response: } Test: -curl http://localhost/api/rss_fetch.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X GET +curl http://localhost/api/v1/rss_fetch.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X GET =end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 92daaddd5..31ca3133b 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -3,7 +3,7 @@ class SearchController < ApplicationController before_filter :authentication_check - # GET /api/search + # GET /api/v1/search def search # build result list diff --git a/app/controllers/signatures_controller.rb b/app/controllers/signatures_controller.rb index f7a238449..9e77ffc02 100644 --- a/app/controllers/signatures_controller.rb +++ b/app/controllers/signatures_controller.rb @@ -25,7 +25,7 @@ Example: =begin Resource: -GET /api/signatures.json +GET /api/v1/signatures.json Response: [ @@ -42,7 +42,7 @@ Response: ] Test: -curl http://localhost/api/signatures.json -v -u #{login}:#{password} +curl http://localhost/api/v1/signatures.json -v -u #{login}:#{password} =end @@ -53,7 +53,7 @@ curl http://localhost/api/signatures.json -v -u #{login}:#{password} =begin Resource: -GET /api/signatures/#{id}.json +GET /api/v1/signatures/#{id}.json Response: { @@ -63,7 +63,7 @@ Response: } Test: -curl http://localhost/api/signatures/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/signatures/#{id}.json -v -u #{login}:#{password} =end @@ -74,7 +74,7 @@ curl http://localhost/api/signatures/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/signatures.json +POST /api/v1/signatures.json Payload: { @@ -91,7 +91,7 @@ Response: } Test: -curl http://localhost/api/signatures.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/signatures.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -103,7 +103,7 @@ curl http://localhost/api/signatures.json -v -u #{login}:#{password} -H "Content =begin Resource: -PUT /api/signatures/{id}.json +PUT /api/v1/signatures/{id}.json Payload: { @@ -120,7 +120,7 @@ Response: } Test: -curl http://localhost/api/signatures.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/signatures.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end diff --git a/app/controllers/slas_controller.rb b/app/controllers/slas_controller.rb index 790ca83f9..21fa2803d 100644 --- a/app/controllers/slas_controller.rb +++ b/app/controllers/slas_controller.rb @@ -25,7 +25,7 @@ Example: =begin Resource: -GET /api/slas.json +GET /api/v1/slas.json Response: [ @@ -42,7 +42,7 @@ Response: ] Test: -curl http://localhost/api/slas.json -v -u #{login}:#{password} +curl http://localhost/api/v1/slas.json -v -u #{login}:#{password} =end @@ -54,7 +54,7 @@ curl http://localhost/api/slas.json -v -u #{login}:#{password} =begin Resource: -GET /api/slas/#{id}.json +GET /api/v1/slas/#{id}.json Response: { @@ -64,7 +64,7 @@ Response: } Test: -curl http://localhost/api/slas/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/slas/#{id}.json -v -u #{login}:#{password} =end @@ -76,7 +76,7 @@ curl http://localhost/api/slas/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/slas.json +POST /api/v1/slas.json Payload: { @@ -93,7 +93,7 @@ Response: } Test: -curl http://localhost/api/slas.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/slas.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -105,7 +105,7 @@ curl http://localhost/api/slas.json -v -u #{login}:#{password} -H "Content-Type: =begin Resource: -PUT /api/slas/{id}.json +PUT /api/v1/slas/{id}.json Payload: { @@ -122,7 +122,7 @@ Response: } Test: -curl http://localhost/api/slas.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/slas.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -134,13 +134,13 @@ curl http://localhost/api/slas.json -v -u #{login}:#{password} -H "Content-Type: =begin Resource: -DELETE /api/slas/{id}.json +DELETE /api/v1/slas/{id}.json Response: {} Test: -curl http://localhost/api/slas.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE +curl http://localhost/api/v1/slas.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE =end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 487b62777..1bce89d5c 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -3,7 +3,7 @@ class TagsController < ApplicationController before_filter :authentication_check - # GET /api/tags + # GET /api/v1/tags def index list = Tag.list() @@ -13,7 +13,7 @@ class TagsController < ApplicationController } end - # GET /api/tags + # GET /api/v1/tags def list list = Tag.tag_list( :object => params[:object], @@ -26,7 +26,7 @@ class TagsController < ApplicationController } end - # POST /api/tag/add + # POST /api/v1/tag/add def add success = Tag.tag_add( :object => params[:object], @@ -40,7 +40,7 @@ class TagsController < ApplicationController end end - # DELETE /api/tag/remove + # DELETE /api/v1/tag/remove def remove success = Tag.tag_remove( :object => params[:object], diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index f4006309f..779adbab5 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -25,7 +25,7 @@ Example: =begin Resource: -GET /api/templates.json +GET /api/v1/templates.json Response: [ @@ -42,7 +42,7 @@ Response: ] Test: -curl http://localhost/api/templates.json -v -u #{login}:#{password} +curl http://localhost/api/v1/templates.json -v -u #{login}:#{password} =end @@ -54,7 +54,7 @@ curl http://localhost/api/templates.json -v -u #{login}:#{password} =begin Resource: -GET /api/templates/#{id}.json +GET /api/v1/templates/#{id}.json Response: { @@ -64,7 +64,7 @@ Response: } Test: -curl http://localhost/api/templates/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/templates/#{id}.json -v -u #{login}:#{password} =end @@ -76,7 +76,7 @@ curl http://localhost/api/templates/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/templates.json +POST /api/v1/templates.json Payload: { @@ -92,7 +92,7 @@ Response: } Test: -curl http://localhost/api/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -104,7 +104,7 @@ curl http://localhost/api/templates.json -v -u #{login}:#{password} -H "Content- =begin Resource: -PUT /api/templates/{id}.json +PUT /api/v1/templates/{id}.json Payload: { @@ -120,7 +120,7 @@ Response: } Test: -curl http://localhost/api/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -132,13 +132,13 @@ curl http://localhost/api/templates.json -v -u #{login}:#{password} -H "Content- =begin Resource: -DELETE /api/templates/{id}.json +DELETE /api/v1/templates/{id}.json Response: {} Test: -curl http://localhost/api/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE +curl http://localhost/api/v1/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE =end diff --git a/app/controllers/text_modules_controller.rb b/app/controllers/text_modules_controller.rb index 3c717e66f..26c43c599 100644 --- a/app/controllers/text_modules_controller.rb +++ b/app/controllers/text_modules_controller.rb @@ -27,7 +27,7 @@ Example: =begin Resource: -GET /api/text_modules.json +GET /api/v1/text_modules.json Response: [ @@ -44,7 +44,7 @@ Response: ] Test: -curl http://localhost/api/text_modules.json -v -u #{login}:#{password} +curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} =end @@ -55,7 +55,7 @@ curl http://localhost/api/text_modules.json -v -u #{login}:#{password} =begin Resource: -GET /api/text_modules/#{id}.json +GET /api/v1/text_modules/#{id}.json Response: { @@ -65,7 +65,7 @@ Response: } Test: -curl http://localhost/api/text_modules/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/text_modules/#{id}.json -v -u #{login}:#{password} =end @@ -76,7 +76,7 @@ curl http://localhost/api/text_modules/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/text_modules.json +POST /api/v1/text_modules.json Payload: { @@ -94,7 +94,7 @@ Response: } Test: -curl http://localhost/api/text_modules.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -105,7 +105,7 @@ curl http://localhost/api/text_modules.json -v -u #{login}:#{password} -H "Conte =begin Resource: -PUT /api/text_modules/{id}.json +PUT /api/v1/text_modules/{id}.json Payload: { @@ -123,7 +123,7 @@ Response: } Test: -curl http://localhost/api/text_modules.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' +curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}' =end @@ -134,13 +134,13 @@ curl http://localhost/api/text_modules.json -v -u #{login}:#{password} -H "Conte =begin Resource: -DELETE /api/text_modules/{id}.json +DELETE /api/v1/text_modules/{id}.json Response: {} Test: -curl http://localhost/api/text_modules.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE +curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE =end diff --git a/app/controllers/ticket_overviews_controller.rb b/app/controllers/ticket_overviews_controller.rb index 28628364b..ac3cdeb09 100644 --- a/app/controllers/ticket_overviews_controller.rb +++ b/app/controllers/ticket_overviews_controller.rb @@ -3,7 +3,7 @@ class TicketOverviewsController < ApplicationController before_filter :authentication_check - # GET /api/tickets + # GET /api/v1/tickets def show # get navbar overview data diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 3c29ae9a1..a9bf0893b 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -3,14 +3,14 @@ class TicketsController < ApplicationController before_filter :authentication_check - # GET /api/tickets + # GET /api/v1/tickets def index @tickets = Ticket.all render :json => @tickets end - # GET /api/tickets/1 + # GET /api/v1/tickets/1 def show @ticket = Ticket.find( params[:id] ) @@ -20,7 +20,7 @@ class TicketsController < ApplicationController render :json => @ticket end - # POST /api/tickets + # POST /api/v1/tickets def create @ticket = Ticket.new( Ticket.param_validation( params[:ticket] ) ) @@ -80,7 +80,7 @@ class TicketsController < ApplicationController render :json => @ticket, :status => :created end - # PUT /api/tickets/1 + # PUT /api/v1/tickets/1 def update @ticket = Ticket.find(params[:id]) @@ -94,7 +94,7 @@ class TicketsController < ApplicationController end end - # DELETE /api/tickets/1 + # DELETE /api/v1/tickets/1 def destroy @ticket = Ticket.find( params[:id] ) @@ -106,8 +106,8 @@ class TicketsController < ApplicationController head :ok end - # GET /api/ticket_customer - # GET /api/tickets_customer + # GET /api/v1/ticket_customer + # GET /api/v1/tickets_customer def ticket_customer # return result @@ -120,7 +120,7 @@ class TicketsController < ApplicationController } end - # GET /api/ticket_history/1 + # GET /api/v1/ticket_history/1 def ticket_history # get ticket data @@ -190,7 +190,7 @@ class TicketsController < ApplicationController } end - # GET /api/ticket_merge_list/1 + # GET /api/v1/ticket_merge_list/1 def ticket_merge_list ticket = Ticket.find( params[:ticket_id] ) @@ -231,7 +231,7 @@ class TicketsController < ApplicationController } end - # GET /ticket_merge/1/1 + # GET /api/v1/ticket_merge/1/1 def ticket_merge # check master ticket @@ -285,7 +285,7 @@ class TicketsController < ApplicationController } end - # GET /ticket_full/1 + # GET /api/v1/ticket_full/1 def ticket_full # permission check @@ -380,7 +380,7 @@ class TicketsController < ApplicationController } end - # GET /ticket_create/1 + # GET /api/v1/ticket_create/1 def ticket_create # get attributes to update @@ -453,7 +453,7 @@ class TicketsController < ApplicationController } end - # GET /api/tickets/search + # GET /api/v1/tickets/search def search # build result list diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index bfd49a9c0..226d51fe3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -39,7 +39,7 @@ Example: =begin Resource: -GET /api/users.json +GET /api/v1/users.json Response: [ @@ -56,7 +56,7 @@ Response: ] Test: -curl http://localhost/api/users.json -v -u #{login}:#{password} +curl http://localhost/api/v1/users.json -v -u #{login}:#{password} =end @@ -78,7 +78,7 @@ curl http://localhost/api/users.json -v -u #{login}:#{password} =begin Resource: -GET /api/users/1.json +GET /api/v1/users/1.json Response: { @@ -88,7 +88,7 @@ Response: }, Test: -curl http://localhost/api/users/#{id}.json -v -u #{login}:#{password} +curl http://localhost/api/v1/users/#{id}.json -v -u #{login}:#{password} =end @@ -108,7 +108,7 @@ curl http://localhost/api/users/#{id}.json -v -u #{login}:#{password} =begin Resource: -POST /api/users.json +POST /api/v1/users.json Payload: { @@ -126,7 +126,7 @@ Response: }, Test: -curl http://localhost/api/users.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"login": "some_login","firstname": "some firstname","lastname": "some lastname","email": "some@example.com"}' +curl http://localhost/api/v1/users.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"login": "some_login","firstname": "some firstname","lastname": "some lastname","email": "some@example.com"}' =end @@ -255,7 +255,7 @@ curl http://localhost/api/users.json -v -u #{login}:#{password} -H "Content-Type =begin Resource: -PUT /api/users/#{id}.json +PUT /api/v1/users/#{id}.json Payload: { @@ -273,7 +273,7 @@ Response: }, Test: -curl http://localhost/api/users/2.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"login": "some_login","firstname": "some firstname","lastname": "some lastname","email": "some@example.com"}' +curl http://localhost/api/v1/users/2.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"login": "some_login","firstname": "some firstname","lastname": "some lastname","email": "some@example.com"}' =end @@ -316,13 +316,13 @@ curl http://localhost/api/users/2.json -v -u #{login}:#{password} -H "Content-Ty end end - # DELETE /api/users/1 + # DELETE /api/v1/users/1 def destroy return if deny_if_not_role('Admin') model_destory_render(User, params) end - # GET /api/users/search + # GET /api/v1/users/search def search if is_role('Customer') && !is_role('Admin') && !is_role('Agent') @@ -355,7 +355,7 @@ curl http://localhost/api/users/2.json -v -u #{login}:#{password} -H "Content-Ty =begin Resource: -POST /api/users/password_reset +POST /api/v1/users/password_reset Payload: { @@ -368,7 +368,7 @@ Response: } Test: -curl http://localhost/api/users/password_reset.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"username": "some_username"}' +curl http://localhost/api/v1/users/password_reset.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"username": "some_username"}' =end @@ -391,7 +391,7 @@ curl http://localhost/api/users/password_reset.json -v -u #{login}:#{password} - =begin Resource: -POST /api/users/password_reset_verify +POST /api/v1/users/password_reset_verify Payload: { @@ -405,7 +405,7 @@ Response: } Test: -curl http://localhost/api/users/password_reset_verify.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"token": "SoMeToKeN", "password" "new_password"}' +curl http://localhost/api/v1/users/password_reset_verify.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"token": "SoMeToKeN", "password" "new_password"}' =end @@ -425,7 +425,7 @@ curl http://localhost/api/users/password_reset_verify.json -v -u #{login}:#{pass =begin Resource: -POST /api/users/password_change +POST /api/v1/users/password_change Payload: { @@ -439,7 +439,7 @@ Response: } Test: -curl http://localhost/api/users/password_change.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"password_old": "password_old", "password_new": "password_new"}' +curl http://localhost/api/v1/users/password_change.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"password_old": "password_old", "password_new": "password_new"}' =end @@ -468,7 +468,7 @@ curl http://localhost/api/users/password_change.json -v -u #{login}:#{password} =begin Resource: -PUT /api/users/preferences.json +PUT /api/v1/users/preferences.json Payload: { @@ -482,7 +482,7 @@ Response: } Test: -curl http://localhost/api/users/preferences.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"language": "de", "notifications": true}' +curl http://localhost/api/v1/users/preferences.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"language": "de", "notifications": true}' =end @@ -503,7 +503,7 @@ curl http://localhost/api/users/preferences.json -v -u #{login}:#{password} -H " =begin Resource: -DELETE /api/users/account.json +DELETE /api/v1/users/account.json Payload: { @@ -517,7 +517,7 @@ Response: } Test: -curl http://localhost/api/users/account.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"provider": "twitter", "uid": 581482342942}' +curl http://localhost/api/v1/users/account.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"provider": "twitter", "uid": 581482342942}' =end diff --git a/config/application.rb b/config/application.rb index 5054a5295..4620f22aa 100644 --- a/config/application.rb +++ b/config/application.rb @@ -76,6 +76,9 @@ module Zammad # Use a different cache store in production config.cache_store = :file_store, 'tmp/cache/file_store' + # REST api path + config.api_path = '/api/v1' + # Enable threaded mode config.threadsafe! diff --git a/config/routes.rb b/config/routes.rb index c22f52dc3..251d53340 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,6 +13,6 @@ Zammad::Application.routes.draw do files = Dir.glob( "#{dir}/routes/*.rb" ) for file in files require file - ExtraRoutes.add(self) + ExtraRoutes.add(self, Rails.configuration.api_path) end end diff --git a/config/routes/activity_stream.rb b/config/routes/activity_stream.rb index 19a4c8125..fc2471628 100644 --- a/config/routes/activity_stream.rb +++ b/config/routes/activity_stream.rb @@ -1,7 +1,7 @@ module ExtraRoutes - def add(map) + def add(map, api_path) - map.match '/api/activity_stream', :to => 'activity#activity_stream', :via => :get + map.match api_path + '/activity_stream', :to => 'activity#activity_stream', :via => :get end module_function :add diff --git a/config/routes/auth.rb b/config/routes/auth.rb index 576a0378f..5cd782898 100644 --- a/config/routes/auth.rb +++ b/config/routes/auth.rb @@ -1,19 +1,19 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # omniauth - map.match '/auth/:provider/callback', :to => 'sessions#create_omniauth',:via => [:post, :get, :puts, :delete] + map.match '/auth/:provider/callback', :to => 'sessions#create_omniauth',:via => [:post, :get, :puts, :delete] # sso - map.match '/auth/sso', :to => 'sessions#create_sso', :via => [:post, :get] + map.match '/auth/sso', :to => 'sessions#create_sso', :via => [:post, :get] # sessions - map.match '/signin', :to => 'sessions#create', :via => :post - map.match '/signshow', :to => 'sessions#show', :via => :get - map.match '/signout', :to => 'sessions#destroy', :via => [:get, :delete] + map.match api_path + '/signin', :to => 'sessions#create', :via => :post + map.match api_path + '/signshow', :to => 'sessions#show', :via => :get + map.match api_path + '/signout', :to => 'sessions#destroy', :via => [:get, :delete] - map.match '/api/sessions', :to => 'sessions#list', :via => :get - map.match '/api/sessions/:id', :to => 'sessions#delete', :via => :delete + map.match api_path + '/sessions', :to => 'sessions#list', :via => :get + map.match api_path + '/sessions/:id', :to => 'sessions#delete', :via => :delete end module_function :add end diff --git a/config/routes/channel.rb b/config/routes/channel.rb index dad8d550f..be37a5949 100644 --- a/config/routes/channel.rb +++ b/config/routes/channel.rb @@ -1,12 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # channels - map.match '/api/channels', :to => 'channels#index', :via => :get - map.match '/api/channels/:id', :to => 'channels#show', :via => :get - map.match '/api/channels', :to => 'channels#create', :via => :post - map.match '/api/channels/:id', :to => 'channels#update', :via => :put - map.match '/api/channels/:id', :to => 'channels#destroy', :via => :delete + map.match api_path + '/channels', :to => 'channels#index', :via => :get + map.match api_path + '/channels/:id', :to => 'channels#show', :via => :get + map.match api_path + '/channels', :to => 'channels#create', :via => :post + map.match api_path + '/channels/:id', :to => 'channels#update', :via => :put + map.match api_path + '/channels/:id', :to => 'channels#destroy', :via => :delete end module_function :add diff --git a/config/routes/email_address.rb b/config/routes/email_address.rb index 92a804fb2..6b61c6a20 100644 --- a/config/routes/email_address.rb +++ b/config/routes/email_address.rb @@ -1,11 +1,11 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # groups - map.match '/api/email_addresses', :to => 'email_addresses#index', :via => :get - map.match '/api/email_addresses/:id', :to => 'email_addresses#show', :via => :get - map.match '/api/email_addresses', :to => 'email_addresses#create', :via => :post - map.match '/api/email_addresses/:id', :to => 'email_addresses#update', :via => :put + map.match api_path + '/email_addresses', :to => 'email_addresses#index', :via => :get + map.match api_path + '/email_addresses/:id', :to => 'email_addresses#show', :via => :get + map.match api_path + '/email_addresses', :to => 'email_addresses#create', :via => :post + map.match api_path + '/email_addresses/:id', :to => 'email_addresses#update', :via => :put end module_function :add diff --git a/config/routes/getting_started.rb b/config/routes/getting_started.rb index 91e14a5bd..c6444a37e 100644 --- a/config/routes/getting_started.rb +++ b/config/routes/getting_started.rb @@ -1,8 +1,8 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # getting_started - map.match '/api/getting_started', :to => 'getting_started#index', :via => :get + map.match api_path + '/getting_started', :to => 'getting_started#index', :via => :get end module_function :add diff --git a/config/routes/group.rb b/config/routes/group.rb index 06ea3cb70..0f5e50caa 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -1,11 +1,11 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # groups - map.match '/api/groups', :to => 'groups#index', :via => :get - map.match '/api/groups/:id', :to => 'groups#show', :via => :get - map.match '/api/groups', :to => 'groups#create', :via => :post - map.match '/api/groups/:id', :to => 'groups#update', :via => :put + map.match api_path + '/groups', :to => 'groups#index', :via => :get + map.match api_path + '/groups/:id', :to => 'groups#show', :via => :get + map.match api_path + '/groups', :to => 'groups#create', :via => :post + map.match api_path + '/groups/:id', :to => 'groups#update', :via => :put end module_function :add diff --git a/config/routes/link.rb b/config/routes/link.rb index 086f413c6..3a2c09526 100644 --- a/config/routes/link.rb +++ b/config/routes/link.rb @@ -1,10 +1,10 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # links - map.match '/api/links', :to => 'links#index', :via => :get - map.match '/api/links/add', :to => 'links#add', :via => :get - map.match '/api/links/remove', :to => 'links#remove', :via => :get + map.match api_path + '/links', :to => 'links#index', :via => :get + map.match api_path + '/links/add', :to => 'links#add', :via => :get + map.match api_path + '/links/remove', :to => 'links#remove', :via => :get end module_function :add diff --git a/config/routes/message.rb b/config/routes/message.rb index 81c2da930..10acb3d3f 100644 --- a/config/routes/message.rb +++ b/config/routes/message.rb @@ -1,9 +1,9 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # messages - map.match '/api/message_send', :to => 'long_polling#message_send', :via => [ :get, :post ] - map.match '/api/message_receive', :to => 'long_polling#message_receive', :via => [ :get, :post ] + map.match api_path + '/message_send', :to => 'long_polling#message_send', :via => [ :get, :post ] + map.match api_path + '/message_receive', :to => 'long_polling#message_receive', :via => [ :get, :post ] end module_function :add diff --git a/config/routes/network.rb b/config/routes/network.rb index 0b38d33c0..b0e41d99e 100644 --- a/config/routes/network.rb +++ b/config/routes/network.rb @@ -1,8 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) - # networks - map.resources :networks, :only => [:create, :show, :index, :update, :destroy] + # networkss + map.match api_path + '/networks', :to => 'networks#index', :via => :get + map.match api_path + '/networks/:id', :to => 'networks#show', :via => :get + map.match api_path + '/networks', :to => 'networks#create', :via => :post + map.match api_path + '/networks/:id', :to => 'networks#update', :via => :put + map.match api_path + '/networks/:id', :to => 'networks#destroy',:via => :delete end module_function :add diff --git a/config/routes/organization.rb b/config/routes/organization.rb index 08317dd95..de3471da9 100644 --- a/config/routes/organization.rb +++ b/config/routes/organization.rb @@ -1,11 +1,11 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # organizations - map.match '/api/organizations', :to => 'organizations#index', :via => :get - map.match '/api/organizations/:id', :to => 'organizations#show', :via => :get - map.match '/api/organizations', :to => 'organizations#create', :via => :post - map.match '/api/organizations/:id', :to => 'organizations#update', :via => :put + map.match api_path + '/organizations', :to => 'organizations#index', :via => :get + map.match api_path + '/organizations/:id', :to => 'organizations#show', :via => :get + map.match api_path + '/organizations', :to => 'organizations#create', :via => :post + map.match api_path + '/organizations/:id', :to => 'organizations#update', :via => :put end module_function :add diff --git a/config/routes/overview.rb b/config/routes/overview.rb index f9c2f9667..0483f2ae7 100644 --- a/config/routes/overview.rb +++ b/config/routes/overview.rb @@ -1,12 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # overviews - map.match '/api/overviews', :to => 'overviews#index', :via => :get - map.match '/api/overviews/:id', :to => 'overviews#show', :via => :get - map.match '/api/overviews', :to => 'overviews#create', :via => :post - map.match '/api/overviews/:id', :to => 'overviews#update', :via => :put - map.match '/api/overviews/:id', :to => 'overviews#destroy', :via => :delete + map.match api_path + '/overviews', :to => 'overviews#index', :via => :get + map.match api_path + '/overviews/:id', :to => 'overviews#show', :via => :get + map.match api_path + '/overviews', :to => 'overviews#create', :via => :post + map.match api_path + '/overviews/:id', :to => 'overviews#update', :via => :put + map.match api_path + '/overviews/:id', :to => 'overviews#destroy', :via => :delete end module_function :add diff --git a/config/routes/package.rb b/config/routes/package.rb index 8008e385c..3bec7c136 100644 --- a/config/routes/package.rb +++ b/config/routes/package.rb @@ -1,10 +1,10 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # overviews - map.match '/api/packages', :to => 'packages#index', :via => :get - map.match '/api/packages', :to => 'packages#install', :via => :post - map.match '/api/packages', :to => 'packages#uninstall', :via => :delete + map.match api_path + '/packages', :to => 'packages#index', :via => :get + map.match api_path + '/packages', :to => 'packages#install', :via => :post + map.match api_path + '/packages', :to => 'packages#uninstall', :via => :delete end module_function :add diff --git a/config/routes/postmaster_filter.rb b/config/routes/postmaster_filter.rb index 1eb7ba850..04251d14b 100644 --- a/config/routes/postmaster_filter.rb +++ b/config/routes/postmaster_filter.rb @@ -1,12 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # postmaster_filters - map.match '/api/postmaster_filters', :to => 'postmaster_filters#index', :via => :get - map.match '/api/postmaster_filters/:id', :to => 'postmaster_filters#show', :via => :get - map.match '/api/postmaster_filters', :to => 'postmaster_filters#create', :via => :post - map.match '/api/postmaster_filters/:id', :to => 'postmaster_filters#update', :via => :put - map.match '/api/postmaster_filters/:id', :to => 'postmaster_filters#destroy', :via => :delete + map.match api_path + '/postmaster_filters', :to => 'postmaster_filters#index', :via => :get + map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#show', :via => :get + map.match api_path + '/postmaster_filters', :to => 'postmaster_filters#create', :via => :post + map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#update', :via => :put + map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#destroy', :via => :delete end module_function :add diff --git a/config/routes/recent_viewed.rb b/config/routes/recent_viewed.rb index d21baafb8..cf1ef4c9b 100644 --- a/config/routes/recent_viewed.rb +++ b/config/routes/recent_viewed.rb @@ -1,7 +1,7 @@ module ExtraRoutes - def add(map) + def add(map, api_path) - map.match '/api/recent_viewed', :to => 'recent_viewed#recent_viewed', :via => :get + map.match api_path + '/recent_viewed', :to => 'recent_viewed#recent_viewed', :via => :get end module_function :add diff --git a/config/routes/role.rb b/config/routes/role.rb index bafe90bac..621e02924 100644 --- a/config/routes/role.rb +++ b/config/routes/role.rb @@ -1,11 +1,11 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # roles - map.match '/api/roles', :to => 'roles#index', :via => :get - map.match '/api/roles/:id', :to => 'roles#show', :via => :get - map.match '/api/roles', :to => 'roles#create', :via => :post - map.match '/api/roles/:id', :to => 'roles#update', :via => :put + map.match api_path + '/roles', :to => 'roles#index', :via => :get + map.match api_path + '/roles/:id', :to => 'roles#show', :via => :get + map.match api_path + '/roles', :to => 'roles#create', :via => :post + map.match api_path + '/roles/:id', :to => 'roles#update', :via => :put end module_function :add diff --git a/config/routes/rss.rb b/config/routes/rss.rb index 689e52964..ff31463c6 100644 --- a/config/routes/rss.rb +++ b/config/routes/rss.rb @@ -1,8 +1,8 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # rss - map.match '/api/rss_fetch', :to => 'rss#fetch', :via => :get + map.match api_path + '/rss_fetch', :to => 'rss#fetch', :via => :get end module_function :add diff --git a/config/routes/search.rb b/config/routes/search.rb index da334fa3e..f28e8c963 100644 --- a/config/routes/search.rb +++ b/config/routes/search.rb @@ -1,8 +1,8 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # search - map.match '/api/search', :to => 'search#search', :via => [:get, :post] + map.match api_path + '/search', :to => 'search#search', :via => [:get, :post] end module_function :add diff --git a/config/routes/setting.rb b/config/routes/setting.rb index adcf126e0..0e9d7d5b8 100644 --- a/config/routes/setting.rb +++ b/config/routes/setting.rb @@ -1,12 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # base objects - map.match '/api/settings', :to => 'settings#index', :via => :get - map.match '/api/settings/:id', :to => 'settings#show', :via => :get - map.match '/api/settings', :to => 'settings#create', :via => :post - map.match '/api/settings/:id', :to => 'settings#update', :via => :put - map.match '/api/settings/:id', :to => 'settings#destroy', :via => :delete + map.match api_path + '/settings', :to => 'settings#index', :via => :get + map.match api_path + '/settings/:id', :to => 'settings#show', :via => :get + map.match api_path + '/settings', :to => 'settings#create', :via => :post + map.match api_path + '/settings/:id', :to => 'settings#update', :via => :put + map.match api_path + '/settings/:id', :to => 'settings#destroy', :via => :delete end module_function :add diff --git a/config/routes/signature.rb b/config/routes/signature.rb index dcea764d2..b4e21d2e7 100644 --- a/config/routes/signature.rb +++ b/config/routes/signature.rb @@ -1,12 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) - # groups - map.match '/api/signatures', :to => 'signatures#index', :via => :get - map.match '/api/signatures/:id', :to => 'signatures#show', :via => :get - map.match '/api/signatures', :to => 'signatures#create', :via => :post - map.match '/api/signatures/:id', :to => 'signatures#update', :via => :put - map.match '/api/signatures/:id', :to => 'signatures#destroy', :via => :delete + # signatures + map.match api_path + '/signatures', :to => 'signatures#index', :via => :get + map.match api_path + '/signatures/:id', :to => 'signatures#show', :via => :get + map.match api_path + '/signatures', :to => 'signatures#create', :via => :post + map.match api_path + '/signatures/:id', :to => 'signatures#update', :via => :put + map.match api_path + '/signatures/:id', :to => 'signatures#destroy', :via => :delete end module_function :add diff --git a/config/routes/sla.rb b/config/routes/sla.rb index 43c88bf04..6b7d44f8b 100644 --- a/config/routes/sla.rb +++ b/config/routes/sla.rb @@ -1,12 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # slas - map.match '/api/slas', :to => 'slas#index', :via => :get - map.match '/api/slas/:id', :to => 'slas#show', :via => :get - map.match '/api/slas', :to => 'slas#create', :via => :post - map.match '/api/slas/:id', :to => 'slas#update', :via => :put - map.match '/api/slas/:id', :to => 'slas#destroy', :via => :delete + map.match api_path + '/slas', :to => 'slas#index', :via => :get + map.match api_path + '/slas/:id', :to => 'slas#show', :via => :get + map.match api_path + '/slas', :to => 'slas#create', :via => :post + map.match api_path + '/slas/:id', :to => 'slas#update', :via => :put + map.match api_path + '/slas/:id', :to => 'slas#destroy', :via => :delete end module_function :add diff --git a/config/routes/tag.rb b/config/routes/tag.rb index dc40d1727..ebfa10d90 100644 --- a/config/routes/tag.rb +++ b/config/routes/tag.rb @@ -1,10 +1,10 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # links - map.match '/api/tags', :to => 'tags#list', :via => :get - map.match '/api/tags/add', :to => 'tags#add', :via => :get - map.match '/api/tags/remove', :to => 'tags#remove', :via => :get + map.match api_path + '/tags', :to => 'tags#list', :via => :get + map.match api_path + '/tags/add', :to => 'tags#add', :via => :get + map.match api_path + '/tags/remove', :to => 'tags#remove', :via => :get end module_function :add diff --git a/config/routes/taskbar.rb b/config/routes/taskbar.rb index fcc73275a..0721dd0ea 100644 --- a/config/routes/taskbar.rb +++ b/config/routes/taskbar.rb @@ -1,10 +1,10 @@ module ExtraRoutes - def add(map) - map.match '/api/taskbar', :to => 'taskbar#index', :via => :get - map.match '/api/taskbar/:id', :to => 'taskbar#show', :via => :get - map.match '/api/taskbar', :to => 'taskbar#create', :via => :post - map.match '/api/taskbar/:id', :to => 'taskbar#update', :via => :put - map.match '/api/taskbar/:id', :to => 'taskbar#destroy',:via => :delete + def add(map, api_path) + map.match api_path + '/taskbar', :to => 'taskbar#index', :via => :get + map.match api_path + '/taskbar/:id', :to => 'taskbar#show', :via => :get + map.match api_path + '/taskbar', :to => 'taskbar#create', :via => :post + map.match api_path + '/taskbar/:id', :to => 'taskbar#update', :via => :put + map.match api_path + '/taskbar/:id', :to => 'taskbar#destroy',:via => :delete end module_function :add end diff --git a/config/routes/template.rb b/config/routes/template.rb index 7ec191c02..41d41e5c9 100644 --- a/config/routes/template.rb +++ b/config/routes/template.rb @@ -1,12 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # templates - map.match '/api/templates', :to => 'templates#index', :via => :get - map.match '/api/templates/:id', :to => 'templates#show', :via => :get - map.match '/api/templates', :to => 'templates#create', :via => :post - map.match '/api/templates/:id', :to => 'templates#update', :via => :put - map.match '/api/templates/:id', :to => 'templates#destroy', :via => :delete + map.match api_path + '/templates', :to => 'templates#index', :via => :get + map.match api_path + '/templates/:id', :to => 'templates#show', :via => :get + map.match api_path + '/templates', :to => 'templates#create', :via => :post + map.match api_path + '/templates/:id', :to => 'templates#update', :via => :put + map.match api_path + '/templates/:id', :to => 'templates#destroy', :via => :delete end module_function :add diff --git a/config/routes/test.rb b/config/routes/test.rb index d81067709..75ebce01a 100644 --- a/config/routes/test.rb +++ b/config/routes/test.rb @@ -1,5 +1,5 @@ module ExtraRoutes - def add(map) + def add(map, api_path) map.match '/tests-core', :to => 'tests#core', :via => :get map.match '/tests-form', :to => 'tests#form', :via => :get diff --git a/config/routes/text_module.rb b/config/routes/text_module.rb index 542ff1875..f165386ec 100644 --- a/config/routes/text_module.rb +++ b/config/routes/text_module.rb @@ -1,12 +1,12 @@ module ExtraRoutes - def add(map) + def add(map, api_path) - # roles - map.match '/api/text_modules', :to => 'text_modules#index', :via => :get - map.match '/api/text_modules/:id', :to => 'text_modules#show', :via => :get - map.match '/api/text_modules', :to => 'text_modules#create', :via => :post - map.match '/api/text_modules/:id', :to => 'text_modules#update', :via => :put - map.match '/api/text_modules/:id', :to => 'text_modules#destroy', :via => :delete + # text_modules + map.match api_path + '/text_modules', :to => 'text_modules#index', :via => :get + map.match api_path + '/text_modules/:id', :to => 'text_modules#show', :via => :get + map.match api_path + '/text_modules', :to => 'text_modules#create', :via => :post + map.match api_path + '/text_modules/:id', :to => 'text_modules#update', :via => :put + map.match api_path + '/text_modules/:id', :to => 'text_modules#destroy', :via => :delete end module_function :add diff --git a/config/routes/ticket.rb b/config/routes/ticket.rb index 50b4a72fe..2924d6564 100644 --- a/config/routes/ticket.rb +++ b/config/routes/ticket.rb @@ -1,42 +1,42 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # tickets - map.match '/api/tickets/search', :to => 'tickets#search', :via => [:get, :post] - map.match '/api/tickets', :to => 'tickets#index', :via => :get - map.match '/api/tickets/:id', :to => 'tickets#show', :via => :get - map.match '/api/tickets', :to => 'tickets#create', :via => :post - map.match '/api/tickets/:id', :to => 'tickets#update', :via => :put - map.match '/api/ticket_create', :to => 'tickets#ticket_create', :via => :get - map.match '/api/ticket_full/:id', :to => 'tickets#ticket_full', :via => :get - map.match '/api/ticket_history/:id', :to => 'tickets#ticket_history', :via => :get - map.match '/api/ticket_customer', :to => 'tickets#ticket_customer', :via => :get - map.match '/api/ticket_merge_list/:ticket_id', :to => 'tickets#ticket_merge_list', :via => :get - map.match '/api/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'tickets#ticket_merge', :via => :get + map.match api_path + '/tickets/search', :to => 'tickets#search', :via => [:get, :post] + map.match api_path + '/tickets', :to => 'tickets#index', :via => :get + map.match api_path + '/tickets/:id', :to => 'tickets#show', :via => :get + map.match api_path + '/tickets', :to => 'tickets#create', :via => :post + map.match api_path + '/tickets/:id', :to => 'tickets#update', :via => :put + map.match api_path + '/ticket_create', :to => 'tickets#ticket_create', :via => :get + map.match api_path + '/ticket_full/:id', :to => 'tickets#ticket_full', :via => :get + map.match api_path + '/ticket_history/:id', :to => 'tickets#ticket_history', :via => :get + map.match api_path + '/ticket_customer', :to => 'tickets#ticket_customer', :via => :get + map.match api_path + '/ticket_merge_list/:ticket_id', :to => 'tickets#ticket_merge_list', :via => :get + map.match api_path + '/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'tickets#ticket_merge', :via => :get # ticket overviews - map.match '/api/ticket_overviews', :to => 'ticket_overviews#show', :via => :get + map.match api_path + '/ticket_overviews', :to => 'ticket_overviews#show', :via => :get # ticket priority - map.match '/api/ticket_priorities', :to => 'ticket_priorities#index', :via => :get - map.match '/api/ticket_priorities/:id', :to => 'ticket_priorities#show', :via => :get - map.match '/api/ticket_priorities', :to => 'ticket_priorities#create', :via => :post - map.match '/api/ticket_priorities/:id', :to => 'ticket_priorities#update', :via => :put + map.match api_path + '/ticket_priorities', :to => 'ticket_priorities#index', :via => :get + map.match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#show', :via => :get + map.match api_path + '/ticket_priorities', :to => 'ticket_priorities#create', :via => :post + map.match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#update', :via => :put # ticket state - map.match '/api/ticket_states', :to => 'ticket_states#index', :via => :get - map.match '/api/ticket_states/:id', :to => 'ticket_states#show', :via => :get - map.match '/api/ticket_states', :to => 'ticket_states#create', :via => :post - map.match '/api/ticket_states/:id', :to => 'ticket_states#update', :via => :put + map.match api_path + '/ticket_states', :to => 'ticket_states#index', :via => :get + map.match api_path + '/ticket_states/:id', :to => 'ticket_states#show', :via => :get + map.match api_path + '/ticket_states', :to => 'ticket_states#create', :via => :post + map.match api_path + '/ticket_states/:id', :to => 'ticket_states#update', :via => :put # ticket articles - map.match '/api/ticket_articles', :to => 'ticket_articles#index', :via => :get - map.match '/api/ticket_articles/:id', :to => 'ticket_articles#show', :via => :get - map.match '/api/ticket_articles', :to => 'ticket_articles#create', :via => :post - map.match '/api/ticket_articles/:id', :to => 'ticket_articles#update', :via => :put - map.match '/api/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_articles#attachment', :via => :get - map.match '/api/ticket_attachment_new', :to => 'ticket_articles#attachment_new', :via => :post - map.match '/api/ticket_article_plain/:id', :to => 'ticket_articles#article_plain', :via => :get + map.match api_path + '/ticket_articles', :to => 'ticket_articles#index', :via => :get + map.match api_path + '/ticket_articles/:id', :to => 'ticket_articles#show', :via => :get + map.match api_path + '/ticket_articles', :to => 'ticket_articles#create', :via => :post + map.match api_path + '/ticket_articles/:id', :to => 'ticket_articles#update', :via => :put + map.match api_path + '/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_articles#attachment', :via => :get + map.match api_path + '/ticket_attachment_new', :to => 'ticket_articles#attachment_new', :via => :post + map.match api_path + '/ticket_article_plain/:id', :to => 'ticket_articles#article_plain', :via => :get end module_function :add diff --git a/config/routes/translation.rb b/config/routes/translation.rb index 7b036d877..2ff531bfe 100644 --- a/config/routes/translation.rb +++ b/config/routes/translation.rb @@ -1,7 +1,12 @@ module ExtraRoutes - def add(map) - map.resources :translations - map.match '/translations/lang/:locale', :to => 'translations#load', :via => :get + def add(map, api_path) + map.match api_path + '/translations', :to => 'translations#index', :via => :get + map.match api_path + '/translations/:id', :to => 'translations#show', :via => :get + map.match api_path + '/translations', :to => 'translations#create', :via => :post + map.match api_path + '/translations/:id', :to => 'translations#update', :via => :put + map.match api_path + '/translations/:id', :to => 'translations#destroy', :via => :delete + + map.match api_path + '/translations/lang/:locale', :to => 'translations#load', :via => :get end module_function :add end diff --git a/config/routes/user.rb b/config/routes/user.rb index dba6b6997..c963b2877 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -1,17 +1,17 @@ module ExtraRoutes - def add(map) + def add(map, api_path) # users - map.match '/api/users/search', :to => 'users#search', :via => [:get, :post] - map.match '/api/users/password_reset', :to => 'users#password_reset_send', :via => :post - map.match '/api/users/password_reset_verify', :to => 'users#password_reset_verify', :via => :post - map.match '/api/users/password_change', :to => 'users#password_change', :via => :post - map.match '/api/users/preferences', :to => 'users#preferences', :via => :put - map.match '/api/users/account', :to => 'users#account_remove', :via => :delete - map.match '/api/users', :to => 'users#index', :via => :get - map.match '/api/users/:id', :to => 'users#show', :via => :get - map.match '/api/users', :to => 'users#create', :via => :post - map.match '/api/users/:id', :to => 'users#update', :via => :put + map.match api_path + '/users/search', :to => 'users#search', :via => [:get, :post] + map.match api_path + '/users/password_reset', :to => 'users#password_reset_send', :via => :post + map.match api_path + '/users/password_reset_verify', :to => 'users#password_reset_verify', :via => :post + map.match api_path + '/users/password_change', :to => 'users#password_change', :via => :post + map.match api_path + '/users/preferences', :to => 'users#preferences', :via => :put + map.match api_path + '/users/account', :to => 'users#account_remove', :via => :delete + map.match api_path + '/users', :to => 'users#index', :via => :get + map.match api_path + '/users/:id', :to => 'users#show', :via => :get + map.match api_path + '/users', :to => 'users#create', :via => :post + map.match api_path + '/users/:id', :to => 'users#update', :via => :put end module_function :add