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"
|
const val DONE = "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
open class PinboardPoster(val apiToken: String) {
|
open class PinboardPoster(var apiToken: String) {
|
||||||
var apiEndPoint: String = Constants.API_ENDPOINT
|
var apiEndPoint: String = Constants.API_ENDPOINT
|
||||||
|
|
||||||
val logger: Logger by lazy { Logger.getLogger(PinboardPoster::class.java.simpleName) }
|
val logger: Logger by lazy { Logger.getLogger(PinboardPoster::class.java.simpleName) }
|
||||||
|
@ -141,7 +141,7 @@ open class PinboardPoster(val apiToken: String) {
|
||||||
} else {
|
} else {
|
||||||
logger.severe("An error has occurred while executing $method.")
|
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)
|
logger.log(Level.SEVERE, "Could not parse $method XML response.", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,13 +154,13 @@ open class PinboardPoster(val apiToken: String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cleanEndPoint(method: String): String {
|
private fun cleanEndPoint(method: String): String {
|
||||||
if (apiEndPoint.endsWith('/')) {
|
return if (apiEndPoint.endsWith('/')) {
|
||||||
return "$apiEndPoint$method"
|
"$apiEndPoint$method"
|
||||||
} else {
|
} else {
|
||||||
return "$apiEndPoint/$method"
|
"$apiEndPoint/$method"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun logHttp(method: String, msg: String) {
|
private fun logHttp(method: String, msg: String) {
|
||||||
logger.logp(Level.FINE, PinboardPoster::class.java.name, "executeMethod($method)", msg)
|
logger.logp(Level.FINE, PinboardPoster::class.java.name, "executeMethod($method)", msg)
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ open class PinboardPoster(val apiToken: String) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URL(url)
|
URL(url)
|
||||||
} catch(e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.log(Level.FINE, "Invalid URL: $url", e)
|
logger.log(Level.FINE, "Invalid URL: $url", e)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue