```coffeescript
restler = require('restler')

class PulsarApiRest

  constructor: (url, token) ->
    restService = restler.service((url, token) ->
      if token
        @defaults.username = token
        @defaults.password = 'x-oauth-basic'
      return
    ,
      baseURL: url
    )
    return new restService(url, token)

module.exports = PulsarApiRest
```

Replace composition of PulsarApiRest with inheritance from RestlerService.
user
```coffeescript
RestlerService = require('restler').Service

class PulsarApiRest extends RestlerService

  constructor: (url, token) ->
    defaults = {}
    defaults.baseURL = url
    if token
      defaults.username = token
      defaults.password = 'x-oauth-basic'
    super(defaults)

module.exports = PulsarApiRest
```
assistant