1 | _ = require('underscore')
|
2 |
|
3 | class BaseModule
|
4 | name: "BaseModule"
|
5 | format: "xml"
|
6 | scope: "private"
|
7 |
|
8 | constructor: (@product) ->
|
9 | if not @product
|
10 | throw new Error('Requires product')
|
11 | return
|
12 |
|
13 | getUrlParts: ->
|
14 | return [ @scope, @format, @name ]
|
15 |
|
16 | buildUrl: (query={}, path=[], options={}) ->
|
17 | url = @product.getBaseUrl()
|
18 | url.method = 'POST'
|
19 | url.path = url.path.concat(@getUrlParts())
|
20 | url.path = url.path.concat(path)
|
21 | url.pathname = "/" + url.path.join("/")
|
22 | _.extend(url.query, query)
|
23 | return url
|
24 |
|
25 | module.exports = BaseModule
|