intercom-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,10 +21,25 @@ In your layout file:
21
21
  :email => current_user.email
22
22
  :name => current_user.name
23
23
  :created_at => current_user.created_at
24
- :custom_data => {:plan => "Pro"}}) %>
24
+ :custom_data => {
25
+
26
+ }}) %>
25
27
  <% end %>
26
28
 
27
- See {IntercomRails::ScriptTagHelper} for more details.
29
+ :custom_data allows you to specify any app/user/situational data to associate with the current_user. It will be visible in Intercom, and you'll be able to search/filter/send messages based on it.
30
+
31
+ e.g.
32
+
33
+ :plan => "Pro"
34
+
35
+ or
36
+ :dashboard_page => 'http://dashboard.example.com/user-id'
37
+
38
+ See IntercomRails::ScriptTagHelper for more details.
39
+
40
+ == Contributors
41
+
42
+ - Dr Nic Williams (@drnic) - provided a rails generator for adding the Intercom javascript tag into your layout.
28
43
 
29
44
  == License
30
45
 
@@ -1,3 +1,3 @@
1
1
  module IntercomRails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,33 @@
1
+ module Intercom
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ desc "Installs Intercom (https://www.intercom.io) into your Rails app"
5
+
6
+ argument :app_id, :desc => "Your Intercom app-id, which can be found here: https://www.intercom.io/apps/api_keys"
7
+
8
+ def update_layout
9
+ snippet = <<-HTML
10
+ <!--
11
+ TODO add any user/app/situational data to the custom Hash below
12
+ e.g. :plan => 'Pro', :dashboard_page => 'http://dashboard.example.com/user-id'
13
+ See http://docs.intercom.io/#CustomData for more details about custom data
14
+ -->
15
+ <% if logged_in? %>
16
+ <%= intercom_script_tag({
17
+ :app_id => #{app_id.inspect},
18
+ :user_id => current_user.id,
19
+ :email => current_user.email,
20
+ :name => current_user.name,
21
+ :created_at => current_user.created_at,
22
+ :custom_data => {
23
+
24
+ }}) %>
25
+ <% end %>
26
+ </body>
27
+ HTML
28
+
29
+ gsub_file('app/views/layouts/application.html.erb', %r{</body>}, snippet)
30
+ end
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intercom-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-16 00:00:00.000000000Z
14
+ date: 2012-03-27 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
18
- requirement: &70275093835120 !ruby/object:Gem::Requirement
18
+ requirement: &70176105438820 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>'
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '3.0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70275093835120
26
+ version_requirements: *70176105438820
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
- requirement: &70275093834480 !ruby/object:Gem::Requirement
29
+ requirement: &70176105438140 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *70275093834480
37
+ version_requirements: *70176105438140
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rake
40
- requirement: &70275093833620 !ruby/object:Gem::Requirement
40
+ requirement: &70176105437320 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,7 +45,7 @@ dependencies:
45
45
  version: '0'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70275093833620
48
+ version_requirements: *70176105437320
49
49
  description: Intercom (https://www.intercom.io) is a customer relationship management
50
50
  and messaging tool for web app owners. This library makes it easier to use the correct
51
51
  javascript tracking code in your rails applications.
@@ -61,6 +61,7 @@ files:
61
61
  - lib/intercom-rails/script_tag_helper.rb
62
62
  - lib/intercom-rails/version.rb
63
63
  - lib/intercom-rails.rb
64
+ - lib/rails/generators/intercom/install/install_generator.rb
64
65
  - MIT-LICENSE
65
66
  - Rakefile
66
67
  - README.rdoc