Skip to content
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 lib/intercom/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def validate_credentials!

def validate_api_version!
error = MisconfiguredClientError.new("api_version must be either nil or a valid API version")
fail error if (@api_version && Gem::Version.new(@api_version) < Gem::Version.new('1.0'))
fail error if (@api_version && @api_version != 'Unstable' && Gem::Version.new(@api_version) < Gem::Version.new('1.0'))
end

def execute_request(request)
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/intercom/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ module Intercom
assert_nil(Client.new(app_id: app_id, api_key: api_key, api_version: nil).api_version)
end

it 'allows api version to be Unstable' do
Client.new(app_id: app_id, api_key: api_key, api_version: 'Unstable').api_version.must_equal('Unstable')
end

it 'raises on invalid api version' do
proc { Client.new(app_id: app_id, api_key: api_key, api_version: '0.2') }.must_raise MisconfiguredClientError
end
Expand Down