Skip to content
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

Created new route offer-info #12

Merged
merged 2 commits into from
Apr 28, 2017
Merged

Created new route offer-info #12

merged 2 commits into from
Apr 28, 2017

Conversation

andrehp
Copy link
Contributor

@andrehp andrehp commented Apr 28, 2017

This new route retrieves contents and metadata information
about an offer instance already seen by the player.

This new route retrieves contents and metadata information
about an offer instance already seen by the player.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 89.153% when pulling 8701bfc on feature/routeOfferInfo into 59802c7 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 89.153% when pulling 8701bfc on feature/routeOfferInfo into 59802c7 on master.

Copy link
Contributor

@cscatolini cscatolini left a comment

Choose a reason for hiding this comment

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

Just fix the 404/500 thing and some minor details and we'll be good to go.

if playerID == "" {
err := fmt.Errorf("The player-id parameter cannot be empty")
logger.WithError(err).Error("Failed to retrieve offer for player.")
h.App.HandleError(w, http.StatusBadRequest, "The player-id parameter cannot be empty.", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

h.App.HandleError(w, http.StatusBadRequest, err.Error(), err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Much better, will fix all of these problems

} else if gameID == "" {
err := fmt.Errorf("The game-id parameter cannot be empty")
logger.WithError(err).Error("Failed to retrieve offer for player.")
h.App.HandleError(w, http.StatusBadRequest, "The game-id parameter cannot be empty.", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

h.App.HandleError(w, http.StatusBadRequest, err.Error(), err)

} else if offerInstanceID == "" {
err := fmt.Errorf("The offer-id parameter cannot be empty")
logger.WithError(err).Error("Failed to retrieve offer for player.")
h.App.HandleError(w, http.StatusBadRequest, "The offer-id parameter cannot be empty.", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

h.App.HandleError(w, http.StatusBadRequest, err.Error(), err)

return err
})

if err != nil {
Copy link
Contributor

@cscatolini cscatolini Apr 28, 2017

Choose a reason for hiding this comment

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

I think there is an specific error if GetOfferInfo can't find the offer for the given player. In this case you should respond with 404 instead of 500.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, will fix!

}
```
* Header:
A max-age header is sent to indicate how long the response returned by get available offers can be cached.
Copy link
Contributor

Choose a reason for hiding this comment

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

... returned by get offer info can be cached.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

QueryStruct(&offerInstance)
})

err = HandleNotFoundError("OfferInstance", map[string]interface{}{
Copy link
Contributor

Choose a reason for hiding this comment

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

here it is!

@coveralls
Copy link

coveralls commented Apr 28, 2017

Coverage Status

Coverage increased (+0.06%) to 89.173% when pulling 96ad320 on feature/routeOfferInfo into 59802c7 on master.

@andrehp
Copy link
Contributor Author

andrehp commented Apr 28, 2017

@cscatolini I made the requested changes, can you take another look?

Copy link
Contributor

@cscatolini cscatolini left a comment

Choose a reason for hiding this comment

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

Great! Thanks for your contribution

@cscatolini cscatolini merged commit ce8d3c1 into master Apr 28, 2017
@cscatolini cscatolini deleted the feature/routeOfferInfo branch April 28, 2017 17:42
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.

3 participants