Class: LoraRb::Protocol

Inherits:
Object
  • Object
show all
Defined in:
lib/core/protocol.rb

Overview

It contains protocols methods

Constant Summary collapse

PROVIDERS =
{ fractalgarden: [:mqtt],
              a2a: [:mqtt],
              loriot: [:tls],
              resiot: [:http]
}

Class Method Summary collapse

Class Method Details

.provider_is_valid?(provider: LoraRb.configuration.provider) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/core/protocol.rb', line 12

def self.provider_is_valid?(provider: LoraRb.configuration.provider)
  PROVIDERS.has_key? provider
end

.supported?(provider: LoraRb.configuration.provider, protocol: LoraRb.configuration.protocol) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/core/protocol.rb', line 15

def self.supported?(provider: LoraRb.configuration.provider,
                             protocol: LoraRb.configuration.protocol)
  return unless provider && protocol
  PROVIDERS[provider] && PROVIDERS[provider].include?(protocol.to_sym)
end