class Fawry::Connection::ParamsSpecialEncoder

Fawry does not understand encoded params so we use this encoder to convert the params hash to a string of query params without encoding { a: 1, b: 2 } => a=1&b=2

Public Class Methods

decode(string) click to toggle source
# File lib/fawry/connection.rb, line 70
def self.decode(string)
  arr = string.split('&')
  arr.map { |str| str.split('=') }.to_h
end
encode(hash) click to toggle source
# File lib/fawry/connection.rb, line 66
def self.encode(hash)
  hash.each_with_object([]) { |(k, v), arr| arr << "#{k}=#{v}" }.join('&')
end