Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
osdakira opened this issue Mar 15, 2016 · 0 comments
Open

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

osdakira opened this issue Mar 15, 2016 · 0 comments

Comments

@osdakira
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant