Sha256: e4f7dd739be6348a05f8febd45e648b25b904ffb24f259f141d00d70872d0072

Contents?: true

Size: 1.87 KB

Versions: 5

Compression:

Stored size: 1.87 KB

Contents

Ruby bindings for the Intercom API (https://api.intercom.io). See http://docs.intercom.io/api for more details.

Yardoc is available at http://rubydoc.info/github/intercom/intercom-ruby/master/frames

For generating Intercom javascript script tags, please see https://github.com/intercom/intercom-rails

== Installation
    gem install intercom

Using bundler:

    gem 'intercom'

== Basic Usage

=== Configure your access credentials

    Intercom.app_id = "my_app_iddd"
    Intercom.api_key = "my-super-crazy-api-key"

=== Resources

The API supports:

    POST,PUT,GET https://api.intercom.io/v1/users
    POST,PUT,GET https://api.intercom.io/v1/users/messages
    POST https://api.intercom.io/v1/users/impressions

=== Examples:

==== Users
    user = Intercom::User.find_by_email("bob@example.com")
    user.custom_data["average_monthly_spend"] = 1234.56
    user.save
    user = Intercom::User.find_by_user_id("bob@example.com")
    user = Intercom::User.create(:email => "bob@example.com", :name => "Bob Smith")
    user = Intercom::User.new(params)
    user.save
    Intercom::User.all.count
    Intercom::User.all.each {|user| puts %Q(#{user.email} - #{user.custom_data["average_monthly_spend"]}) }
    Intercom::User.all.map {|user| user.email }


==== Messages

    Intercom::Message.create(:email => "bob@example.com", :body => "Example message from bob@example.com to your application on Intercom.")
    Intercom::Message.find(:email => "bob@example.com", :thread_id => 123)
    Intercom::Message.find_all(:email => "bob@example.com")
    Intercom::Message.mark_as_read(:email => "bob@example.com", :thread_id => 123)

==== Impressions

    Intercom::Impression.create(:email => "bob@example.com", :location => "/path/in/my/app", :user_ip => "1.2.3.4", :user_agent => "my-savage-iphone-app-0.1"

=== Errors

    Intercom::AuthenticationError
    Intercom::ServerError
    Intercom::ResourceNotFound

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
intercom-0.0.10 README.rdoc
intercom-0.0.9 README.rdoc
intercom-0.0.8 README.rdoc
intercom-0.0.7 README.rdoc
intercom-0.0.6 README.rdoc