Module: Pandoru::ClientBuilders

Defined in:
lib/pandoru/client_builder.rb

Defined Under Namespace

Classes: APIClientBuilder, FileBasedClientBuilder, PianobarConfigFileBuilder, PianobarSettingsDict, PydoraConfigFileBuilder, SettingsDict, SettingsHash, SettingsHashBuilder, TranslatingHash

Constant Summary collapse

DEFAULT_SETTINGS =

Default Pandora partner settings - these would need to be populated with actual partner credentials The canonical “android” partner. Note the distinction between the partner username (“android”) and the *device model* (“android-generic”) — they are different fields. Sending “android-generic” as the username fails partnerLogin with INVALID_PARTNER_LOGIN. The keys are oriented for the Encryptor’s (decryption_key, encryption_key) argument order.

{
  "PARTNER_USER" => "android",
  "PARTNER_PASSWORD" => "AC7IBG09A3DTSYM4R41UJWL07VLN8JI7",
  "DEVICE" => "android-generic",
  "DECRYPTION_KEY" => "R=U!LH$O2B#",
  "ENCRYPTION_KEY" => "6#26FRL$ZWD",
  "API_HOST" => "tuner.pandora.com"
}.freeze

Class Method Summary collapse

Class Method Details

.default_client(**options) ⇒ Object



343
344
345
346
# File 'lib/pandoru/client_builder.rb', line 343

def default_client(**options)
  settings = DEFAULT_SETTINGS.merge(options)
  from_settings_hash(settings)
end

.from_config_file(path, **options) ⇒ Object



314
315
316
317
318
319
320
321
# File 'lib/pandoru/client_builder.rb', line 314

def from_config_file(path, **options)
  case File.extname(path)
  when '.cfg'
    PydoraConfigFileBuilder.new(path: path, **options).build
  else
    PianobarConfigFileBuilder.new(path: path, **options).build
  end
end

.from_settings_hash(settings, **options) ⇒ Object



323
324
325
# File 'lib/pandoru/client_builder.rb', line 323

def from_settings_hash(settings, **options)
  SettingsHashBuilder.new(settings, **options).build
end