We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4cf9c6 commit ce22a72Copy full SHA for ce22a72
lib/intercom/service/count.rb
@@ -15,7 +15,9 @@ def for_app
15
end
16
17
def for_type(type:, count: nil)
18
- find(type: type, count: count)
+ params = {type: type}
19
+ params[:count] = count if count
20
+ find(params)
21
22
23
spec/unit/intercom/count_spec.rb
@@ -14,4 +14,10 @@
14
counts = client.counts.for_type(type: 'user', count: 'segment')
counts.user['segment'][4]["segment 1"].must_equal(1)
+
+ it 'should not include count param when nil' do
+ client.expects(:get).with("/counts", {type: 'conversation'}).returns(test_segment_count)
+ counts = client.counts.for_type(type: 'conversation')
+ counts.user['segment'][4]["segment 1"].must_equal(1)
+ end
0 commit comments