Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/drip/client/shopper_activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def create_cart_activity_event(data = {})
end

data[:occurred_at] = Time.now.iso8601 unless data.key?(:occurred_at)
make_json_request :post, "v3/#{account_id}/shopper_activity/cart", data
make_json_request :post, "v3/#{account_id}/shopper_activity/cart", data.to_json
end

# Public: Create an order activity event.
Expand All @@ -36,7 +36,7 @@ def create_order_activity_event(data = {})
end

data[:occurred_at] = Time.now.iso8601 unless data.key?(:occurred_at)
make_json_request :post, "v3/#{account_id}/shopper_activity/order", data
make_json_request :post, "v3/#{account_id}/shopper_activity/order", data.to_json
end

# Public: Create a batch of order activity events.
Expand All @@ -57,7 +57,7 @@ def create_order_activity_events(records = [])
record[:occurred_at] = Time.now.iso8601 unless record.key?(:occurred_at)
end

make_json_request :post, "v3/#{account_id}/shopper_activity/order/batch", { orders: records }
make_json_request :post, "v3/#{account_id}/shopper_activity/order/batch", { orders: records.to_json }
end

# Public: Create a product activity event.
Expand All @@ -73,7 +73,7 @@ def create_product_activity_event(data = {})
end

data[:occurred_at] = Time.now.iso8601 unless data.key?(:occurred_at)
make_json_request :post, "v3/#{account_id}/shopper_activity/product", data
make_json_request :post, "v3/#{account_id}/shopper_activity/product", data.to_json
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/drip/client/shopper_activity_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def setup
end

should "send the right request" do
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
expected = Drip::Response.new(@response_status, @response_body.to_json)
assert_equal expected, @client.create_cart_activity_event(@options)
end

Expand Down Expand Up @@ -84,7 +84,7 @@ def setup
end

should "send the right request" do
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
expected = Drip::Response.new(@response_status, @response_body.to_json)
assert_equal expected, @client.create_order_activity_event(@options)
end

Expand Down Expand Up @@ -137,7 +137,7 @@ def setup
end

should "send the right request" do
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
expected = Drip::Response.new(@response_status, @response_body.to_json)
assert_equal expected, @client.create_order_activity_events(@records)
end

Expand Down Expand Up @@ -177,7 +177,7 @@ def setup
end

should "send the right request" do
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
expected = Drip::Response.new(@response_status, @response_body.to_json)
assert_equal expected, @client.create_product_activity_event(@options)
end

Expand Down