class NerdLog::Report

Attributes

guild_name[R]
http_connection[R]
realm[R]
region[R]

Public Class Methods

new(options) click to toggle source
# File lib/nerd_log/report.rb, line 4
def initialize(options)
  @realm           = options.fetch(:realm)
  @guild_name      = options.fetch(:guild_name)
  @region          = options.fetch(:region, 'US')
  @http_connection = options.fetch(:http_connection, NerdLog.configuration.http_connection)
end

Public Instance Methods

fetch() click to toggle source
# File lib/nerd_log/report.rb, line 20
def fetch
  response = http_connection.get("reports/guild/#{guild_name}/#{realm}/#{region}")

  response
end
reports() click to toggle source
# File lib/nerd_log/report.rb, line 11
def reports
  reports = []
  fetch.body.each do |report|
    reports << OpenStruct.new(id: report['id'], title: report['title'],
                              zone: report['zone'], start_time: report['start'])
  end
  reports
end