Exposed apiToken.
This commit is contained in:
parent
e2bb3c0a3d
commit
423d8494c2
1 changed files with 7 additions and 7 deletions
|
@ -48,7 +48,7 @@ object Constants {
|
|||
const val DONE = "done"
|
||||
}
|
||||
|
||||
open class PinboardPoster(val apiToken: String) {
|
||||
open class PinboardPoster(var apiToken: String) {
|
||||
var apiEndPoint: String = Constants.API_ENDPOINT
|
||||
|
||||
val logger: Logger by lazy { Logger.getLogger(PinboardPoster::class.java.simpleName) }
|
||||
|
@ -141,7 +141,7 @@ open class PinboardPoster(val apiToken: String) {
|
|||
} else {
|
||||
logger.severe("An error has occurred while executing $method.")
|
||||
}
|
||||
} catch(e: Exception) {
|
||||
} catch (e: Exception) {
|
||||
logger.log(Level.SEVERE, "Could not parse $method XML response.", e)
|
||||
}
|
||||
}
|
||||
|
@ -154,10 +154,10 @@ open class PinboardPoster(val apiToken: String) {
|
|||
}
|
||||
|
||||
private fun cleanEndPoint(method: String): String {
|
||||
if (apiEndPoint.endsWith('/')) {
|
||||
return "$apiEndPoint$method"
|
||||
return if (apiEndPoint.endsWith('/')) {
|
||||
"$apiEndPoint$method"
|
||||
} else {
|
||||
return "$apiEndPoint/$method"
|
||||
"$apiEndPoint/$method"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ open class PinboardPoster(val apiToken: String) {
|
|||
|
||||
try {
|
||||
URL(url)
|
||||
} catch(e: Exception) {
|
||||
} catch (e: Exception) {
|
||||
logger.log(Level.FINE, "Invalid URL: $url", e)
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue