File tree 4 files changed +15
-0
lines changed
4 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,9 @@ contact.create_note(body: "<p>Text for the note</p>")
125
125
# List notes for a contact
126
126
contact.notes.each {|n | p n.body}
127
127
128
+ # List segments for a contact
129
+ contact.segments.each {|segment | p segment.name}
130
+
128
131
# Add a contact to a company
129
132
company = intercom.companies.find(id: " 123" )
130
133
contact.add_company(id: company.id)
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ class Contact
13
13
nested_resource_methods :tag , operations : %i[ add delete list ]
14
14
nested_resource_methods :note , operations : %i[ create list ]
15
15
nested_resource_methods :company , operations : %i[ add delete list ]
16
+ nested_resource_methods :segment , operations : %i[ list ]
16
17
17
18
def self . collection_proxy_class
18
19
Intercom ::BaseCollectionProxy
Original file line number Diff line number Diff line change 3
3
module Intercom
4
4
class Segment
5
5
include Traits ::ApiResource
6
+
7
+ def self . collection_proxy_class
8
+ Intercom ::BaseCollectionProxy
9
+ end
6
10
end
7
11
end
Original file line number Diff line number Diff line change 285
285
_ ( proxy . resource_class ) . must_equal Intercom ::Note
286
286
end
287
287
288
+ it 'returns a collection proxy for listing segments' do
289
+ proxy = contact . segments
290
+ _ ( proxy . resource_name ) . must_equal 'segments'
291
+ _ ( proxy . url ) . must_equal '/contacts/1/segments'
292
+ _ ( proxy . resource_class ) . must_equal Intercom ::Segment
293
+ end
294
+
288
295
it 'returns a collection proxy for listing tags' do
289
296
proxy = contact . tags
290
297
_ ( proxy . resource_name ) . must_equal 'tags'
You can’t perform that action at this time.
0 commit comments