Skip to content

Commit

Permalink
ensure requests to apply decision include time (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaoruDev authored Jun 19, 2017
1 parent 07af653 commit 3f38f76
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
13 changes: 11 additions & 2 deletions lib/sift/client/decision/apply_to.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ module Sift
class Client
class Decision
class ApplyTo
PROPERTIES = %w{ source analyst description order_id user_id account_id }
PROPERTIES = %w{
source
analyst
description
order_id
user_id
account_id
time
}

attr_reader :decision_id, :configs, :getter, :api_key

Expand Down Expand Up @@ -57,7 +65,8 @@ def request_body
source: source,
description: description,
analyst: analyst,
decision_id: decision_id
decision_id: decision_id,
time: time
}
end

Expand Down
13 changes: 10 additions & 3 deletions spec/unit/client/decision/apply_to_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ class Decision
source: "manual",
analyst: "[email protected]",
description: "be blocking errrday allday",
decision: decision,
user_id: "user_1234"
user_id: "user_1234",
time: 1234,
fake_param: "this should not exist"
}

applier = ApplyTo.new(api_key, decision_id, configs)
request_body = MultiJson.dump(applier.send(:request_body))
request_body = MultiJson.dump({
source: configs[:source],
description: configs[:description],
analyst: configs[:analyst],
decision_id: decision_id,
time: 1234
})

response_body = {
"entity" => {
Expand Down

0 comments on commit 3f38f76

Please sign in to comment.