Cleaned up maps.
This commit is contained in:
parent
2fce7bc361
commit
cb346effa6
2 changed files with 21 additions and 14 deletions
10
.github/workflows/gradle.yml
vendored
10
.github/workflows/gradle.yml
vendored
|
@ -5,22 +5,28 @@ on: [push, pull_request, workflow_dispatch]
|
|||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
|
||||
SONAR_JDK: "11"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [ 1.8, 11, 15 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK ${{ matrix.java-version }}
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java-version }}
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Cache SonarCloud packages
|
||||
if: matrix.java-version == env.SONAR_JDK
|
||||
uses: actions/cache@v1
|
||||
|
@ -28,6 +34,7 @@ jobs:
|
|||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
@ -37,16 +44,19 @@ jobs:
|
|||
key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-${{ matrix.java-version }}-
|
||||
|
||||
- name: Test with Gradle
|
||||
env:
|
||||
BITLY_ACCESS_TOKEN: ${{ secrets.BITLY_ACCESS_TOKEN }}
|
||||
run: ./gradlew build check --stacktrace
|
||||
|
||||
- name: SonarCloud
|
||||
if: success() && matrix.java-version == env.SONAR_JDK
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
run: ./gradlew sonarqube
|
||||
|
||||
- name: Cleanup Gradle Cache
|
||||
run: |
|
||||
rm -f ~/.gradle/caches/modules-2/modules-2.lock
|
||||
|
|
|
@ -80,11 +80,11 @@ open class Bitlinks(private val accessToken: String) {
|
|||
lastCallResponse = Utils.call(
|
||||
accessToken,
|
||||
("/bitlinks/${bitlink.removeHttp()}/clicks/summary").toEndPoint(),
|
||||
hashMapOf(
|
||||
Pair("unit", unit.toString().lowercase()),
|
||||
Pair("units", units.toString()),
|
||||
Pair("size", size.toString()),
|
||||
Pair("unit_reference", unit_reference)
|
||||
mapOf(
|
||||
"unit" to unit.toString().lowercase(),
|
||||
"units" to units.toString(),
|
||||
"size" to size.toString(),
|
||||
"unit_reference" to unit_reference
|
||||
),
|
||||
Methods.GET
|
||||
)
|
||||
|
@ -118,7 +118,7 @@ open class Bitlinks(private val accessToken: String) {
|
|||
lastCallResponse = Utils.call(
|
||||
accessToken,
|
||||
"/bitlinks".toEndPoint(),
|
||||
mutableMapOf<String, Any>(Pair("long_url", long_url)).apply {
|
||||
mutableMapOf<String, Any>("long_url" to long_url).apply {
|
||||
if (domain.isNotBlank()) put("domain", domain)
|
||||
if (title.isNotBlank()) put("title", title)
|
||||
if (group_guid.isNotBlank()) put("group_guid", group_guid)
|
||||
|
@ -149,7 +149,7 @@ open class Bitlinks(private val accessToken: String) {
|
|||
lastCallResponse = Utils.call(
|
||||
accessToken,
|
||||
"/expand".toEndPoint(),
|
||||
mapOf(Pair("bitlink_id", bitlink_id.removeHttp())),
|
||||
mapOf("bitlink_id" to bitlink_id.removeHttp()),
|
||||
Methods.POST
|
||||
)
|
||||
longUrl = parseJsonResponse(lastCallResponse, "long_url", longUrl, toJson)
|
||||
|
@ -202,14 +202,11 @@ open class Bitlinks(private val accessToken: String) {
|
|||
if (!long_url.isValidUrl()) {
|
||||
Utils.logger.severe("Please specify a valid URL to shorten.")
|
||||
} else {
|
||||
val params: HashMap<String, String> = HashMap()
|
||||
if (group_guid.isNotBlank()) {
|
||||
params["group_guid"] = group_guid
|
||||
val params = mutableMapOf<String, String>().apply {
|
||||
if (group_guid.isNotBlank()) put("group_guid", group_guid)
|
||||
if (domain.isNotBlank()) put("domain", domain)
|
||||
put("long_url", long_url)
|
||||
}
|
||||
if (domain.isNotBlank()) {
|
||||
params["domain"] = domain
|
||||
}
|
||||
params["long_url"] = long_url
|
||||
|
||||
lastCallResponse = Utils.call(accessToken, "/shorten".toEndPoint(), params)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue