Skip to content

Commit 9becd8e

Browse files
dkremezDzmitry Kremez
andauthored
Provide installation type as settings attribute (#350)
* Provide installation type as settings attribute * Update CI ruby version to fix CI build * Bump gem version number to 1.0.0 as we dropped active record 3.x support --------- Co-authored-by: Dzmitry Kremez <[email protected]>
1 parent 0e654be commit 9becd8e

File tree

6 files changed

+19
-12
lines changed

6 files changed

+19
-12
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: circleci/ruby:2.5.7
5+
- image: cimg/ruby:2.7
66

77
working_directory: ~/intercom-rails
88

intercom-rails.gemspec

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ Gem::Specification.new do |s|
1818
s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"]
1919
s.test_files = Dir["test/**/*"]
2020

21-
s.add_dependency 'activesupport', '>3.0'
21+
s.add_dependency 'activesupport', '>4.0'
2222
s.add_development_dependency 'rake'
23-
s.add_development_dependency 'actionpack', '>3.2.12'
24-
s.add_development_dependency 'rspec', '~> 3.1'
25-
s.add_development_dependency 'rspec-rails', '~> 3.1'
23+
s.add_development_dependency 'actionpack', '>5.0'
24+
s.add_development_dependency 'rspec', '~> 3.13'
25+
s.add_development_dependency 'rspec-rails', '~> 5.0'
2626
s.add_development_dependency 'pry'
27-
s.add_development_dependency 'sinatra', '~> 1.4.5'
27+
s.add_development_dependency 'sinatra', '~> 2.0'
2828
s.add_development_dependency 'thin', '~> 1.7.0'
29+
s.add_development_dependency 'bigdecimal', '1.3.5'
2930
s.add_development_dependency 'tzinfo'
3031
s.add_development_dependency 'gem-release'
3132
end

lib/intercom-rails/script_tag.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'active_support/json'
4-
require 'active_support/core_ext/hash/indifferent_access'
5-
require 'active_support/core_ext/string/output_safety'
3+
require 'active_support/all'
64
require 'action_view'
75

86
module IntercomRails
@@ -72,6 +70,7 @@ def intercom_settings
7270
hsh[:company] = company_details if company_details.present?
7371
hsh[:hide_default_launcher] = Config.hide_default_launcher if Config.hide_default_launcher
7472
hsh[:api_base] = Config.api_base if Config.api_base
73+
hsh[:installation_type] = 'rails'
7574
hsh
7675
end
7776

lib/intercom-rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module IntercomRails
2-
VERSION = "0.4.2"
2+
VERSION = "1.0.0"
33
end

spec/script_tag_helper_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
:email => '[email protected]',
3636
:user_id => 'marco',
3737
})
38-
expect(script_tag.csp_sha256).to eq("'sha256-qLRbekKD6dEDMyLKPNFYpokzwYCz+WeNPqJE603mT24='")
38+
expect(script_tag.csp_sha256).to eq("'sha256-lOGcYryJDhf1KCboXuy8wxCxIGAT16HDiUQNRhluxRQ='")
3939
end
4040

4141
it 'inserts a valid nonce if present' do

spec/script_tag_spec.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
end
3838
end
3939

40+
context 'integration type' do
41+
it 'should be rails' do
42+
script_tag = ScriptTag.new()
43+
expect(script_tag.intercom_settings[:installation_type]).to eq('rails')
44+
end
45+
end
46+
4047
it 'strips out nil entries for standard attributes' do
4148
%w(name email user_id).each do |standard_attribute|
4249
with_value = ScriptTag.new(:user_details => {standard_attribute => 'value'})
@@ -199,7 +206,7 @@ def sha256_hmac(secret, input)
199206
:email => '[email protected]',
200207
:user_id => 'marco',
201208
})
202-
expect(script_tag.csp_sha256).to eq("'sha256-qLRbekKD6dEDMyLKPNFYpokzwYCz+WeNPqJE603mT24='")
209+
expect(script_tag.csp_sha256).to eq("'sha256-lOGcYryJDhf1KCboXuy8wxCxIGAT16HDiUQNRhluxRQ='")
203210
end
204211

205212
it 'inserts a valid nonce if present' do

0 commit comments

Comments
 (0)