README.md in intercom-3.5.12 vs README.md in intercom-3.5.14

- old
+ new

@@ -52,11 +52,10 @@ https://api.intercom.io/events https://api.intercom.io/conversations https://api.intercom.io/messages https://api.intercom.io/subscriptions https://api.intercom.io/jobs - https://api.intercom.io/bulk ### Examples #### Users @@ -98,20 +97,10 @@ # you can then use to request the next 100 users. Note that the scroll parameter will time out after one minute and you will need to # make a new request result.scroll_param => "0730e341-63ef-44da-ab9c-9113f886326d" result = intercom.users.scroll.next("0730e341-63ef-44da-ab9c-9113f886326d"); - -#Bulk operations. -# Submit bulk job to create users. If any of the items in create_items match an existing user that user will be updated -intercom.users.submit_bulk_job(create_items: [{user_id: "25", email: "alice@example.com"}, {user_id: "25", email: "bob@example.com"}]) -# Submit bulk job to create users with companies. Companies must be sent as an array of objects nested within each applicable user object -intercom.users.submit_bulk_job(create_items: [{user_id: "25", email: "alice@example.com", companies: [{company_id: 9, name: "Test Company"}]}]) -# Submit bulk job, to delete users -intercom.users.submit_bulk_job(delete_items: [{user_id: "25", email: "alice@example.com"}, {user_id: "25", email: "bob@example.com"}]) -# Submit bulk job, to add items to existing job -intercom.users.submit_bulk_job(create_items: [{user_id: "25", email: "alice@example.com"}], delete_items: [{user_id: "25", email: "bob@example.com"}], job_id:'job_abcd1234') ``` #### Admins ```ruby # Find access token owner (only with Personal Access Token and OAuth) @@ -187,11 +176,11 @@ intercom.conversations.find_all(type: 'admin', id: '7').each {|convo| ... } # Iterate over all open conversations assigned to an admin intercom.conversations.find_all(type: 'admin', id: 7, open: true).each {|convo| ... } # Iterate over closed conversations assigned to an admin intercom.conversations.find_all(type: 'admin', id: 7, open: false).each {|convo| ... } -# Iterate over closed conversations for assigned an admin, before a certain moment in time +# Iterate over closed conversations which are assigned to an admin, and where updated_at is before a certain moment in time intercom.conversations.find_all(type: 'admin', id: 7, open: false, before: 1374844930).each {|convo| ... } # FINDING CONVERSATIONS FOR A USER # Iterate over all conversations (read + unread, correct) with a user based on the users email intercom.conversations.find_all(email: 'joe@example.com', type: 'user').each {|convo| ... } @@ -360,58 +349,10 @@ - order_number: a Rich Link (value contains 'url' and 'value' keys) - price: An Amount in US Dollars (value contains 'amount' and 'currency' keys) *NB:* This version of the gem reserves the field name `type` in Event data. -Bulk operations. -```ruby -# Submit bulk job, to create events -intercom.events.submit_bulk_job(create_items: [ - { - event_name: "ordered-item", - created_at: 1438944980, - user_id: "314159", - metadata: { - order_date: 1438944980, - stripe_invoice: "inv_3434343434" - } - }, - { - event_name: "invited-friend", - created_at: 1438944979, - user_id: "314159", - metadata: { - invitee_email: "pi@example.org", - invite_code: "ADDAFRIEND" - } - } -]) - - -# Submit bulk job, to add items to existing job -intercom.events.submit_bulk_job(create_items: [ - { - event_name: "ordered-item", - created_at: 1438944980, - user_id: "314159", - metadata: { - order_date: 1438944980, - stripe_invoice: "inv_3434343434" - } - }, - { - event_name: "invited-friend", - created_at: 1438944979, - user_id: "314159", - metadata: { - invitee_email: "pi@example.org", - invite_code: "ADDAFRIEND" - } - } -], job_id:'job_abcd1234') -``` - ### Contacts `Contacts` represent logged out users of your application. ```ruby @@ -451,20 +392,15 @@ intercom.subscriptions.create(url: "http://example.com", topics: ["user.created"]) # fetch a subscription intercom.subscriptions.find(id: "nsub_123456789") +# delete a subscription +subscription = intercom.subscriptions.find(id: "nsub_123456789") +intercom.subscriptions.delete(subscription) + # list subscriptions intercom.subscriptions.all -``` -### Bulk jobs - -```ruby -# fetch a job -intercom.jobs.find(id: 'job_abcd1234') - -# fetch a job's error feed -intercom.jobs.errors(id: 'job_abcd1234') ``` ### Errors There are different styles for error handling - some people prefer exceptions; some prefer nil and check; some prefer error objects/codes. Balancing these preferences alongside our wish to provide an idiomatic gem has brought us to use the current mechanism of throwing specific exceptions. Our approach in the client is to propagate errors and signal our failure loudly so that erroneous data does not get propagated through our customers' systems - in other words, if you see a `Intercom::ServiceUnavailableError` you know where the problem is.