Module: Wavesync::Transport

Defined in:
lib/wavesync/transport.rb,
lib/wavesync/transport/mtp.rb,
lib/wavesync/transport/filesystem.rb

Defined Under Namespace

Classes: Filesystem, Mtp

Constant Summary collapse

SUPPORTED_KINDS =
%w[filesystem mtp].freeze

Class Method Summary collapse

Class Method Details

.for(device_config) ⇒ Object

: ({ name: String, model: String, path: String, transport: String?, mp3_bitrate: Integer } device_config) -> (Filesystem | Mtp)



9
10
11
12
13
14
15
16
# File 'lib/wavesync/transport.rb', line 9

def self.for(device_config)
  kind = device_config[:transport] || 'filesystem'
  case kind
  when 'filesystem' then Filesystem.new(device_config)
  when 'mtp' then Mtp.new(device_config)
  else raise ArgumentError, "Unsupported transport: #{kind.inspect}. Supported: #{SUPPORTED_KINDS.join(', ')}"
  end
end