forked from prebid/prebid-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eda2630
commit 7a72c37
Showing
10 changed files
with
260 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package multi | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
) | ||
|
||
func NewConfig(data json.RawMessage) (MultiCallConfig, error) { | ||
var cfg MultiCallConfig | ||
if err := json.Unmarshal(data, &cfg); err != nil { | ||
return cfg, fmt.Errorf("failed to parse config: %s", err) | ||
} | ||
return cfg, nil | ||
} | ||
|
||
type MultiCallConfig struct { | ||
Mappings []MultiCallMapping `json:"mappings"` | ||
} | ||
|
||
type MultiCallMapping struct { | ||
Prefix string `json:"prefix"` | ||
Bidder string `json:"bidder"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package multi | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestProcessingMspFB(t *testing.T) { | ||
targeting := map[string]string{ | ||
"hb_bidder": "msp_fb_alpha", | ||
"hb_bidder_msp_fb_alp": "msp_fb_alpha", | ||
"hb_cache_host": "prebid-cache.newsbreak.com", | ||
"hb_cache_host_msp_fb": "prebid-cache.newsbreak.com", | ||
"hb_cache_id": "a314c09e-3cf8-4c87-8fe4-2cc09cbbf09a", | ||
"hb_cache_id_msp_fb_a": "a314c09e-3cf8-4c87-8fe4-2cc09cbbf09a", | ||
"hb_cache_path": "/cache", | ||
"hb_cache_path_msp_fb": "/cache", | ||
"hb_env": "mobile-app", | ||
"hb_env_msp_fb_alpha": "mobile-app", | ||
"hb_pb": "20.00", | ||
"hb_pb_msp_fb_alpha": "20.00", | ||
} | ||
multiCallBidder := "msp_fb_alpha" | ||
originBidder := "audienceNetwork" | ||
actual := modifyTargeting(targeting, multiCallBidder, originBidder) | ||
|
||
expected := map[string]string{ | ||
"hb_bidder": "audienceNetwork", | ||
"hb_bidder_audienceNe": "audienceNetwork", | ||
"hb_cache_host": "prebid-cache.newsbreak.com", | ||
"hb_cache_host_audien": "prebid-cache.newsbreak.com", | ||
"hb_cache_id": "a314c09e-3cf8-4c87-8fe4-2cc09cbbf09a", | ||
"hb_cache_id_audience": "a314c09e-3cf8-4c87-8fe4-2cc09cbbf09a", | ||
"hb_cache_path": "/cache", | ||
"hb_cache_path_audien": "/cache", | ||
"hb_env": "mobile-app", | ||
"hb_env_audienceNetwo": "mobile-app", | ||
"hb_pb": "20.00", | ||
"hb_pb_audienceNetwor": "20.00", | ||
} | ||
if !reflect.DeepEqual(expected, actual) { | ||
t.Errorf("Failed to get expected targeting\n, expected = %+#v\n, actual = %+#v\n", expected, actual) | ||
} | ||
} | ||
|
||
func TestProcessingMspNova(t *testing.T) { | ||
targeting := map[string]string{ | ||
"hb_bidder": "msp_nova_alpha", | ||
"hb_bidder_msp_nova_a": "msp_nova_alpha", | ||
"hb_cache_host": "prebid-cache.newsbreak.com", | ||
"hb_cache_host_msp_no": "prebid-cache.newsbreak.com", | ||
"hb_cache_id": "a314c09e-3cf8-4c87-8fe4-2cc09cbbf09a", | ||
"hb_cache_id_msp_nova": "a314c09e-3cf8-4c87-8fe4-2cc09cbbf09a", | ||
"hb_cache_path": "/cache", | ||
"hb_cache_path_msp_no": "/cache", | ||
"hb_env": "mobile-app", | ||
"hb_env_msp_nova_alph": "mobile-app", | ||
"hb_pb": "20.00", | ||
"hb_pb_msp_nova_alpha": "20.00", | ||
} | ||
multiCallBidder := "msp_nova_alpha" | ||
originBidder := "msp_nova" | ||
actual := modifyTargeting(targeting, multiCallBidder, originBidder) | ||
|
||
expected := map[string]string{ | ||
"hb_bidder": "msp_nova", | ||
"hb_bidder_msp_nova": "msp_nova", | ||
"hb_cache_host": "prebid-cache.newsbreak.com", | ||
"hb_cache_host_msp_no": "prebid-cache.newsbreak.com", | ||
"hb_cache_id": "a314c09e-3cf8-4c87-8fe4-2cc09cbbf09a", | ||
"hb_cache_id_msp_nova": "a314c09e-3cf8-4c87-8fe4-2cc09cbbf09a", | ||
"hb_cache_path": "/cache", | ||
"hb_cache_path_msp_no": "/cache", | ||
"hb_env": "mobile-app", | ||
"hb_env_msp_nova": "mobile-app", | ||
"hb_pb": "20.00", | ||
"hb_pb_msp_nova": "20.00", | ||
} | ||
if !reflect.DeepEqual(expected, actual) { | ||
t.Errorf("Failed to get expected targeting\n, expected = %+#v\n, actual = %+#v\n", expected, actual) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
endpoint: "https://business.newsbreak.com/api/ads" | ||
disabled: true | ||
maintainer: | ||
email: "han.xiang@newsbreak.com" | ||
capabilities: | ||
app: | ||
mediaTypes: | ||
- banner | ||
- video | ||
- native | ||
site: | ||
mediaTypes: | ||
- banner | ||
- video | ||
- native |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
endpoint: "https://business.newsbreak.com/api/ads" | ||
disabled: true | ||
maintainer: | ||
email: "han.xiang@newsbreak.com" | ||
capabilities: | ||
app: | ||
mediaTypes: | ||
- banner | ||
- video | ||
- native | ||
site: | ||
mediaTypes: | ||
- banner | ||
- video | ||
- native |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
endpoint: "https://business.newsbreak.com/api/ads" | ||
disabled: true | ||
maintainer: | ||
email: "han.xiang@newsbreak.com" | ||
capabilities: | ||
app: | ||
mediaTypes: | ||
- banner | ||
- video | ||
- native | ||
site: | ||
mediaTypes: | ||
- banner | ||
- video | ||
- native |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Nova Adapter Params", | ||
"description": "A schema which validates params accepted by the Nova adapter", | ||
"type": "object", | ||
"properties": { | ||
"ad_unit": { | ||
"type": "string", | ||
"description": "Nova ad unit" | ||
} | ||
}, | ||
"required": ["ad_unit"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Nova Adapter Params", | ||
"description": "A schema which validates params accepted by the Nova adapter", | ||
"type": "object", | ||
"properties": { | ||
"ad_unit": { | ||
"type": "string", | ||
"description": "Nova ad unit" | ||
} | ||
}, | ||
"required": ["ad_unit"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Nova Adapter Params", | ||
"description": "A schema which validates params accepted by the Nova adapter", | ||
"type": "object", | ||
"properties": { | ||
"ad_unit": { | ||
"type": "string", | ||
"description": "Nova ad unit" | ||
} | ||
}, | ||
"required": ["ad_unit"] | ||
} |