Added config option for REST api base path on server and on site client. Currently on both "/api/v1" is used.

This commit is contained in:
Martin Edenhofer 2013-08-07 00:10:28 +02:00
parent 0a38481287
commit 59c4f77e3e
108 changed files with 390 additions and 374 deletions

View file

@ -0,0 +1 @@
App.Config.set('api_path', 'api/v1')

View file

@ -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,
}

View file

@ -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:

View file

@ -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
}

View file

@ -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,
}

View file

@ -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'

View file

@ -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',

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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: '<a href="" class="customer_new">&raquo;</a>', 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: '<a href="" class="customer_new">&raquo;</a>', 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', },

View file

@ -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

View file

@ -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
}

View file

@ -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,

View file

@ -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,
}

View file

@ -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',

View file

@ -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,

View file

@ -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)

View file

@ -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

View file

@ -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()
)

View file

@ -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

View file

@ -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')()

View file

@ -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

View file

@ -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

View file

@ -1,6 +1,7 @@
#= require_self
#= require_tree ./lib/app_init
#= require ./config.js.coffee
#= require_tree ./models
#= require_tree ./controllers
#= require_tree ./views

View file

@ -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, ...)

View file

@ -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) =>

View file

@ -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) =>

View file

@ -1,5 +1,6 @@
class App.Model extends Spine.Model
@destroyBind: false
@api_path: App.Config.get('api_path')
constructor: ->
super

View file

@ -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'

View file

@ -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' },

View file

@ -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' },

View file

@ -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) ->

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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' },

View file

@ -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' },

View file

@ -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' },

View file

@ -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' },

View file

@ -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'

View file

@ -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' },

View file

@ -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.' },

View file

@ -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'

View file

@ -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'

View file

@ -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' },

View file

@ -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: '<a href="" class="customer_new">&raquo;</a>' },

View file

@ -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', },

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -1,3 +1,4 @@
class App.Translation extends App.Model
@configure 'Translation', 'source', 'target', 'locale'
@extend Spine.Model.Ajax
@url: @api_path + '/translations'

View file

@ -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 = [

View file

@ -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] )

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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')

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -3,7 +3,7 @@
class SearchController < ApplicationController
before_filter :authentication_check
# GET /api/search
# GET /api/v1/search
def search
# build result list

View file

@ -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

View file

@ -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

View file

@ -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],

View file

@ -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

View file

@ -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

View file

@ -3,7 +3,7 @@
class TicketOverviewsController < ApplicationController
before_filter :authentication_check
# GET /api/tickets
# GET /api/v1/tickets
def show
# get navbar overview data

View file

@ -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

View file

@ -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

View file

@ -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!

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

Some files were not shown because too many files have changed in this diff Show more