Method: Silkey::SDK.message_to_sign

Defined in:
lib/silkey/sdk.rb

.message_to_sign(to_sign = {}) ⇒ string

Generates message to sign based on plain object data (keys => values)

@example:

Silkey::SDK.message_to_sign({ :redirectUrl => 'http://silkey.io', :refId => 1 });

returns

'redirectUrl=http://silkey.io::refId=1'

Parameters:

  • to_sign (Hash) (defaults to: {})

    hash object

Returns:

  • (string)

    message to sign



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/silkey/sdk.rb', line 21

def message_to_sign(to_sign = {})
  msg = []
  to_sign.keys.sort.each do |k|
    if Silkey::Utils.empty?(to_sign[k])
      msg.push("#{k}=")
    else
      msg.push("#{k}=#{to_sign[k]}")
    end
  end

  msg.join('::')
end