intercom-rails 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,6 +49,7 @@ module IntercomRails
49
49
  config_accessor :app_id
50
50
  config_accessor :api_secret
51
51
  config_accessor :api_key
52
+ config_accessor :library_url
52
53
 
53
54
  config_group :user do
54
55
  config_accessor :current do |value|
@@ -32,7 +32,7 @@ module IntercomRails
32
32
  hsh = {}
33
33
  hsh[:id] = company.id
34
34
  hsh[:name] = company.name if attribute_present?(:name)
35
- hsh[:created_at] = company.created_at if attribute_present?(:created_at)
35
+ hsh[:created_at] = company.created_at.to_i if attribute_present?(:created_at)
36
36
  hsh
37
37
  end
38
38
 
@@ -45,7 +45,7 @@ module IntercomRails
45
45
  function async_load() {
46
46
  var s = document.createElement('script');
47
47
  s.type = 'text/javascript'; s.async = true;
48
- s.src = 'https://api.intercom.io/api/js/library.js';
48
+ s.src = '#{Config.library_url || 'https://api.intercom.io/api/js/library.js'}';
49
49
  var x = document.getElementsByTagName('script')[0];
50
50
  x.parentNode.insertBefore(s, x);
51
51
  }
@@ -1,3 +1,3 @@
1
1
  module IntercomRails
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -106,6 +106,19 @@ class AutoIncludeFilterTest < ActionController::TestCase
106
106
  assert_includes @response.body, "Eoghan McCabe"
107
107
  end
108
108
 
109
+ def test_library_url_default
110
+ get :with_current_user_method, :body => "<body>Hello world</body>"
111
+ assert_includes @response.body, "<script>"
112
+ assert_includes @response.body, "s.src = 'https://api.intercom.io/api/js/library.js"
113
+ end
114
+
115
+ def test_library_url_override
116
+ IntercomRails.config.library_url = 'http://a.b.c.d/library.js'
117
+ get :with_current_user_method, :body => "<body>Hello world</body>"
118
+ assert_includes @response.body, "<script>"
119
+ assert_includes @response.body, "s.src = 'http://a.b.c.d/library.js"
120
+ end
121
+
109
122
  def test_auto_insert_with_api_secret_set
110
123
  IntercomRails.config.api_secret = 'abcd'
111
124
  get :with_current_user_method, :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.3
4
+ version: 0.2.4
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-03 00:00:00.000000000 Z
14
+ date: 2012-12-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -179,18 +179,12 @@ 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: 3543058584260120985
185
182
  required_rubygems_version: !ruby/object:Gem::Requirement
186
183
  none: false
187
184
  requirements:
188
185
  - - ! '>='
189
186
  - !ruby/object:Gem::Version
190
187
  version: '0'
191
- segments:
192
- - 0
193
- hash: 3543058584260120985
194
188
  requirements: []
195
189
  rubyforge_project: intercom-rails
196
190
  rubygems_version: 1.8.23