Skip to content

Provide installation type as settings attribute #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.5.7
- image: cimg/ruby:2.7

working_directory: ~/intercom-rails

Expand Down
11 changes: 6 additions & 5 deletions intercom-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]

s.add_dependency 'activesupport', '>3.0'
s.add_dependency 'activesupport', '>4.0'
s.add_development_dependency 'rake'
s.add_development_dependency 'actionpack', '>3.2.12'
s.add_development_dependency 'rspec', '~> 3.1'
s.add_development_dependency 'rspec-rails', '~> 3.1'
s.add_development_dependency 'actionpack', '>5.0'
s.add_development_dependency 'rspec', '~> 3.13'
s.add_development_dependency 'rspec-rails', '~> 5.0'
s.add_development_dependency 'pry'
s.add_development_dependency 'sinatra', '~> 1.4.5'
s.add_development_dependency 'sinatra', '~> 2.0'
s.add_development_dependency 'thin', '~> 1.7.0'
s.add_development_dependency 'bigdecimal', '1.3.5'
s.add_development_dependency 'tzinfo'
s.add_development_dependency 'gem-release'
end
5 changes: 2 additions & 3 deletions lib/intercom-rails/script_tag.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

require 'active_support/json'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/string/output_safety'
require 'active_support/all'
require 'action_view'

module IntercomRails
Expand Down Expand Up @@ -72,6 +70,7 @@ def intercom_settings
hsh[:company] = company_details if company_details.present?
hsh[:hide_default_launcher] = Config.hide_default_launcher if Config.hide_default_launcher
hsh[:api_base] = Config.api_base if Config.api_base
hsh[:installation_type] = 'rails'
hsh
end

Expand Down
2 changes: 1 addition & 1 deletion lib/intercom-rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module IntercomRails
VERSION = "0.4.2"
VERSION = "1.0.0"
end
2 changes: 1 addition & 1 deletion spec/script_tag_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
:email => 'marco@intercom.io',
:user_id => 'marco',
})
expect(script_tag.csp_sha256).to eq("'sha256-qLRbekKD6dEDMyLKPNFYpokzwYCz+WeNPqJE603mT24='")
expect(script_tag.csp_sha256).to eq("'sha256-lOGcYryJDhf1KCboXuy8wxCxIGAT16HDiUQNRhluxRQ='")
end

it 'inserts a valid nonce if present' do
Expand Down
9 changes: 8 additions & 1 deletion spec/script_tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
end
end

context 'integration type' do
it 'should be rails' do
script_tag = ScriptTag.new()
expect(script_tag.intercom_settings[:installation_type]).to eq('rails')
end
end

it 'strips out nil entries for standard attributes' do
%w(name email user_id).each do |standard_attribute|
with_value = ScriptTag.new(:user_details => {standard_attribute => 'value'})
Expand Down Expand Up @@ -199,7 +206,7 @@ def sha256_hmac(secret, input)
:email => 'marco@intercom.io',
:user_id => 'marco',
})
expect(script_tag.csp_sha256).to eq("'sha256-qLRbekKD6dEDMyLKPNFYpokzwYCz+WeNPqJE603mT24='")
expect(script_tag.csp_sha256).to eq("'sha256-lOGcYryJDhf1KCboXuy8wxCxIGAT16HDiUQNRhluxRQ='")
end

it 'inserts a valid nonce if present' do
Expand Down