akiomik/hubot-chatwork

`Room(room_id).Tasks().show` does not recognize `opts` parameter?

Opened this issue · 0 comments

Thank you for convenient api!

I want to get a user tasks.
So I use an account option.

room_id = "xxxx"
staff_id = "1234" 
opts = 
    account: staff_id
    status: "open"

Room(room_id).Tasks().show opts, (_, json) -> 

But all tasks given.

I watch a log.
The body is correct.

   Tasks: =>
      show: (opts, callback) =>
        params = []
        params.push "account_id=#{opts.account}" if opts.account?
        params.push "assigned_by_account_id=#{opts.assignedBy}" if opts.assignedBy?
        params.push "status=#{opts.status}" if opts.status?
        body = params.join '&'

        @robot.logger.info body
        # => account_id=1234&status=open

        @get "#{baseUrl}/tasks", body, callback

But request has no params.

When watch the options, path has no query params.

    # https://github.com/akiomik/hubot-chatwork/blob/master/src/chatwork.coffee#L217

    logger.info options
    request = HTTPS.request options, (response) ->

# { agent: false,
#   host: 'api.chatwork.com',
#   port: 443,
#   path: '/v1/rooms/xxxxxx/tasks',
#   method: 'GET',
#   headers:
#    { Host: 'api.chatwork.com',
#      'X-ChatWorkToken': 'xxxxxx',
#      'Content-Type': 'application/x-www-form-urlencoded',
#      'Content-Length': 29 } }

I hope that the path is `path: '/v1/rooms/xxxxxx/tasks?account_id=1234&status=open'.

I use node v0.10.25. It has breaking changes?

$ node -v
v0.10.25

thanks