Count BitBucket data
Opened this issue · 3 comments
Hello,
I working with Bitbucket (roughly the same service as Github, but private repository for free), but unfortunately Hubble doesn't woth with the Bitbucket data.
The error message from Hubble:
/usr/local/lib/node_modules/hubble/src/Board.coffee:124
if (value.length > column[line].value.length + 1) {
^
TypeError: Cannot read property 'length' of undefined
at Board._drawLine (/usr/local/lib/node_modules/hubble/src/Board.coffee:124:48)
at Board.draw (/usr/local/lib/node_modules/hubble/src/Board.coffee:77:14)
at Board._createOrUpdateDataPoint (/usr/local/lib/node_modules/hubble/src/Board.coffee:66:19)
at Object.update (/usr/local/lib/node_modules/hubble/src/Board.coffee:44:26)
at Request._callback (/usr/local/lib/node_modules/hubble/src/PollManager.coffee:24:31)
at Request.callback (/usr/local/lib/node_modules/hubble/node_modules/request/main.js:122:22)
at Request.emit (events.js:70:17)
at Request.<anonymous> (/usr/local/lib/node_modules/hubble/node_modules/request/main.js:661:16)
at Request.emit (events.js:88:20)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/hubble/node_modules/request/main.js:623:14)
The query:
curl http://localhost:9999 \
-d column=0 \
-d label="Total issues" \
-d poll_url="https://myLogin:myPassword@api.bitbucket.org/1.0/repositories/myLogin/myRepository/followers" \
> -d poll_seconds=10 \
> -d poll_failed="Bummer :(" \
> -d poll_method="count_array"
The result of this query
curl https://myLogin:myPassword@api.bitbucket.org/1.0/repositories/FrelEsquif/iconoclaste-underplate/followers
is:
{
"count": 1,
"followers": [
{
"username": "followerName",
"first_name": "followerFirstName",
"last_name": "followerLastName",
"display_name": "followerDisplayName",
"is_team": false,
"avatar": "https://secure.gravatar.com/avatar/33893a94c2298f2295eed58b337bdad7?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"resource_uri": "/1.0/users/followerName"
}
]
}
This isn't supported just yet - but I'm working on something now that
should take care of it. (With any luck, ill ship it today)
if you could send me your bitbucket credentials so I could use your query
to test that would be killer! jaymedavis @ gmail.
If not, I will try to find a similar scenario.
The reason this isn't working is because you need to count the array at the
'followers' json value. count_array right now only works at the root.
Jayme (mobile)
On Feb 1, 2013, at 5:24 AM, WaZaAfr notifications@github.com wrote:
Hello,
I working with Bitbucket (roughly the same service as Github, but private
repository for free), but unfortunately Hubble doesn't woth with the
Bitbucket data.
The error message from Hubble:
/usr/local/lib/node_modules/hubble/src/Board.coffee:124
if (value.length > column[line].value.length + 1) {
^
TypeError: Cannot read property 'length' of undefined
at Board._drawLine
(/usr/local/lib/node_modules/hubble/src/Board.coffee:124:48)
at Board.draw (/usr/local/lib/node_modules/hubble/src/Board.coffee:77:14)
at Board._createOrUpdateDataPoint
(/usr/local/lib/node_modules/hubble/src/Board.coffee:66:19)
at Object.update (/usr/local/lib/node_modules/hubble/src/Board.coffee:44:26)
at Request._callback
(/usr/local/lib/node_modules/hubble/src/PollManager.coffee:24:31)
at Request.callback
(/usr/local/lib/node_modules/hubble/node_modules/request/main.js:122:22)
at Request.emit (events.js:70:17)
at Request.
(/usr/local/lib/node_modules/hubble/node_modules/request/main.js:661:16)
at Request.emit (events.js:88:20)
at IncomingMessage.
(/usr/local/lib/node_modules/hubble/node_modules/request/main.js:623:14)
The query:
curl http://localhost:9999
-d column=0
-d label="Total issues"
-d poll_url="https://myLogin:myPassword@api.bitbucket.org/1.0/repositories/myLogin/myRepository/followers"
\
-d poll_seconds=10
-d poll_failed="Bummer :("
-d poll_method="count_array"
The result of this query
is:
{
"count": 1,
"followers": [
{
"username": "followerName",
"first_name": "followerFirstName",
"last_name": "followerLastName",
"display_name": "followerDisplayName",
"is_team": false,
"avatar":
"https://secure.gravatar.com/avatar/33893a94c2298f2295eed58b337bdad7?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"resource_uri": "/1.0/users/followerName"
}
]
}
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/8.
If you want to test some query on the Bitbucket API, there is a 'tutorial' repository. You can do all interesting queries for Hubble on it, like:
curl https://api.bitbucket.org/1.0/repositories/tutorials/tutorials.bitbucket.org/followers
If that's not enough, I can give you my bitbucket credentials, but I think you have all you may need with this example repository.
However, I don't know if there is a query limit by hour...
This works now, you just need to read the count field on the request...
curl http://localhost:9999
-d column=0
-d label="Total Followers"
-d poll_url="https://api.bitbucket.org/1.0/repositories/tutorials/tutorials.bitbucket.org/followers"
-d poll_seconds=2
-d poll_failed="Bummer :("
-d poll_method="json_value:^.[0].count"