Skip to content

Commit 5e58fb4

Browse files
committed
fix issues as seen on Codacy
1 parent e7e5f5b commit 5e58fb4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ This is a simple library that aims to have basic functions of the Bitbucket API.
77
This library was meant to support Codacy when interacting with Bitbucket.
88
It is in a very early stage and all the contributions are welcome.
99

10-
### Build
10+
### Usage
1111

12-
It is built using Play Framework:
12+
Import on SBT:
1313

14-
* `activator package`
14+
"com.codacy" % "bitbucket-scala-client_2.11" % "1.0"
1515

1616
### Creators
1717

src/main/scala/com/codacy/client/bitbucket/client/BitbucketClient.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.codacy.client.bitbucket.client
22

3-
import com.ning.http.client.AsyncHttpClient
43
import com.codacy.client.bitbucket.util.HTTPStatusCodes
4+
import com.ning.http.client.AsyncHttpClient
55
import play.api.libs.json.{JsValue, Json, Reads}
66
import play.api.libs.oauth._
77
import play.api.libs.ws.WSClient
@@ -64,11 +64,11 @@ class BitbucketClient(key: String, secretKey: String, token: String, secretToken
6464
// println("\n\n")
6565

6666
val jsValue = parseJson(body)
67-
if (jsValue.isRight) {
68-
jsValue.right.get.as[T]
69-
RequestResponse(jsValue.right.get.asOpt[T])
70-
} else {
71-
RequestResponse(None, message = jsValue.left.get.detail, hasError = true)
67+
jsValue match {
68+
case Right(responseObj) =>
69+
RequestResponse(responseObj.asOpt[T])
70+
case Left(message) =>
71+
RequestResponse(None, message = message.detail, hasError = true)
7272
}
7373
} else {
7474
RequestResponse(None, result.statusText, hasError = true)

0 commit comments

Comments
 (0)