Module: RLS::Utils

Defined in:
lib/rls/utils.rb

Overview

A helper module of various utility methods

Class Method Summary collapse

Class Method Details

.batch_players_from_array(request_data) ⇒ Object

Build an array of hashes for use with the batch endpoint



22
23
24
25
26
27
28
29
30
# File 'lib/rls/utils.rb', line 22

def batch_players_from_array(request_data)
  post_data = []
  request_data.each_slice(2) do |id, platform|
    id = id.to_s
    platform = platform.respond_to?(:id) ? platform.id : platform
    post_data << { uniqueId: id, platformId: platform }
  end
  post_data
end

.time(ts) ⇒ Time

Parses a unix epoch time into a `Time` object.



14
15
16
# File 'lib/rls/utils.rb', line 14

def time(ts)
  Time.at(ts)
end