Skip to content

Commit

Permalink
Add rate support
Browse files Browse the repository at this point in the history
  • Loading branch information
orbyone committed May 11, 2014
1 parent 2a5becf commit f62a40e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sensible.PredictionIO.NET/UserAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class Actions

public string Action { get; set; }

public int Rate { get; set; }

public List<double> Coordinates { get; set; }
}
}
4 changes: 4 additions & 0 deletions Sensible.PredictionIO.NET/UserActionRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public RestClient Build()
RestRequest.AddParameter("pio_action", _userAction.Action);
RestRequest.AddParameter("pio_uid", _userAction.UserId);
RestRequest.AddParameter("pio_iid", _userAction.ItemId);
if (_userAction.Action == UserAction.Actions.Rate && _userAction.Rate >= 1 && _userAction.Rate <= 5)
{
RestRequest.AddParameter("pio_rate", _userAction.Rate);
}
if (_userAction.Coordinates != null && _userAction.Coordinates.Count == 2)
{
RestRequest.AddParameter("pio_latlng", string.Format("{0},{1}", _userAction.Coordinates[0].ToString(CultureInfo.InvariantCulture), _userAction.Coordinates[1].ToString(CultureInfo.InvariantCulture)));
Expand Down

0 comments on commit f62a40e

Please sign in to comment.