Skip to content

Commit

Permalink
Merge pull request #3108 from wordpress-mobile/issue/12899-support-ct…
Browse files Browse the repository at this point in the history
…a-text

Add support for creating Blaze campaigns with custom cta_text field
  • Loading branch information
JorgeMucientes authored Nov 13, 2024
2 parents 5dfbbc9 + 0209c40 commit cc17141
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ class BlazeCampaignsStoreTest {
val suggestions = List(10) {
BlazeAdSuggestion(
tagLine = it.toString(),
description = "Ad $it"
description = "Ad $it",
ctaText = "CTA $it"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package org.wordpress.android.fluxc.model.blaze

data class BlazeAdSuggestion(
val tagLine: String,
val description: String
val description: String,
val ctaText: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data class BlazeCampaignCreationRequest(
val paymentMethodId: String,
val tagLine: String,
val description: String,
val ctaText: String,
val startDate: Date,
val endDate: Date,
val budget: BlazeCampaignCreationRequestBudget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class BlazeCreationRestClient @Inject constructor(
),
"site_name" to request.tagLine,
"text_snippet" to request.description,
"cta_text" to request.ctaText,
"target_url" to request.targetUrl,
"url_params" to request.urlParams.entries.joinToString(separator = "&") { "${it.key}=${it.value}" },
"main_image" to JsonObject().apply {
Expand Down Expand Up @@ -366,11 +367,14 @@ private class BlazeAdSuggestionListResponse(
val siteName: String,
@SerializedName("text_snippet")
val textSnippet: String,
@SerializedName("cta_text")
val ctaText: String,
) {
fun toDomainModel(): BlazeAdSuggestion {
return BlazeAdSuggestion(
tagLine = siteName,
description = textSnippet
description = textSnippet,
ctaText = ctaText
)
}
}
Expand Down

0 comments on commit cc17141

Please sign in to comment.