Sha256: a72449a2c9b1b2947fef035db80bf38f99debe76a58cd4c3810a1438c3be24d9

Contents?: true

Size: 459 Bytes

Versions: 1

Compression:

Stored size: 459 Bytes

Contents

class GameLockerAPI
  class Telemetry
    attr_accessor :events
    Event = Struct.new(:time, :type, :payload)
    def initialize(telemetry_url)
      @events  = []
      response = RestClient.get(telemetry_url)
      parse(response.body)

      return self
    end

    def parse(json)
      Oj.load(json).each do |event|
        @events << Event.new(Time.parse(event['time']), event['type'], event['payload'])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamelocker_api-0.1.4 lib/gamelocker_api/telemetry.rb