Class: HeyYou::Config::FcmPush

Inherits:
Object
  • Object
show all
Extended by:
Configurable
Defined in:
lib/hey_you/config/fcm_push.rb

Constant Summary collapse

REQUIRED_CONFIGS =
%i[credentials_file project_id]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#credentials_fileObject

Returns the value of attribute credentials_file.



4
5
6
# File 'lib/hey_you/config/fcm_push.rb', line 4

def credentials_file
  @credentials_file
end

#project_idObject

Returns the value of attribute project_id.



4
5
6
# File 'lib/hey_you/config/fcm_push.rb', line 4

def project_id
  @project_id
end

Instance Method Details

#validate_configObject

Raises:

  • (HeyYou::Config::Configurable::RequiredConfigsNotPassed)


12
13
14
15
16
17
18
19
20
# File 'lib/hey_you/config/fcm_push.rb', line 12

def validate_config
  @credentials_file = ENV[Google::Auth::CredentialsLoader::ENV_VAR]
  return if REQUIRED_CONFIGS.all? { |conf| send(conf) }

  raise(
    HeyYou::Config::Configurable::RequiredConfigsNotPassed,
    "You must pass all required config for channel `fcm_push`: #{REQUIRED_CONFIGS}"
  )
end