From b3b184a45c315f66f3327447190deb7878809a49 Mon Sep 17 00:00:00 2001 From: Long Duong Date: Wed, 19 Nov 2025 16:14:44 +0700 Subject: [PATCH] fix: add missing configuration accessors for api keys Fixes NoMethodError when configuring organization_api_key and rest_api_key. These keys are required for authentication but were missing from the Configuration class. Changes: - Add attr_accessor for organization_api_key and rest_api_key in configuration.rb - Add specs to verify these keys can be configured --- lib/onesignal/configuration.rb | 6 ++++++ spec/configuration_spec.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/onesignal/configuration.rb b/lib/onesignal/configuration.rb index 1ffb201..9daca57 100644 --- a/lib/onesignal/configuration.rb +++ b/lib/onesignal/configuration.rb @@ -39,6 +39,12 @@ class Configuration # OneSignal API token for User Authentication attr_accessor :user_key + # OneSignal Organization API Key + attr_accessor :organization_api_key + + # OneSignal REST API Key + attr_accessor :rest_api_key + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response # details will be logged with `logger.debug` (see the `logger` attribute). # Default to false. diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 762a1e8..26764a4 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -39,4 +39,16 @@ end end end + + describe 'API keys' do + it 'should allow setting and retrieving organization_api_key' do + config.organization_api_key = 'test_org_key' + expect(config.organization_api_key).to eq('test_org_key') + end + + it 'should allow setting and retrieving rest_api_key' do + config.rest_api_key = 'test_rest_key' + expect(config.rest_api_key).to eq('test_rest_key') + end + end end