module LoraRb::Base

It contains generic methods

It contains generic methods

Public Instance Methods

lora_decode(payload) click to toggle source
# File lib/lora-rb/utility.rb, line 22
def lora_decode(payload)
  Base64.decode64(payload).unpack("H*").first
end
lora_encode(payload) click to toggle source
# File lib/lora-rb/utility.rb, line 18
def lora_encode(payload)
  Base64.encode64(payload.scan(/.{2}/).map { |b| b.to_i(16).chr }.join)
end
merge_tags_to_url(url, tags={}, options={}) click to toggle source

Substitute tags with data into url

# File lib/lora-rb/utility.rb, line 7
def merge_tags_to_url(url, tags={}, options={})
  url = url.dup
  puts "merge_tags_to_url: #{url}" if options[:debug] == :full
  tags.each do |tag, value|
    puts " replace {#{tag}} with #{value}" if options[:debug] == :full
    url.gsub!("{#{tag}}", value.to_s)
  end
  puts "merge_tags_to_url: completed #{url}" if options[:debug] == :full
  url
end

Private Instance Methods

lorarb_help() click to toggle source

Show tips on usage

# File lib/lora-rb/help.rb, line 8
    def lorarb_help
      <<-HELP.gsub(/^      /, '')
      *************************************************************************
      LoraRb version #{LoraRb.version}
      *************************************************************************
      HELP
    end