intercom 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1 +1,49 @@
1
- Ruby bindings for the Intercom API.
1
+ Ruby bindings for the Intercom API (https://api.intercom.io). See http://docs.intercom.io/api for more details.
2
+
3
+ Yardoc is available at http://rubydoc.info/github/intercom/intercom-ruby/master/frames
4
+
5
+ == Installation
6
+ gem install intercom
7
+
8
+ Using bundler:
9
+
10
+ gem 'intercom'
11
+
12
+ == Basic Usage
13
+
14
+ === Configure your access credentials
15
+
16
+ Intercom.app_id = "my_app_iddd"
17
+ Intercom.api_key = "my-super-crazy-api-key"
18
+
19
+ === Resources
20
+
21
+ The API supports:
22
+
23
+ POST,PUT,GET https://api.intercom.io/v1/users
24
+ POST,PUT,GET https://api.intercom.io/v1/users/messages
25
+ POST https://api.intercom.io/v1/users/impressions
26
+
27
+ ==== Users
28
+
29
+ user = Intercom::User.find(:email => "bob@example.com")
30
+ user = Intercom::User.create(:email => "bob@example.com", :name => "Bob Smith")
31
+ user = Intercom::User.new(params)
32
+ user.save
33
+
34
+ ==== Messages
35
+
36
+ Intercom::Message.create(:email => "bob@example.com", :body => "Example message from bob@example.com to your application on Intercom.")
37
+ Intercom::Message.find(:email => "bob@example.com", :thread_id => 123)
38
+ Intercom::Message.find_all(:email => "bob@example.com")
39
+ Intercom::Message.mark_as_read(:email => "bob@example.com", :thread_id => 123)
40
+
41
+ ==== Impressions
42
+
43
+ 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"
44
+
45
+ === Errors
46
+
47
+ Intercom::AuthenticationError
48
+ Intercom::ServerError
49
+ Intercom::ResourceNotFound
data/Rakefile CHANGED
@@ -16,11 +16,4 @@ Rake::TestTask.new("spec:integration") do |spec|
16
16
  end
17
17
 
18
18
  task :spec => "spec:unit"
19
-
20
- require 'rdoc/task'
21
- RDoc::Task.new do |rd|
22
- rd.main = "README.rdoc"
23
- rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
24
- end
25
-
26
19
  task :default => :spec
data/intercom.gemspec CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_runtime_dependency "rest-client"
22
22
  s.add_development_dependency 'minitest'
23
- s.add_development_dependency 'rdoc'
24
23
  s.add_development_dependency 'rake'
25
24
  s.add_development_dependency 'mocha'
26
25
  end
data/lib/intercom.rb CHANGED
@@ -27,6 +27,8 @@ module Intercom
27
27
  ##
28
28
  # Set the id of the application you want to interact with.
29
29
  # When logged into your intercom console, the app_id is in the url after /apps (eg https://www.intercom.io/apps/<app-id>)
30
+ # @param [String] app_id
31
+ # @return [String]
30
32
  def self.app_id=(app_id)
31
33
  @app_id = app_id
32
34
  end
@@ -34,6 +36,8 @@ module Intercom
34
36
  ##
35
37
  # Set the api key to gain access to your application data.
36
38
  # When logged into your intercom console, you can view/create api keys in the settings menu
39
+ # @param [String] api_key
40
+ # @return [String]
37
41
  def self.api_key=(api_key)
38
42
  @api_key = api_key
39
43
  end
@@ -107,15 +111,16 @@ module Intercom
107
111
  @hostname = override
108
112
  end
109
113
 
110
- #
111
114
  # Raised when the credentials you provide don't match a valid account on Intercom.
112
115
  # Check that you have set <b>Intercom.app_id=</b> and <b>Intercom.api_key=</b> correctly.
113
116
  class AuthenticationError < StandardError;
114
117
  end
115
118
 
119
+ # Raised when something does wrong on within the Intercom API service.
116
120
  class ServerError < StandardError;
117
121
  end
118
122
 
123
+ # Raised when requesting resources on behalf of a user that doesn't exist in your application on Intercom.
119
124
  class ResourceNotFound < StandardError;
120
125
  end
121
126
  end
@@ -7,6 +7,8 @@ module Intercom
7
7
  #
8
8
  # An impressions contains user_ip, user_agent and location.
9
9
  #
10
+ # == Examples
11
+ #
10
12
  # impression = Intercom::Impression.create(:email => "person@example.com", :location => "/pricing/upgrade",
11
13
  # :user_ip => '1.2.3.4', :user_agent => "my-service-iphone-app-1.2")
12
14
  # The impression response will contain {#unread_messages}
@@ -1,125 +1,161 @@
1
1
  require 'intercom/user_resource'
2
2
 
3
3
  module Intercom
4
- ##
5
- # object representing a conversation with a user
4
+ # A conversation with a user. Either started by the users sending a message to your application using Intercom, or by an Admin sending a message to the user.
5
+ # == Examples
6
+ #
7
+ # Fetching all {MessageThread}'s for a user
8
+ # message_threads = Intercom::MessageThread.find_all(:email => "bob@example.com")
9
+ # message_threads.size
10
+ # message_thread = message_threads[0]
11
+ #
12
+ # Fetching a particular {MessageThread}
13
+ # message_thread = Intercom::MessageThread.find(:email => "bob@example.com", :thread_id => 123)
14
+ # message_thread.messages.map{|message| message.html }
15
+ #
16
+ # Creating a {MessageThread} on behalf of a user:
17
+ # message_thread = Intercom::MessageThread.create(:email => "bob@example.com", :body => "Hello, I need some help....")
18
+ #
6
19
  class MessageThread < UserResource
7
20
  include UnixTimestampUnwrapper
8
21
 
9
- ##
10
22
  # Finds a particular Message identified by thread_id
23
+ # @return [Message]
11
24
  def self.find(params)
12
25
  requires_parameters(params, %W(thread_id))
13
26
  api_response = Intercom.get("users/message_threads", params)
14
27
  MessageThread.from_api(api_response)
15
28
  end
16
29
 
17
- ##
18
30
  # Finds all Messages to show a particular user
31
+ # @return [Array<Message>]
19
32
  def self.find_all(params)
20
33
  response = Intercom.get("users/message_threads", params)
21
34
  response.map { |message| MessageThread.from_api(message) }
22
35
  end
23
36
 
24
- ##
25
37
  # Either creates a new message from this user to your application admins, or a comment on an existing one
38
+ # @return [Message]
26
39
  def self.create(params)
27
40
  requires_parameters(params, %W(body))
28
41
  MessageThread.new(params).save
29
42
  end
30
43
 
31
- ##
32
44
  # Marks a message (identified by thread_id) as read
45
+ # @return [Message]
33
46
  def self.mark_as_read(params)
34
47
  requires_parameters(params, %W(thread_id))
35
48
  MessageThread.new({"read" => true}.merge(params)).save(:put)
36
49
  end
37
50
 
51
+ # @return [Message]
38
52
  def save(method=:post)
39
53
  response = Intercom.send(method, "users/message_threads", to_hash)
40
54
  self.update_from_api_response(response)
41
55
  end
42
56
 
43
- ##
44
- # Set the content of the message. Supports standard markdown syntax
57
+ # Set the content of the message for new message creation.
58
+ # @param [String] body of the message. Supports markdown syntax
59
+ # @return [String]
45
60
  def body=(body)
46
61
  @attributes["body"] = body
47
62
  end
48
63
 
49
- def body
50
- @attributes["body"]
51
- end
52
-
64
+ # @return [Time] when this {MessageThread} was created
53
65
  def created_at
54
66
  time_at("created_at")
55
67
  end
56
68
 
69
+ # @return [Time] when the last update to this {MessageThread} happened
57
70
  def updated_at
58
71
  time_at("updated_at")
59
72
  end
60
73
 
74
+ # @return [Integer]
75
+ # @param [Integer thread_id]
61
76
  def thread_id=(thread_id)
62
77
  @attributes["thread_id"] = thread_id
63
78
  end
64
79
 
80
+ # @return [Integer]
65
81
  def thread_id
66
82
  @attributes["thread_id"]
67
83
  end
68
84
 
85
+ # @return [Boolean]
86
+ # @param [Boolean] read whether the latest revision of the thread has been read by the user
69
87
  def read=(read)
70
88
  @attributes["read"] = read
71
89
  end
72
90
 
91
+ # @return [Boolean]
73
92
  def read
74
93
  @attributes["read"]
75
94
  end
76
95
 
96
+ # @return [Array<Message>]
77
97
  def messages
78
98
  @attributes["messages"].map {|message_hash| Message.new(message_hash)}
79
99
  end
80
100
  end
81
101
 
102
+ # a {MessageThread} contains multiple {Message}'s
103
+ #
104
+ # {Message}'s are a read only part of a {MessageThread}
82
105
  class Message
83
106
  include UnixTimestampUnwrapper
84
107
 
108
+ # Used to create a {Message} from part of the response from the API
85
109
  def initialize(params)
86
110
  @attributes = params
87
111
  end
88
112
 
113
+ # @return [MessageAuthor] Author, which can be either an end user, or an Admin for your application
89
114
  def from
90
115
  MessageAuthor.new(@attributes["from"])
91
116
  end
92
117
 
118
+ # @return [String] html markup for the message
93
119
  def html
94
120
  @attributes["html"]
95
121
  end
96
122
 
123
+ # @return [Time] when this message was posted
97
124
  def created_at
98
125
  time_at("created_at")
99
126
  end
100
127
  end
101
128
 
129
+ # each {Message} in a {MessageThread} has a {MessageAuthor}
130
+ #
131
+ # Admin authors have a name, and an avatar_path_50. Non-admin authors have a name, user_id and email.
102
132
  class MessageAuthor
133
+ # Used to create a {MessageAuthor} from part of the response from the API
103
134
  def initialize(params)
104
135
  @attributes = params
105
136
  end
106
137
 
138
+ # @return [Boolean] whether this author is an admin or not
107
139
  def admin?
108
140
  @attributes['is_admin']
109
141
  end
110
142
 
143
+ # @return [String] email address of the author (only available when {#admin?} is false)
111
144
  def email
112
145
  @attributes['email']
113
146
  end
114
147
 
148
+ # @return [String] user_id of the author (only available when {#admin?} is false)
115
149
  def user_id
116
150
  @attributes['user_id']
117
151
  end
118
152
 
153
+ # @return [String] url of 50x50 avatar of the admin who posted this message (only available when {#admin?} is true)
119
154
  def avatar_path_50
120
155
  @attributes['avatar_path_50']
121
156
  end
122
157
 
158
+ # @return [String] real name of the Admin/User, when available.
123
159
  def name
124
160
  @attributes['name']
125
161
  end
@@ -1,5 +1,6 @@
1
1
  module Intercom
2
- class ShallowHash < Hash #:nodoc:
2
+ # Sub-class of {Hash} which doesn't allow {Array} or {Hash} values.
3
+ class ShallowHash < Hash
3
4
  def []=(key, value)
4
5
  raise ArgumentError.new("custom_data does not support nested data structures (key: #{key}, value: #{value}") if value.is_a?(Array) || value.is_a?(Hash)
5
6
  super(key, value)
@@ -1,43 +1,24 @@
1
1
  require 'intercom/user_resource'
2
2
 
3
3
  module Intercom
4
- ##
5
- # object representing a social profile for the User (see )http://docs.intercom.io/#SocialProfiles)
6
- class SocialProfile < UserResource
7
- def for_wire #:nodoc:
8
- @attributes
9
- end
10
-
11
- def type
12
- @attributes["type"]
13
- end
14
-
15
- def type=(type)
16
- @attributes["type"]=type
17
- end
18
-
19
- def id
20
- @attributes["id"]
21
- end
22
-
23
- def id=(id)
24
- @attributes["id"]=id
25
- end
26
-
27
- def url
28
- @attributes["url"]
29
- end
30
-
31
- def url=(url)
32
- @attributes["url"]=url
33
- end
34
-
35
- def username
36
- @attributes["username"]
37
- end
38
-
39
- def username=(username)
40
- @attributes["username"]=username
4
+ # object representing a social profile for the User (see )http://docs.intercom.io/#SocialProfiles).
5
+ # Read only part of the {User} object
6
+ class SocialProfile
7
+ # @return [String] type e.g. twitter, facebook etc.
8
+ attr_reader :type
9
+ # @return [String] id
10
+ attr_reader :id
11
+ # @return [String] url
12
+ attr_reader :url
13
+ # @return [String] username
14
+ attr_reader :username
15
+
16
+ # @private
17
+ def initialize(params)
18
+ @type = params["type"]
19
+ @id = params["id"]
20
+ @url = params["url"]
21
+ @username = params["username"]
41
22
  end
42
23
  end
43
24
  end
@@ -1,4 +1,5 @@
1
1
  module Intercom
2
+ # Our api returns date as unix time stamps. This module helps marshall to and from {Time} objects.
2
3
  module UnixTimestampUnwrapper
3
4
  def time_at(attribute_name)
4
5
  Time.at(@attributes[attribute_name]) if @attributes[attribute_name]
data/lib/intercom/user.rb CHANGED
@@ -13,6 +13,7 @@ module Intercom
13
13
  #
14
14
  # returns Intercom::User object representing the state on our servers.
15
15
  #
16
+ # @return [User]
16
17
  def self.find(params)
17
18
  response = Intercom.get("users", params)
18
19
  User.from_api(response)
@@ -26,17 +27,19 @@ module Intercom
26
27
  # returns Intercom::User object representing the state on our servers.
27
28
  #
28
29
  # This operation is idempotent.
30
+ # @return [User]
29
31
  def self.create(params)
30
32
  User.new(params).save
31
33
  end
32
34
 
33
- ##
34
35
  # instance method alternative to #create
36
+ # @return [User]
35
37
  def save
36
38
  response = Intercom.post("users", to_hash)
37
39
  self.update_from_api_response(response)
38
40
  end
39
41
 
42
+ # @return {User}
40
43
  def name
41
44
  @attributes["name"]
42
45
  end
@@ -45,6 +48,7 @@ module Intercom
45
48
  @attributes["name"]=name
46
49
  end
47
50
 
51
+ # @return [String]
48
52
  def last_seen_ip
49
53
  @attributes["last_seen_ip"]
50
54
  end
@@ -53,6 +57,7 @@ module Intercom
53
57
  @attributes["last_seen_ip"]=last_seen_ip
54
58
  end
55
59
 
60
+ # @return [String]
56
61
  def last_seen_user_agent
57
62
  @attributes["last_seen_user_agent"]
58
63
  end
@@ -61,28 +66,32 @@ module Intercom
61
66
  @attributes["last_seen_user_agent"]=last_seen_user_agent
62
67
  end
63
68
 
69
+ # @return [Integer]
64
70
  def relationship_score
65
71
  @attributes["relationship_score"]
66
72
  end
67
73
 
74
+ # @return [Integer]
68
75
  def session_count
69
76
  @attributes["session_count"]
70
77
  end
71
78
 
72
79
  ##
73
80
  # Get last time this User interacted with your application
81
+ # @return [Time]
74
82
  def last_impression_at
75
83
  time_at("last_impression_at")
76
84
  end
77
85
 
78
86
  ##
79
87
  # Get Time at which this User started using your application.
88
+ # @return [Time]
80
89
  def created_at
81
90
  time_at("created_at")
82
91
  end
83
92
 
84
93
  ##
85
- # Get Time at which this User started using your application.
94
+ # Set Time at which this User started using your application.
86
95
  def created_at=(time)
87
96
  set_time_at("created_at", time)
88
97
  end
@@ -91,6 +100,7 @@ module Intercom
91
100
  # Get array of Intercom::SocialProfile objects attached to this Intercom::User
92
101
  #
93
102
  # See http://docs.intercom.io/#SocialProfiles for more information
103
+ # @return [Array<SocialProfile>]
94
104
  def social_profiles
95
105
  @social_profiles ||= [].freeze
96
106
  end
@@ -105,6 +115,7 @@ module Intercom
105
115
  # {"city_name"=>"Santiago", "continent_code"=>"SA", "country_code"=>"CHL", "country_name"=>"Chile",
106
116
  # "latitude"=>-33.44999999999999, "longitude"=>-70.6667, "postal_code"=>"", "region_name"=>"12",
107
117
  # "timezone"=>"Chile/Continental"}
118
+ # @return [Hash]
108
119
  def location_data
109
120
  @location_data ||= {}.freeze
110
121
  end
@@ -113,10 +124,15 @@ module Intercom
113
124
  # Get hash of custom attributes stored for this Intercom::User
114
125
  #
115
126
  # See http://docs.intercom.io/#CustomData for more information
127
+ # @return [Hash]
116
128
  def custom_data
117
129
  @attributes["custom_data"] ||= ShallowHash.new
118
130
  end
119
131
 
132
+ def custom_data=(custom_data) #:nodoc:
133
+ @attributes["custom_data"] = ShallowHash.new.merge(custom_data)
134
+ end
135
+
120
136
  protected
121
137
  def social_profiles=(social_profiles) #:nodoc:
122
138
  @social_profiles = social_profiles.map { |account| SocialProfile.new(account) }.freeze
@@ -125,9 +141,5 @@ module Intercom
125
141
  def location_data=(hash) #:nodoc:
126
142
  @location_data = hash.freeze
127
143
  end
128
-
129
- def custom_data=(custom_data) #:nodoc:
130
- @attributes["custom_data"] = ShallowHash.new.merge(custom_data)
131
- end
132
144
  end
133
145
  end
@@ -1,6 +1,7 @@
1
1
  require 'intercom/unix_timestamp_unwrapper'
2
2
 
3
3
  module Intercom
4
+ # Base class for resources tied off a {User}, all of which are scoped by either the users :email or :user_id.
4
5
  class UserResource
5
6
  include UnixTimestampUnwrapper
6
7
 
@@ -8,26 +9,36 @@ module Intercom
8
9
  self.attributes = attributes
9
10
  end
10
11
 
12
+ # @return [Hash] hash of all the attributes in the structure they will be sent to the api
11
13
  def to_hash
12
14
  UserResource.for_wire(@attributes)
13
15
  end
14
16
 
17
+ # @return [String] email address
15
18
  def email
16
19
  @attributes["email"]
17
20
  end
18
21
 
22
+ # @param [String] email
23
+ # @return [String]
19
24
  def email=(email)
20
- @attributes["email"]=email
25
+ @attributes["email"] = email
21
26
  end
22
27
 
28
+
29
+ # @return [String] user_id
23
30
  def user_id
24
31
  @attributes["user_id"]
25
32
  end
26
33
 
34
+ # @param [String] user_id
35
+ # @return [String]
27
36
  def user_id=(user_id)
28
37
  @attributes["user_id"] = user_id
29
38
  end
30
39
 
40
+ # updates the internal state of this {UserResource} based on the response from the API
41
+ # @return [UserResource] self
31
42
  def update_from_api_response(api_response)
32
43
  api_response.each do |key, value|
33
44
  setter_method = "#{key.to_s}="
@@ -1,3 +1,3 @@
1
1
  module Intercom #:nodoc:
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -45,7 +45,7 @@ describe "Intercom::User" do
45
45
  end
46
46
 
47
47
  it "has read-only social accounts" do
48
- user = Intercom::User.new(:social_profiles => [:url => "http://twitter.com/abc", "username" => "abc", "type" => "twitter"])
48
+ user = Intercom::User.new(:social_profiles => ["url" => "http://twitter.com/abc", "username" => "abc", "type" => "twitter"])
49
49
  user.social_profiles.size.must_equal 1
50
50
  twitter = user.social_profiles.first
51
51
  twitter.type.must_equal "twitter"
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  describe Intercom do
4
4
  it "has a version number" do
5
- Intercom::VERSION.must_equal "0.0.2"
5
+ Intercom::VERSION.must_match /\d+\.\d+\.\d+/
6
6
  end
7
7
 
8
8
  describe "API" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intercom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-03-06 00:00:00.000000000Z
14
+ date: 2012-03-09 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
18
- requirement: &70197574767120 !ruby/object:Gem::Requirement
18
+ requirement: &70301913505580 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70197574767120
26
+ version_requirements: *70301913505580
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
- requirement: &70197574748440 !ruby/object:Gem::Requirement
29
+ requirement: &70301913504840 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,21 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *70197574748440
38
- - !ruby/object:Gem::Dependency
39
- name: rdoc
40
- requirement: &70197574686840 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- type: :development
47
- prerelease: false
48
- version_requirements: *70197574686840
37
+ version_requirements: *70301913504840
49
38
  - !ruby/object:Gem::Dependency
50
39
  name: rake
51
- requirement: &70197570625140 !ruby/object:Gem::Requirement
40
+ requirement: &70301913504220 !ruby/object:Gem::Requirement
52
41
  none: false
53
42
  requirements:
54
43
  - - ! '>='
@@ -56,10 +45,10 @@ dependencies:
56
45
  version: '0'
57
46
  type: :development
58
47
  prerelease: false
59
- version_requirements: *70197570625140
48
+ version_requirements: *70301913504220
60
49
  - !ruby/object:Gem::Dependency
61
50
  name: mocha
62
- requirement: &70197570614200 !ruby/object:Gem::Requirement
51
+ requirement: &70301913503620 !ruby/object:Gem::Requirement
63
52
  none: false
64
53
  requirements:
65
54
  - - ! '>='
@@ -67,7 +56,7 @@ dependencies:
67
56
  version: '0'
68
57
  type: :development
69
58
  prerelease: false
70
- version_requirements: *70197570614200
59
+ version_requirements: *70301913503620
71
60
  description: ! 'Intercom (https://www.intercom.io) is a customer relationship management
72
61
  and messaging tool for web app owners. This library wraps the api provided by Intercom.
73
62
  See http://docs.intercom.io/api for more details. '
@@ -82,7 +71,6 @@ files:
82
71
  - .gitignore
83
72
  - Gemfile
84
73
  - LICENSE
85
- - README.md
86
74
  - README.rdoc
87
75
  - Rakefile
88
76
  - changed.txt
@@ -136,4 +124,3 @@ test_files:
136
124
  - spec/unit/intercom/user_spec.rb
137
125
  - spec/unit/intercom_spec.rb
138
126
  - spec/unit/spec_helper.rb
139
- has_rdoc:
data/README.md DELETED
@@ -1,57 +0,0 @@
1
- Ruby bindings for the Intercom API (https://api.intercom.io). See http://docs.intercom.io/api for more details
2
-
3
- ## Install
4
- ```
5
- gem install intercom
6
- ```
7
-
8
- ## Basic Usage
9
-
10
- ### Configure your access credentials
11
-
12
- ```
13
- Intercom.app_id = "my_app_iddd"
14
- Intercom.api_key = "my-super-crazy-api-key"
15
- ```
16
-
17
- ### Resources
18
-
19
- The API supports:
20
-
21
- ```
22
- POST,PUT,GET https://api.intercom.io/v1/users
23
- POST,PUT,GET https://api.intercom.io/v1/users/messages
24
- POST https://api.intercom.io/v1/users/impressions
25
- ```
26
-
27
- #### Users
28
-
29
- ```ruby
30
- user = Intercom::User.find(:email => "bob@example.com")
31
- user = Intercom::User.create(params)
32
- user = Intercom::User.new(params)
33
- user.save
34
- ```
35
-
36
- #### Messages
37
-
38
- ```ruby
39
- Intercom::Message.create
40
- Intercom::Message.find
41
- Intercom::Message.find_all
42
- Intercom::Message.mark_as_read
43
- ```
44
-
45
- #### Impressions
46
-
47
- ```ruby
48
- Intercom::Impression.create
49
- ```
50
-
51
- ### Errors
52
-
53
- ```ruby
54
- Intercom::AuthenticationError
55
- Intercom::ServerError
56
- Intercom::ResourceNotFound
57
- ```