Skip to content

Commit 428f6c4

Browse files
author
Suma Prakash
committed
Updating the readme and url for subscriptions
1 parent 319f3e3 commit 428f6c4

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ https://api.intercom.io/jobs
8282
https://api.intercom.io/articles
8383
https://api.intercom.io/help_center/collections
8484
https://api.intercom.io/help_center/sections
85+
https://api.intercom.io/phone_call_redirects
86+
https://api.intercom.io/subscription_types
87+
https://api.intercom.io/export/content/data
8588
```
8689

8790
### Examples
@@ -115,7 +118,7 @@ intercom.contacts.unarchive(contact)
115118
intercom.contacts.delete(contact)
116119

117120
# Deletes an archived contact permanently
118-
contact.delete_archived_contact("124")
121+
intercom.contacts.delete_archived_contact(contact.id)
119122

120123
# List all contacts
121124
contacts = intercom.contacts.all
@@ -167,13 +170,13 @@ contact.remove_company(id: company.id)
167170
contact.companies.each {|c| p c.name}
168171

169172
# attach a subscription_types on a contact
170-
contact.create_subscription_types(id: '1')
173+
contact.create_subscription_types(id: subscription_type.id)
171174

172175
# List subscription_types for a contact
173-
contact.subscription_types.each {|n| p n.body}
176+
contact.subscription_types.each {|n| p n.id}
174177

175178
# Remove subscription_types
176-
contact.remove_subscription_type({ "id": subscription.id })
179+
contact.remove_subscription_type({ "id": subscription_type.id })
177180

178181
```
179182

@@ -609,7 +612,7 @@ intercom.subscriptions.all
609612

610613
#### Subscription Types
611614

612-
Subscribe to events in Intercom to receive webhooks.
615+
List all the subscription types that a contact can opt in to
613616

614617
```ruby
615618

@@ -731,14 +734,14 @@ redirect = intercom.phone_call_redirect.create(phone_number: "+353871234567")
731734

732735
```ruby
733736
# Create a data export
734-
export = intercom.data_content_export.create(created_at_after: 1667566801, created_at_before: 1668085202)
737+
export = intercom.export_content.create(created_at_after: 1667566801, created_at_before: 1668085202)
735738

736739

737740
#View a data export
738-
export = intercom.data_content_export.find(id: 'k0e27ohsyvh8ef3m')
741+
export = intercom.export_content.find(id: 'k0e27ohsyvh8ef3m')
739742

740743
# Cancel a data export
741-
export = intercom.data_content_export.cancel('k0e27ohsyvh8ef3m')
744+
export = intercom.export_content.cancel('k0e27ohsyvh8ef3m')
742745

743746
```
744747

lib/intercom/contact.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Contact
1212

1313
nested_resource_methods :tag, operations: %i[add delete list]
1414
nested_resource_methods :note, operations: %i[create list]
15-
nested_resource_methods :subscription_type, operations: %i[create delete list]
15+
nested_resource_methods :subscription_type, path: 'subscriptions', operations: %i[create delete list]
1616
nested_resource_methods :company, operations: %i[add delete list]
1717
nested_resource_methods :segment, operations: %i[list]
1818

spec/unit/intercom/contact_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@
346346
end
347347

348348
it 'removes a subscription to a contact' do
349-
client.expects(:delete).with("/contacts/1/subscription_types/#{subscription.id}", "id": subscription.id).returns(subscription.to_hash)
349+
client.expects(:delete).with("/contacts/1/subscriptions/#{subscription.id}", "id": subscription.id).returns(subscription.to_hash)
350350
contact.remove_subscription_type({ "id": subscription.id })
351351
end
352352

@@ -400,7 +400,7 @@
400400
end
401401

402402
it 'adds a subscription to a contact' do
403-
client.expects(:post).with('/contacts/1/subscription_types', "id": subscription.id).returns(subscription.to_hash)
403+
client.expects(:post).with('/contacts/1/subscriptions', "id": subscription.id).returns(subscription.to_hash)
404404
contact.create_subscription_type({ "id": subscription.id })
405405
end
406406

0 commit comments

Comments
 (0)