Skip to content

Commit 63b39bb

Browse files
author
coding-chimp
committed
Adds compatibility with ruby 2.0
1 parent c57dfcc commit 63b39bb

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: ruby
22
cache: bundler
33

44
rvm:
5+
- 2.0.0
56
- 2.1.0
67
- 2.2.0
78
- 2.3.0

lib/onesignal/client.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ class Client
44

55
attr_reader :auth_token, :app_id
66

7-
def initialize(auth_token:, app_id: nil)
7+
def initialize(auth_token: nil, app_id: nil)
88
@auth_token = auth_token
99
@app_id = app_id
10+
11+
ensure_auth_token_presence
1012
end
1113

1214
def apps
@@ -27,8 +29,16 @@ def notifications
2729

2830
private
2931

32+
def ensure_auth_token_presence
33+
if auth_token.nil?
34+
raise ArgumentError, 'missing keyword: auth_token'
35+
end
36+
end
37+
3038
def ensure_app_id_presence
31-
raise AppIdMissingError if app_id.nil?
39+
if app_id.nil?
40+
raise AppIdMissingError
41+
end
3242
end
3343
end
3444
end

onesignal.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
1919
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2020
spec.require_paths = ['lib']
2121

22+
spec.required_ruby_version = '>= 2.0.0'
23+
2224
spec.add_development_dependency 'bundler', '~> 1.11'
2325
spec.add_development_dependency 'minitest', '~> 5.0'
2426
spec.add_development_dependency 'rake', '~> 10.0'

0 commit comments

Comments
 (0)