Class: InovaFCM::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/inova_fcm/test_config.rb,
lib/inova_fcm/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

attr_accessor :fcm_key, :firebase_admin_sdk_path, :firebase_project_id



9
10
11
12
13
# File 'lib/inova_fcm/test_config.rb', line 9

def initialize
  @fcm_key = ENV["FCM_KEY"]
  @firebase_admin_sdk_path = ENV["FIREBASE_ADMIN_SDK_PATH"]
  @firebase_project_id = ENV["FIREBASE_PROJECT_ID"]
end

Instance Attribute Details

#fcm_keyObject

Returns the value of attribute fcm_key.



3
4
5
# File 'lib/inova_fcm/configuration.rb', line 3

def fcm_key
  @fcm_key
end

#firebase_admin_sdk_pathObject

Returns the value of attribute firebase_admin_sdk_path.



3
4
5
# File 'lib/inova_fcm/configuration.rb', line 3

def firebase_admin_sdk_path
  @firebase_admin_sdk_path
end

#firebase_project_idObject

Returns the value of attribute firebase_project_id.



3
4
5
# File 'lib/inova_fcm/configuration.rb', line 3

def firebase_project_id
  @firebase_project_id
end

Instance Method Details

#validate!Object



5
6
7
8
9
10
11
12
# File 'lib/inova_fcm/configuration.rb', line 5

def validate!
  required_attributes = [:fcm_key, :firebase_admin_sdk_path, :firebase_project_id]

  required_attributes.each do |attribute|
    value = send(attribute)
    raise ArgumentError, "#{attribute} is required in the configuration" if value.nil? || (value.respond_to?(:empty?) && value.empty?)
  end
end