Skip to content

UOE-12550: Adding placementid support for Nativo #1105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

PubMatic-OpenWrap
Copy link
Owner

Description

Please add change description or link to ticket, docs, etc.

Checklist:

  • PR commit list is unique (rebase/pull with the origin branch to keep master clean).
  • JIRA number is added in the PR title and the commit message.
  • Updated the header-bidding repo with appropiate commit id.
  • Documented the new changes.

For Prebid upgrade, refer: https://inside.pubmatic.com:8443/confluence/display/Products/Prebid-server+upgrade

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, d3f1d73

nativo

Refer here for heat map coverage report

github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:27:	Builder			100.0%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:34:	MakeRequests		83.3%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:81:	MakeBids		94.4%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:118:	getMediaTypeForImp	100.0%
total:										(statements)		91.5%

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 78c63d0

nativo

Refer here for heat map coverage report

github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:27:	Builder			100.0%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:34:	MakeRequests		83.3%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:84:	MakeBids		94.4%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:121:	getMediaTypeForImp	100.0%
total:										(statements)		91.5%


for i := range request.Imp {

imp := &request.Imp[i]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need additional variable declaration, if we access by index then it will be pass by reference

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing the request.imp directly and later updating the imp.ext changes the original incoming request.

@@ -807,3 +807,14 @@ func builderOpenweb(params BidderParameters) (json.RawMessage, error) {
jsonStr.WriteByte('}')
return jsonStr.Bytes(), nil
}

func builderNativo(params BidderParameters) (json.RawMessage, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be rewritten as

func builderNativo(params BidderParameters) (json.RawMessage, error) {
	if pid, ok := getInt(params.FieldMap["placementId"]); !ok || pid == 0 {
		return nil, fmt.Errorf(errMandatoryParameterMissingFormat, params.AdapterName, "placementId")
	}

	jsonStr := bytes.Buffer{}
	fmt.Fprintf(&jsonStr, `{"placementid":"%d"}`, pid)
	return jsonStr.Bytes(), nil
}

@@ -807,3 +807,14 @@ func builderOpenweb(params BidderParameters) (json.RawMessage, error) {
jsonStr.WriteByte('}')
return jsonStr.Bytes(), nil
}

func builderNativo(params BidderParameters) (json.RawMessage, error) {
jsonStr := bytes.Buffer{}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: We can use bytes.NewBuffer() to create a new buffer

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 6991ccd

nativo

Refer here for heat map coverage report

github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:27:	Builder			100.0%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:34:	MakeRequests		83.3%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:84:	MakeBids		94.4%
github.com/PubMatic-OpenWrap/prebid-server/v3/adapters/nativo/nativo.go:121:	getMediaTypeForImp	100.0%
total:										(statements)		91.5%

@pm-isha-bharti
Copy link
Collaborator

Closing as PR is raised via Pubmatic-openwrap account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants