@@ -20,8 +20,10 @@ Using bundler:
2020
2121### Configure your access credentials
2222
23- Intercom.app_id = "my_app_iddd"
24- Intercom.api_key = "my-super-crazy-api-key"
23+ ``` ruby
24+ Intercom .app_id = " my_app_id"
25+ Intercom .api_key = " my-super-crazy-api-key"
26+ ```
2527
2628### Resources
2729
@@ -35,44 +37,55 @@ The API supports:
3537### Examples
3638
3739#### Users
38- user = Intercom::User.find_by_email("[email protected] ") 39- user.custom_data["average_monthly_spend"] = 1234.56
40- user.save
41- user = Intercom::User.find_by_user_id("[email protected] ") 42- user = Intercom::User.create(:email => "[email protected] ", :name => "Bob Smith") 43- user = Intercom::User.new(params)
44- user.save
45- Intercom::User.all.count
46- Intercom::User.all.each {|user| puts %Q(#{user.email} - #{user.custom_data["average_monthly_spend"]}) }
47- Intercom::User.all.map {|user| user.email }
40+
41+ ``` ruby
42+ user
= Intercom ::
User .find_by_email(
" [email protected] " )
43+ user.custom_data[" average_monthly_spend" ] = 1234.56
44+ user.save
45+ user
= Intercom ::
User .find_by_user_id(
" [email protected] " )
46+ user
= Intercom ::
User .create(
:email =>
" [email protected] " ,
:name =>
" Bob Smith" )
47+ user = Intercom ::User .new (params)
48+ user.save
49+ Intercom ::User .all.count
50+ Intercom ::User .all.each {|user | puts %Q( #{ user.email } - #{ user.custom_data[" average_monthly_spend" ] } ) }
51+ Intercom ::User .all.map {|user | user.email }
52+ ```
4853
4954#### Companies
50- user = Intercom::User.find_by_email("[email protected] ") 51- user.company = {:id => 6, :name => "Intercom"}
52- user.companies = [{:id => 6, :name => "Intercom"}, {:id => 9, :name => "Test Company"}]
55+ ``` ruby
56+ user
= Intercom ::
User .find_by_email(
" [email protected] " )
57+ user.company = {:id => 6 , :name => " Intercom" }
58+ user.companies = [{:id => 6 , :name => " Intercom" }, {:id => 9 , :name => " Test Company" }]
59+ ```
5360
5461You can also pass custom data within a company:
5562
56- user.company = {:id => 6, :name => "Intercom", :referral_source => "Google"}
63+ ``` ruby
64+ user.company = {:id => 6 , :name => " Intercom" , :referral_source => " Google" }
65+ ```
5766
5867#### Message Threads
59-
60- Intercom::MessageThread.create(:email => "[email protected] ", :body => "Example message from [email protected] to your application on Intercom.") 61- Intercom::MessageThread.find(:email => "[email protected] ", :thread_id => 123) 62- Intercom::MessageThread.find_all(:email => "[email protected] ") 63- Intercom::MessageThread.mark_as_read(:email => "[email protected] ", :thread_id => 123) 68+ ``` ruby
69+ Intercom ::
MessageThread .create(
:email =>
" [email protected] " ,
:body =>
" Example message from [email protected] to your application on Intercom." )
70+ Intercom ::
MessageThread .find(
:email =>
" [email protected] " ,
:thread_id =>
123 )
71+ Intercom ::
MessageThread .find_all(
:email =>
" [email protected] " )
72+ Intercom ::
MessageThread .mark_as_read(
:email =>
" [email protected] " ,
:thread_id =>
123 )
73+ ```
6474
6575#### Impressions
66-
67- Intercom::Impression.create(:email => "[email protected] ", :location => "/path/in/my/app", :user_ip => "1.2.3.4", :user_agent => "my-savage-iphone-app-0.1" 76+ ``` ruby
77+ Intercom ::
Impression .create(
:email =>
" [email protected] " ,
:location =>
" /path/in/my/app" ,
:user_ip =>
" 1.2.3.4" ,
:user_agent =>
" my-savage-iphone-app-0.1" 78+ ```
6879
6980#### Notes
70-
71- Intercom::Note.create(:email => "[email protected] ", :body => "This is the text of the note") 81+ ``` ruby
82+ Intercom ::
Note .create(
:email =>
" [email protected] " ,
:body =>
" This is the text of the note" )
83+ ```
7284
7385### Errors
74-
75- Intercom::AuthenticationError
76- Intercom::ServerError
77- Intercom::ServiceUnavailableError
78- Intercom::ResourceNotFound
86+ ``` ruby
87+ Intercom ::AuthenticationError
88+ Intercom ::ServerError
89+ Intercom ::ServiceUnavailableError
90+ Intercom ::ResourceNotFound
91+ ```
0 commit comments