File tree Expand file tree Collapse file tree 4 files changed +15
-0
lines changed
Expand file tree Collapse file tree 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>")
125125# List notes for a contact
126126contact.notes.each {|n | p n.body}
127127
128+ # List segments for a contact
129+ contact.segments.each {|segment | p segment.name}
130+
128131# Add a contact to a company
129132company = intercom.companies.find(id: " 123" )
130133contact.add_company(id: company.id)
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ class Contact
1313 nested_resource_methods :tag , operations : %i[ add delete list ]
1414 nested_resource_methods :note , operations : %i[ create list ]
1515 nested_resource_methods :company , operations : %i[ add delete list ]
16+ nested_resource_methods :segment , operations : %i[ list ]
1617
1718 def self . collection_proxy_class
1819 Intercom ::BaseCollectionProxy
Original file line number Diff line number Diff line change 33module Intercom
44 class Segment
55 include Traits ::ApiResource
6+
7+ def self . collection_proxy_class
8+ Intercom ::BaseCollectionProxy
9+ end
610 end
711end
Original file line number Diff line number Diff line change 285285 _ ( proxy . resource_class ) . must_equal Intercom ::Note
286286 end
287287
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+
288295 it 'returns a collection proxy for listing tags' do
289296 proxy = contact . tags
290297 _ ( proxy . resource_name ) . must_equal 'tags'
You can’t perform that action at this time.
0 commit comments