File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,16 @@ def merge(lead, user)
3333 user . from_response ( response )
3434 end
3535
36+ def archive ( contact )
37+ @client . post ( "/#{ collection_name } /#{ contact . id } /archive" , { } )
38+ contact
39+ end
40+
41+ def unarchive ( contact )
42+ @client . post ( "/#{ collection_name } /#{ contact . id } /unarchive" , { } )
43+ contact
44+ end
45+
3646 private def raise_invalid_merge_error
3747 raise Intercom ::InvalidMergeError , 'Merging can only be performed on a lead into a user'
3848 end
Original file line number Diff line number Diff line change 248248 client . contacts . delete ( contact )
249249 end
250250
251+ it 'archives a contact' do
252+ contact = Intercom ::Contact . new ( 'id' => '1' )
253+ client . expects ( :post ) . with ( '/contacts/1/archive' , { } )
254+ client . contacts . archive ( contact )
255+ end
256+
257+ it 'unarchives a contact' do
258+ contact = Intercom ::Contact . new ( 'id' => '1' )
259+ client . expects ( :post ) . with ( '/contacts/1/unarchive' , { } )
260+ client . contacts . unarchive ( contact )
261+ end
262+
251263 describe 'merging' do
252264 let ( :lead ) { Intercom ::Contact . from_api ( external_id : 'contact_id' , role : 'lead' ) }
253265 let ( :user ) { Intercom ::Contact . from_api ( id : 'external_id' , role : 'user' ) }
You can’t perform that action at this time.
0 commit comments