intercom-rails 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,7 +39,7 @@ If it's not working make sure:
39
39
  * Your current user is accessible in your controllers as `current_user` or `@user`, if not in `config/initializers/intercom.rb`:
40
40
 
41
41
  ```ruby
42
- config.current_user = Proc.new { current_user_object }
42
+ config.user.current = Proc.new { current_user_object }
43
43
  ```
44
44
 
45
45
  Feel free to mail us: team@intercom.io, if you're still having trouble.
@@ -64,7 +64,7 @@ You can give either a:
64
64
  to generate the values of the custom data:
65
65
 
66
66
  ```ruby
67
- config.custom_data = {
67
+ config.user.custom_data = {
68
68
  :plan => Proc.new { |user| user.plan.name },
69
69
  :is_paid => Proc.new { |user| user.plan.present? },
70
70
  :email_verified => :email_verified?
@@ -76,12 +76,12 @@ In some situations you'll want to set some custom data specific to a request. Yo
76
76
  ```ruby
77
77
  class AppsController < ActionController::Base
78
78
  def activate
79
- intercom_custom_data[:app_activated_at] = Time.now
79
+ intercom_custom_data.user[:app_activated_at] = Time.now
80
80
  ...
81
81
  end
82
82
 
83
83
  def destroy
84
- intercom_custom_data[:app_deleted_at] = Time.now
84
+ intercom_custom_data.user[:app_deleted_at] = Time.now
85
85
  ...
86
86
  end
87
87
  end
@@ -123,11 +123,11 @@ This will behave exactly the same as the default auto-install. If for whatever r
123
123
  ```erb
124
124
  <% if logged_in? %>
125
125
  <%= intercom_script_tag({
126
- :app_id => 'your-app-id'
127
- :user_id => current_user.id
128
- :email => current_user.email
129
- :name => current_user.name
130
- :created_at => current_user.created_at
126
+ :app_id => 'your-app-id',
127
+ :user_id => current_user.id,
128
+ :email => current_user.email,
129
+ :name => current_user.name,
130
+ :created_at => current_user.created_at,
131
131
  :custom_data => {
132
132
  'plan' => current_user.plan.name
133
133
  }
@@ -140,13 +140,13 @@ You can also override `IntercomRails::Config` options such as your `api_secret`,
140
140
  ```erb
141
141
  <% if logged_in? %>
142
142
  <%= intercom_script_tag({
143
- :app_id => 'your-app-id'
144
- :user_id => current_user.id
145
- :email => current_user.email
146
- :name => current_user.name
143
+ :app_id => 'your-app-id',
144
+ :user_id => current_user.id,
145
+ :email => current_user.email,
146
+ :name => current_user.name,
147
147
  :created_at => current_user.created_at
148
148
  }, {
149
- :secret => 'your-apps-secret',
149
+ :secret => 'your-apps-api-secret',
150
150
  :widget => {:activator => '#Intercom'}
151
151
  }) %>
152
152
  <% end %>
@@ -28,7 +28,7 @@ module IntercomRails
28
28
 
29
29
  if uri.scheme == 'https'
30
30
  http.use_ssl = true
31
- http.ca_file = File.join(File.dirname(__FILE__), '../data/ca_cert.pem')
31
+ http.ca_file = File.join(File.dirname(__FILE__), '../data/cacert.pem')
32
32
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
33
33
  end
34
34
  end
@@ -99,7 +99,6 @@ module IntercomRails
99
99
  end
100
100
 
101
101
  def app_id
102
- return ENV['INTERCOM_APP_ID'] if ENV['INTERCOM_APP_ID'].present?
103
102
  return IntercomRails.config.app_id if IntercomRails.config.app_id.present?
104
103
  return 'abcd1234' if defined?(Rails) && Rails.env.development?
105
104
 
@@ -1,3 +1,3 @@
1
1
  module IntercomRails
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -7,8 +7,8 @@ module Intercom
7
7
  end
8
8
 
9
9
  argument :app_id, :desc => "Your Intercom app-id, which can be found here: https://www.intercom.io/apps/api_keys"
10
- argument :api_secret, :desc => "Your Intercom api-secret, used for secure mode"
11
- argument :api_key, :desc => "An Intercom API key, for various rake tasks"
10
+ argument :api_secret, :desc => "Your Intercom api-secret, used for secure mode", :optional => true
11
+ argument :api_key, :desc => "An Intercom API key, for various rake tasks", :optional => true
12
12
 
13
13
  def create_config_file
14
14
  @app_id = app_id
@@ -1,7 +1,7 @@
1
1
  IntercomRails.config do |config|
2
2
  # == Intercom app_id
3
3
  #
4
- config.app_id = "<%= @app_id %>"
4
+ config.app_id = ENV["INTERCOM_APP_ID"] || "<%= @app_id %>"
5
5
 
6
6
  # == Intercom secret key
7
7
  # This is reuqired to enable secure mode, you can find it on your Intercom
@@ -52,11 +52,11 @@ class AutoIncludeFilterTest < ActionController::TestCase
52
52
 
53
53
  def setup
54
54
  super
55
- ENV['INTERCOM_APP_ID'] = 'my_app_id'
55
+ IntercomRails.config.app_id = 'my_app_id'
56
56
  end
57
57
 
58
58
  def teardown
59
- ENV.delete('INTERCOM_APP_ID')
59
+ IntercomRails.config.app_id = nil
60
60
  end
61
61
 
62
62
  def test_no_user_present
@@ -78,7 +78,7 @@ class AutoIncludeFilterTest < ActionController::TestCase
78
78
  get :with_user_instance_variable, :body => "<body>Hello world</body>"
79
79
 
80
80
  assert_includes @response.body, "<script>"
81
- assert_includes @response.body, ENV['INTERCOM_APP_ID']
81
+ assert_includes @response.body, IntercomRails.config.app_id
82
82
  assert_includes @response.body, "ben@intercom.io"
83
83
  assert_includes @response.body, "Ben McRedmond"
84
84
  end
@@ -129,7 +129,7 @@ class AutoIncludeFilterTest < ActionController::TestCase
129
129
  end
130
130
 
131
131
  def test_no_app_id_present
132
- ENV.delete('INTERCOM_APP_ID')
132
+ IntercomRails.config.app_id = nil
133
133
  get :with_current_user_method, :body => "<body>Hello world</body>"
134
134
 
135
135
  assert_equal @response.body, "<body>Hello world</body>"
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.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-04 00:00:00.000000000 Z
14
+ date: 2012-12-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -179,12 +179,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
179
  - - ! '>='
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
+ segments:
183
+ - 0
184
+ hash: -2417479611235149347
182
185
  required_rubygems_version: !ruby/object:Gem::Requirement
183
186
  none: false
184
187
  requirements:
185
188
  - - ! '>='
186
189
  - !ruby/object:Gem::Version
187
190
  version: '0'
191
+ segments:
192
+ - 0
193
+ hash: -2417479611235149347
188
194
  requirements: []
189
195
  rubyforge_project: intercom-rails
190
196
  rubygems_version: 1.8.23