Skip to content

Commit a731fac

Browse files
dtayehgithub-actions[bot]
authored andcommitted
chore: Publish v5.3.2+ads-SNAPSHOT
1 parent 18f71bf commit a731fac

File tree

22 files changed

+1975
-53
lines changed

22 files changed

+1975
-53
lines changed

code/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<dependency>
66
<groupId>com.expediagroup</groupId>
77
<artifactId>rapid-sdk</artifactId>
8-
<version>5.3.2</version>
8+
<version>5.3.2+ads-SNAPSHOT</version>
99
</dependency>
1010
```
1111

code/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.expediagroup</groupId>
66
<artifactId>rapid-sdk</artifactId>
7-
<version>5.3.2</version>
7+
<version>5.3.2+ads-SNAPSHOT</version>
88
<name>EG rapid-sdk for Java</name>
9-
<description>EG rapid-sdk v5.3.2</description>
9+
<description>EG rapid-sdk v5.3.2+ads-SNAPSHOT</description>
1010
<url>https://github.com/ExpediaGroup/test-sdk</url>
1111
<inceptionYear>2022</inceptionYear>
1212
<packaging>jar</packaging>
@@ -79,7 +79,7 @@
7979
<properties.maven.plugin.version>1.2.1</properties.maven.plugin.version>
8080
<maven.licence.plugin.version>4.6</maven.licence.plugin.version>
8181
<flatten.maven.plugin.version>1.6.0</flatten.maven.plugin.version>
82-
<kotlin.version>2.1.0</kotlin.version>
82+
<kotlin.version>2.1.10</kotlin.version>
8383
<kotlinx.coroutines.version>1.10.1</kotlinx.coroutines.version>
8484
<ktor.version>3.0.3</ktor.version>
8585
<kotlin-atomic.version>0.27.0</kotlin-atomic.version>

code/src/main/kotlin/com/expediagroup/sdk/core/constant/provider/LogMaskingRegexProvider.kt

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,38 @@
1616
package com.expediagroup.sdk.core.constant.provider
1717

1818
internal object LogMaskingRegexProvider {
19+
/**
20+
* Generates a regex pattern to match specified fields in a JSON string.
21+
*
22+
* @param maskedBodyFields the set of fields to be masked
23+
* @param valueToMatch regex pattern to match the value of the fields. Default: match any sequence of characters except double quotes.
24+
* @return the regex pattern to match the specified fields and their values
25+
*/
1926
fun getMaskedFieldsRegex(
2027
maskedBodyFields: Set<String>,
21-
value: String = "[^\\\"]+"
28+
valueToMatch: String = "[^\\\"]+"
2229
): Regex {
2330
val fields = maskedBodyFields.joinToString("|")
24-
return "\"($fields)(\\\\*\"\\s*:\\s*\\\\*\")$value(?:\\\\?\"|)".toRegex()
31+
// The pattern matches:
32+
// - The field name (one of the specified fields) captured in group 1.
33+
// - Optional backslash, closing double quotes, colon(:), optional whitespace, and opening double quotes.
34+
// - The value of the field, matching the specified valueToMatch pattern.
35+
// - Optional backslash, followed by a closing double quote
36+
return "\"($fields)(\\\\?\"\\s*:\\s*\\\\*\")$valueToMatch(?:\\\\?\")".toRegex()
2537
}
2638

39+
/**
40+
* Generates a regex pattern to match a specified field in a JSON string.
41+
*
42+
* @param maskedBodyField the field to be masked
43+
* @param valueToMatch regex pattern to match the value of the field. Default: match any sequence of characters except double quotes.
44+
* @return the regex pattern to match the specified field and its value
45+
*/
2746
fun getMaskedFieldsRegex(
2847
maskedBodyField: String,
29-
value: String = "[^\\\"]+"
48+
valueToMatch: String = "[^\\\"]+"
3049
): Regex {
3150
val fields = setOf(maskedBodyField)
32-
return getMaskedFieldsRegex(fields, value)
51+
return getMaskedFieldsRegex(fields, valueToMatch)
3352
}
3453
}

code/src/main/kotlin/com/expediagroup/sdk/rapid/client/RapidClient.kt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import com.expediagroup.sdk.rapid.operations.DeleteRoomOperation
4242
import com.expediagroup.sdk.rapid.operations.DeleteRoomOperationParams
4343
import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperation
4444
import com.expediagroup.sdk.rapid.operations.GetAdditionalAvailabilityOperationParams
45+
import com.expediagroup.sdk.rapid.operations.GetAdsOperation
46+
import com.expediagroup.sdk.rapid.operations.GetAdsOperationParams
4547
import com.expediagroup.sdk.rapid.operations.GetAvailabilityOperation
4648
import com.expediagroup.sdk.rapid.operations.GetAvailabilityOperationParams
4749
import com.expediagroup.sdk.rapid.operations.GetBookingReceiptOperation
@@ -896,6 +898,92 @@ class RapidClient private constructor(clientConfiguration: RapidClientConfigurat
896898
}
897899
}
898900

901+
/**
902+
*
903+
* Returns relevant ads.
904+
* @param operation [GetAdsOperation]
905+
* @throws ExpediaGroupApiErrorException
906+
* @return a [Response] object with a body of type AdsResponse
907+
*/
908+
fun execute(operation: GetAdsOperation): Response<AdsResponse> = execute<AdsRequest, AdsResponse>(operation)
909+
910+
/**
911+
*
912+
* Returns relevant ads.
913+
* @param operation [GetAdsOperation]
914+
* @throws ExpediaGroupApiErrorException
915+
* @return a [CompletableFuture<Response>] object with a body of type AdsResponse
916+
*/
917+
fun executeAsync(operation: GetAdsOperation): CompletableFuture<Response<AdsResponse>> = executeAsync<AdsRequest, AdsResponse>(operation)
918+
919+
private suspend inline fun kgetAdsWithResponse(
920+
customerIp: kotlin.String? =
921+
null,
922+
adsRequest: AdsRequest? =
923+
null
924+
): Response<AdsResponse> {
925+
val params =
926+
GetAdsOperationParams(
927+
customerIp = customerIp
928+
)
929+
930+
val operation =
931+
GetAdsOperation(
932+
params,
933+
adsRequest
934+
)
935+
936+
return execute(operation)
937+
}
938+
939+
/**
940+
*
941+
* Returns relevant ads.
942+
* @param customerIp IP address of the customer, as captured by your integration. Ensure your integration passes the customer's IP, not your own. This value helps determine their location for ad relevancy. Also used for fraud recovery and other important analytics. (optional)
943+
* @param adsRequest (optional)
944+
* @throws ExpediaGroupApiErrorException
945+
* @return AdsResponse
946+
*/
947+
@Throws(
948+
ExpediaGroupApiErrorException::class
949+
)
950+
@JvmOverloads
951+
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAdsOperation)"))
952+
fun getAds(
953+
customerIp: kotlin.String? =
954+
null,
955+
adsRequest: AdsRequest? =
956+
null
957+
): AdsResponse = getAdsWithResponse(customerIp, adsRequest).data
958+
959+
/**
960+
*
961+
* Returns relevant ads.
962+
* @param customerIp IP address of the customer, as captured by your integration. Ensure your integration passes the customer's IP, not your own. This value helps determine their location for ad relevancy. Also used for fraud recovery and other important analytics. (optional)
963+
* @param adsRequest (optional)
964+
* @throws ExpediaGroupApiErrorException
965+
* @return a [Response] object with a body of type AdsResponse
966+
*/
967+
@Throws(
968+
ExpediaGroupApiErrorException::class
969+
)
970+
@JvmOverloads
971+
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: GetAdsOperation)"))
972+
fun getAdsWithResponse(
973+
customerIp: kotlin.String? =
974+
null,
975+
adsRequest: AdsRequest? =
976+
null
977+
): Response<AdsResponse> {
978+
try {
979+
return GlobalScope.future(Dispatchers.IO) {
980+
kgetAdsWithResponse(customerIp, adsRequest)
981+
}.get()
982+
} catch (exception: Exception) {
983+
exception.handle()
984+
}
985+
}
986+
899987
/**
900988
* Get property room rates and availability
901989
* Returns rates on available room types for specified properties (maximum of 250 properties per request). The response includes rate details such as promos, whether the rate is refundable, cancellation penalties and a full price breakdown to meet the price display requirements for your market. _Note_: If there are no available rooms, the response will be an empty array. * Multiple rooms of the same type may be requested by including multiple instances of the `occupancy` parameter. * The `nightly` array includes each individual night's charges. When the total price includes fees, charges, or adjustments that are not divided by night, these amounts will be included in the `stay` rate array, which details charges applied to the entire stay (each check-in).

0 commit comments

Comments
 (0)