source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/classic_era_constants.rb | Ruby | mit | 19 | master | 166,388 | CLASSIC_ERA_TIER_ITEMS_BY_SLOT = {
'1' => {
'head' => [16821, 16842, 16846, 16834, 16866, 16795, 16813, 16808, 16854, 226446, 226599, 226495, 226536, 226584, 226638, 226549, 226562, 226658, 226488, 226659, 226607, 226533, 216922, 226670, 226480, 226573, 226622, 226630, 226612, 226590, 226647, 226564],
'sh... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/core_constants.rb | Ruby | mit | 19 | master | 22,370 | CURRENT_VERSION = {
live: 1039,
classic_era: 105,
classic_progression: 312,
classic_anniversary: 203,
}
PREVENT_SKIP_TIMESTAMP = Time.parse("2026-04-06 18:30:00 +0200").to_i
TIME_ZONE = 'Europe/Amsterdam'
HOUR = (1.0 / 24)
SCHEDULER_PAUSE_AFTER_CYCLE = 1 #seconds
WCL_URL = "https://www.warcraftlogs.com:443/... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/pve_constants.rb | Ruby | mit | 19 | master | 21,697 | FIRST_PERIOD_OF_EXPANSION = 1052
CURRENT_SEASON = 17
SEASON_DATA = {
13 => {
first_period: 974,
pvp_season: 38,
spark_label: "Omen Crafted",
keystone_dungeons: [
{ id: 503, name: "Ara-Kara, City of Echoes", mythic_id: 20487, legacy: false },
{ id: 502, name: "City of Threads", mythic_id: ... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/pvp_constants.rb | Ruby | mit | 19 | master | 456 | BRACKETS = {
live: {
'2v2' => 'pvp_bracket_2v2',
'3v3' => 'pvp_bracket_3v3',
'rbg' => 'pvp_bracket_rbg',
},
classic_progression: {
'2v2' => 'pvp_bracket_2v2',
'3v3' => 'pvp_bracket_3v3',
'5v5' => 'pvp_bracket_5v5',
},
classic_anniversary: {
'2v2' => 'pvp_bracket_2v2',
'3v3' => ... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/wotlk_constants.rb | Ruby | mit | 19 | master | 158,169 | WOTLK_TIER_ITEMS_BY_SLOT = {
'7' => {
'head' => [40416, 39496, 39491, 39610, 40421, 39605, 39514, 40528, 40456, 39531, 39561, 40499, 39521, 40473, 40447, 39640, 39583, 40467, 40581, 39578, 40505, 40546, 40576, 39635, 39594, 39628, 40461, 40565, 39625, 40510, 39553, 39619, 40554, 39545, 39602, 40516, 40521, 40... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/message_constants.rb | Ruby | mit | 19 | master | 2,781 | # User-facing messages
VERSION_MESSAGE = "Your spreadsheet is out of date, for more features click the update arrow below."
NO_WARNING = "good|All added members are being tracked, there are no problems!"
INACTIVE_WARNING = "warning|Your sheet has stopped refreshing or will in a few days. Please check wowaudit.com an... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/tbc_constants.rb | Ruby | mit | 19 | master | 141,716 | TBC_TIER_ITEMS_BY_SLOT = {
'4' => {
'head' => [29076, 29021, 28963, 29044, 29049, 29068, 29040, 29098, 29073, 29081, 29011, 29061, 29028, 29035, 29093, 29086, 29058],
'shoulder' => [29023, 29070, 29037, 29100, 29043, 29079, 28967, 29031, 29075, 29047, 29089, 29064, 29054, 29060, 29095, 29084, 29016],
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/gear_constants.rb | Ruby | mit | 19 | master | 27,035 | base_items = [
'main_hand',
'off_hand',
'head',
'neck',
'shoulder',
'back',
'chest',
'wrist',
'hands',
'waist',
'legs',
'feet',
'finger_1',
'finger_2',
'trinket_1',
'trinket_2'
]
ITEMS = {
live: base_items,
classic_era: base_items + ['ranged'],
classic_progression: base_items,
c... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/reputation_constants.rb | Ruby | mit | 19 | master | 493 | FACTIONS = {
0 => 'Alliance',
1 => 'Horde',
2 => 'Neutral'
}
REPUTATIONS = {
2710 => "silvermoon_court",
2696 => "amani_tribe",
2704 => 'harati',
2699 => "the_singularity",
}
RAID_BUFF_IDS = []
STANDINGS = {
0 => 'Hated',
1 => 'Hostile',
2 => 'Unfriendly',
3 => 'Neutral',
4 => 'Friendly',
5... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/constants/cata_constants.rb | Ruby | mit | 19 | master | 119,464 | CATA_TIER_ITEMS_BY_SLOT = {
'11' => {
'head' => [60243, 60303, 60341, 60286, 60325, 60299, 60346, 60256, 60328, 60359, 60282, 60315, 60351, 60249, 60320, 60356, 60258, 60277, 60308, 65241, 65206, 65190, 65266, 65200, 65251, 65210, 65221, 65186, 65216, 65181, 65260, 65271, 65226, 65246, 65256, 65235, 65195, 65... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/wowaudit/client.rb | Ruby | mit | 19 | master | 2,068 | module Wowaudit
class Client
def initialize(client_id, client_secret)
authenticate(client_id, client_secret)
RBattlenet.set_options(concurrency: 10, timeout: 5, retries: 5, response_type: :hash)
end
def retrieve(characters, output = {})
api_limited = []
characters.group_by(&:name... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/wowaudit/metadata.rb | Ruby | mit | 19 | master | 350 | module Wowaudit
class Metadata
class << self
def client
@@client ||= Redis.new(
url: "#{ENV['REDIS_HOST']}/#{Wowaudit.redis_suffix}",
password: ENV['REDIS_PASSWORD']
)
end
def store(result)
client.set(result.character.redis_id, result.metadata.to_json... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/wowaudit/result.rb | Ruby | mit | 19 | master | 8,381 | module Wowaudit
class Result
attr_accessor :output, :data, :gems, :ilvl, :character, :changed, :details, :stat_info, :delve_info, :prey_info
def initialize(character, response)
Audit.verify_details(character, character.details, character.realm)
@output = []
@character = character
@de... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/wowaudit/exceptions/character_unavailable.rb | Ruby | mit | 19 | master | 245 | module Wowaudit
module Exception
class CharacterUnavailable < StandardError
def initialize(code)
@code = code
end
def message
"Character data could not be updated (#{@code})."
end
end
end
end |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/guild.rb | Ruby | mit | 19 | master | 422 | module Audit
class Guild < Sequel::Model
one_to_many :api_keys
one_to_many :teams
many_to_one :realm
def path
"#{REALMS[realm_id].region.downcase}/#{REALMS[realm_id].name_for_path}/#{slugged_name}"
end
def slugged_name
name.gsub(" ","-").downcase
end
def api_key
ap... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/api_key.rb | Ruby | mit | 19 | master | 256 | module Audit
class ApiKey < Sequel::Model
many_to_one :guild
def expired?
# Count as expired if the token expires within 30 minutes
token.to_s.length.zero? || !token_expires_at || token_expires_at + 1800 < Time.now
end
end
end |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/realm.rb | Ruby | mit | 19 | master | 3,415 | module Audit
class Realm < Sequel::Model
class << self
def to_slug(to_be_slugged = realm)
slug = to_be_slugged.name.gsub("'","")
slug = slug.gsub("-","")
slug = slug.gsub(" ","-")
slug = slug.gsub("(","")
slug = slug.gsub(")","")
slug = slug.gsub("ê","e")
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/schedule.rb | Ruby | mit | 19 | master | 245 | module Audit
class Schedule < Sequel::Model
many_to_one :api_key
def base_type
if type.include? "blizzard"
"collections"
else
type.gsub("dedicated-", "").gsub("historical_", "")
end
end
end
end |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/data.rb | Ruby | mit | 19 | master | 1,912 | module Audit
class Data
SKIPPABLE = true
class << self
def process(character, data, skipped, realm, temp_character)
{
live: [
Audit::Live::BasicData, Audit::Live::CollectionData, Audit::Live::GearData,
Audit::Live::InstanceData, Audit::Live::ProfessionData, Aud... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/team/team_raiderio.rb | Ruby | mit | 19 | master | 845 | module Audit
class TeamRaiderio < Team
def refresh
return unless REALMS[guild.realm_id].kind == 'live'
characters.each do |character|
realm = REALMS[character.realm_id || guild.realm_id]
uri = RAIDER_IO_URL[0 .. RAIDER_IO_URL.length]
uri["{realm}"] = CGI.escape(realm.blizzard... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/team/team_wcl.rb | Ruby | mit | 19 | master | 1,249 | module Audit
class TeamWcl < Team
def refresh
return unless REALMS[guild.realm_id].kind == 'live'
# Requests are not made in parallel, otherwise
# load on the Warcraft Logs API would be too high
characters.each do |character|
VALID_RAIDS[:live].select{ |r| r['days'].include? Time... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/team/team_blizzard.rb | Ruby | mit | 19 | master | 2,464 | module Audit
class TeamBlizzard < Team
def refresh(authentication_attempt = 0)
RBattlenet.set_options(region: REALMS[guild.realm_id].region, namespace: REALMS[guild.realm_id].namespace, locale: "en_GB", concurrency: 25, timeout: 60, retries: 5, response_type: :hash, eager_children: true)
$errors = { :... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/team/team.rb | Ruby | mit | 19 | master | 2,139 | module Audit
class Team < Sequel::Model
many_to_one :guild
one_to_many :team_ranks
class << self
def refresh(id, refresh_type)
team = self.type(refresh_type).where(id: id).first
return Logger.t(ERROR_TEAM_DELETED, id) unless team
Audit.timestamp = REALMS[team.guild.realm_id]... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/character/character_raiderio.rb | Ruby | mit | 19 | master | 2,892 | module Audit
class CharacterRaiderio < Character
def process_result(response)
if response.code == 200
data = Oj.load response.body
details['raiderio']['score'] =
(data['mythic_plus_scores_by_season'][0]['scores']['all'] rescue 0)
details['raiderio']['season_highest'] =
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/character/character.rb | Ruby | mit | 19 | master | 1,958 | module Audit
class Character < Sequel::Model
many_to_one :realm
attr_accessor :output, :data, :gems, :ilvl, :changed, :details, :realm_slug, :team_rank, :delve_info, :stat_info, :prey_info
dataset_module do
def main
filter(guest: false)
end
end
set_dataset(self.main)
de... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/character/character_wcl.rb | Ruby | mit | 19 | master | 1,837 | module Audit
class CharacterWcl < Character
def process_result(response, raid)
if response.code == 200
raise ApiLimitReachedException if response.headers['content-type'].include?("text/html")
data = Oj.load response.body
store_result(data, raid) unless (data["hidden"] rescue false)
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/models/character/character_blizzard.rb | Ruby | mit | 19 | master | 5,857 | module Audit
class CharacterBlizzard < Character
def init
# Main variables
self.output = []
self.data = last_refresh
self.changed = false
# Populate identifying data regardless of response
self.data['name'] = name
self.data['realm'] = REALMS[realm_id]&.name
self.da... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/utils/logger.rb | Ruby | mit | 19 | master | 514 | module Audit
module Logger
def self.g(msg)
# General log messages
puts "[#{self.timestamp}] - #{msg}"
end
def self.t(msg, team_id)
# Log messages related to a team
puts "[#{self.timestamp}][Team ID: #{team_id}] - #{msg}"
end
def self.c(msg, character_id)
# Log mess... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/utils/bonus_ids.rb | Ruby | mit | 19 | master | 3,211 | # TODO: share with other apps instead of duplicating
module Audit
class BonusIds
BONUS_IDS_BY_SEASON = {
11 => { mythic: 9573..9576, heroic: [9658, 9569, 9570, 9571, 9572, 9581], normal: 9560..9567, raid_finder: 9552..9559, world_advanced: 9544..9551, world_basic: 9536..9543 },
12 => { mythic: 10335..... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/utils/audit.rb | Ruby | mit | 19 | master | 7,279 | module Audit
@@reset_timestamp = nil
class << self
def refresh(entities, type)
query = []
entities.each do |team|
begin
Logger.t(INFO_TEAM_STARTING, team.to_i)
(type.include?("keystones") ? Realm : Team).refresh(team.to_i, type)
rescue ApiLimitReachedException
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/utils/scheduler.rb | Ruby | mit | 19 | master | 2,258 | module Audit
class Scheduler
TIMEOUTS = {
collections: 5,
raiderio: 60,
wcl: 15,
keystones: 5,
}
def initialize
stats = {}
loop do
schedule = Schedule.all
schedule.each do |worker|
worker.schedule ||= Scheduler.schedule_work(worker).to_json
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/utils/writer.rb | Ruby | mit | 19 | master | 966 | module Audit
module Writer
def self.write(team, result, header)
json = ([header] + result.sort_by{|c| c.name}.map(&:output).compact.reject(&:empty?)).to_json
file = STORAGE[REALMS[team.guild.realm_id].kind.to_sym].bucket(BUCKET).object("#{team.key}.json")
file.put(body: json)
Logger.t(IN... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/utils/season.rb | Ruby | mit | 19 | master | 625 | # TODO: migrate the core workers to also leverage the proper seasons.
# For now, we'll just hardcode the current season.
module Audit
class Season
class << self
def current
@current_season ||= OpenStruct.new(id: CURRENT_SEASON, data: SEASON_DATA[CURRENT_SEASON])
end
def slugified_... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/utils/redis.rb | Ruby | mit | 19 | master | 403 | module Audit
module Redis
def self.get_characters(ids)
return {} unless ids.any?
REDIS.mget(*ids).map.with_index do |data, i|
[ids[i], data ? Oj.load(data) : {}]
end.to_h
end
def self.update(characters)
if characters.any?
REDIS.mset characters.map{ |character| [cha... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/utils/gear_score.rb | Ruby | mit | 19 | master | 2,825 | # Based on https://github.com/anzz1/TacoTip/blob/master/gearscore.lua
module Audit
class GearScore
DEFAULT_SCALE = 1.8618
# Value for WOTLK
BRACKET_SIZE = 1000
SLOT_SCALE = {
main_hand: 1,
off_hand: 1,
head: 1,
neck: 0.5625,
shoulder: 0.75,
back: 0.5625,
ch... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_anniversary/gear_data.rb | Ruby | mit | 19 | master | 6,958 | module Audit
module ClassicAnniversary
class GearData < Data
def add
# Check equipped gear
items_equipped = 0
@character.data['empty_sockets'] = 0
@character.data['meta_gem_quality'] = 0
# Wipe current gear (it will be repopulated)
@character.details['current... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_anniversary/header_data.rb | Ruby | mit | 19 | master | 1,268 | module Audit
module ClassicAnniversary
class HeaderData
def self.altered_header(team)
new_header = HEADER[:classic_anniversary][0 .. HEADER[:classic_anniversary].length] #Copy the original header
# Parse refresh time, spreadsheet expects Europe/Amsterdam time zone
new_header[0] = A... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_anniversary/basic_data.rb | Ruby | mit | 19 | master | 250 | module Audit
module ClassicAnniversary
class BasicData < Data
SKIPPABLE = false
def add
Audit::Live::BasicData.new(@character, @data, @skipped, @realm, @temp_character).add(:classic_anniversary)
end
end
end
end |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_anniversary/pvp_data.rb | Ruby | mit | 19 | master | 1,052 | module Audit
module ClassicAnniversary
class PvPData < Data
def add
if @data[:pvp_summary]
@character.data['honorable_kills'] = @data[:pvp_summary][:honorable_kills]
BRACKETS[:classic_anniversary].each do |bracket, endpoint|
if @data[endpoint.to_sym] && !@data[endpoi... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_progression/gear_data.rb | Ruby | mit | 19 | master | 6,972 | module Audit
module ClassicProgression
class GearData < Data
def add
# Check equipped gear
items_equipped = 0
@character.data['empty_sockets'] = 0
@character.data['meta_gem_quality'] = 0
# Wipe current gear (it will be repopulated)
@character.details['current... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_progression/profession_data.rb | Ruby | mit | 19 | master | 3,440 | module Audit
module ClassicProgression
class ProfessionData < Data
ENCHANTMENTS_BY_PROFESSION = {
jewelcrafting: [83151, 83150, 83142, 83141, 83143, 93409, 83146, 83149, 83152, 83147, 93404, 93406, 83145, 83148, 93408, 93410, 93405, 83144],
enchanting: [4360, 4359, 4807, 4361],
engin... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_progression/header_data.rb | Ruby | mit | 19 | master | 1,268 | module Audit
module ClassicProgression
class HeaderData
def self.altered_header(team)
new_header = HEADER[:classic_progression][0 .. HEADER[:classic_progression].length] #Copy the original header
# Parse refresh time, spreadsheet expects Europe/Amsterdam time zone
new_header[0] = A... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_progression/pvp_data.rb | Ruby | mit | 19 | master | 1,377 | module Audit
module ClassicProgression
class PvPData < Data
def add
if @data[:pvp_summary]
@character.data['honorable_kills'] = @data[:pvp_summary][:honorable_kills]
BRACKETS[:classic_progression].each do |bracket, endpoint|
if @data[endpoint.to_sym] && !@data[endpoi... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_progression/basic_data.rb | Ruby | mit | 19 | master | 250 | module Audit
module ClassicProgression
class BasicData < Data
SKIPPABLE = false
def add
Audit::Live::BasicData.new(@character, @data, @skipped, @realm, @temp_character).add(:classic_progression)
end
end
end
end |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_progression/collection_data.rb | Ruby | mit | 19 | master | 987 | module Audit
module ClassicProgression
class CollectionData < Data
def add
@character.data['achievement_points'] = @data[:achievement_points]
{
exalted_amount: 523,
mounts_obtained: 2141,
unique_pets: 15,
quests_done_total: 508,
dailies_done... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_progression/instance_data.rb | Ruby | mit | 19 | master | 1,886 | module Audit
module ClassicProgression
class InstanceData < Data
def add
encounters_by_raid = VALID_RAIDS[:classic_progression].map{ |raid|
raid['encounters'].map{ |boss|
boss['raid_ids']
}
}
boss_ids = encounters_by_raid.flatten.map{ |encounter| encou... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_era/gear_data.rb | Ruby | mit | 19 | master | 5,620 | module Audit
module ClassicEra
class GearData < Data
def add
# Check equipped gear
items_equipped = 0
# Wipe current gear (it will be repopulated)
@character.details['current_gear'] = {}
# Quickfix to not have a 0 returned, which messes up the spreadsheet
@c... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_era/pvp_data.rb | Ruby | mit | 19 | master | 637 | module Audit
module ClassicEra
class PvPData < Data
def add
if @data[:pvp_summary]
@character.data['honor_level'] = [@data[:pvp_summary][:pvp_rank] || 0, 14].min
@character.data['honor_title'] = CLASSIC_ERA_HONOR_TITLES.dig(@data.dig(:faction, :name).downcase.to_sym, @character.d... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_era/basic_data.rb | Ruby | mit | 19 | master | 234 | module Audit
module ClassicEra
class BasicData < Data
SKIPPABLE = false
def add
Audit::Live::BasicData.new(@character, @data, @skipped, @realm, @temp_character).add(:classic_era)
end
end
end
end |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/classic_era/header_data.rb | Ruby | mit | 19 | master | 1,188 | module Audit
module ClassicEra
class HeaderData
def self.altered_header(team)
new_header = HEADER[:classic_era][0 .. HEADER[:classic_era].length] #Copy the original header
# Parse refresh time, spreadsheet expects Europe/Amsterdam time zone
new_header[0] = Audit.now.strftime("%d-%m... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/profession_data.rb | Ruby | mit | 19 | master | 1,010 | module Audit
module Live
class ProfessionData < Data
def add
if !@data[:professions][:empty] && @data[:professions][:primaries]
spark_items = []
professions = @data[:professions][:primaries].select{ |p| BASE_PROFESSIONS.keys.include?(p[:profession][:id]) }
professions.... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/gear_data.rb | Ruby | mit | 19 | master | 13,223 | module Audit
module Live
class GearData < Data
def add
# Check equipped gear
sparks_used = 0
embellished_found = 0
total_upgrades_missing = 0
@character.data['empty_sockets'] = 0
@character.data['epic_gem'] = 0
BonusIds::DIFFICULTY_LABELS.keys.each { |... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/quest_data.rb | Ruby | mit | 19 | master | 2,301 | module Audit
module Live
class QuestData < Data
def add
if @achievements
@character.data['quests_done_total'] = @achievements[508][:criteria][:child_criteria].first[:amount] rescue 0
@character.data['wqs_done_total'] = @achievements[11132][:criteria][:child_criteria].first[:amoun... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/pvp_data.rb | Ruby | mit | 19 | master | 2,644 | module Audit
module Live
class PvPData < Data
def add
if @data[:pvp_summary]
@character.data['honor_level'] = @data[:pvp_summary][:honor_level]
@character.data['honorable_kills'] = @achievements[513][:criteria][:child_criteria].first[:amount] rescue @data[:pvp_summary][:honorable... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/delve_data.rb | Ruby | mit | 19 | master | 2,614 | module Audit
module Live
class DelveData < Data
def add
delves_this_week = []
begin
delve_category = @data[:achievement_statistics][:categories].find do |category|
category[:name] == "Delves"
end
delve_meta = delve_category[:sub_categories].first[:... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/historical_data.rb | Ruby | mit | 19 | master | 3,263 | module Audit
module Live
class HistoricalData < Data
SKIPPABLE = false
def add
wqs = []
mplus = []
vault = { 1 => [], 2 => [], 3 => [], 4 => [], 5 => [], 6 => [], 7 => [], 8 => [], 9 => [] }
(FIRST_PERIOD_OF_EXPANSION..(Audit.period)).each_with_index do |period, index... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/external_data.rb | Ruby | mit | 19 | master | 3,290 | module Audit
module Live
class ExternalData < Data
SKIPPABLE = false
def add
add_warcraftlogs_data
add_raiderio_data
add_leaderboard_data
end
def add_warcraftlogs_data
RAID_DIFFICULTIES.each_key do |diff|
output = []
WCL_IDS[:live].each... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/reputation_data.rb | Ruby | mit | 19 | master | 804 | module Audit
module Live
class ReputationData < Data
def add
total_renown = 0
unless !@data[:reputations]
REPUTATIONS.each do |reputation, name|
match = (@data[:reputations].lazy.select{ |r| r&.dig(:faction,:id) == reputation }.first rescue nil)
if match
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/timeline_data.rb | Ruby | mit | 19 | master | 912 | module Audit
module Live
class TimelineData < Data
def add
timeline = {}
return unless @achievements
TIMELINE_EVENTS.each do |event_id, event|
event[:criteria].each_with_index do |criterion, index|
achievement_id = criterion[:achievement_id]
achiev... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/instance_data.rb | Ruby | mit | 19 | master | 7,176 | module Audit
module Live
class InstanceData < Data
def add
encounters_by_raid = VALID_RAIDS[:live].map{ |raid|
raid['encounters'].map{ |boss|
boss['raid_ids']
}
}
boss_ids = encounters_by_raid.flatten.map{ |encounter| encounter.values }.flatten
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/collection_data.rb | Ruby | mit | 19 | master | 2,160 | module Audit
module Live
class CollectionData < Data
def add
@character.data['achievement_points'] = @data[:achievement_points]
begin
crest_stats = @data[:achievement_statistics][:categories].find do |category|
category[:name] == "Character"
end[:statistics]
... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/basic_data.rb | Ruby | mit | 19 | master | 2,584 | module Audit
module Live
class BasicData < Data
SKIPPABLE = false
def add(type = :live)
@character.data['name'] = @temp_character.name
@character.data['realm'] = (defined?(REALMS) ? REALMS : {})[@temp_character.realm_id]&.name
@character.data['realm_slug'] = (defined?(@temp_ch... |
github | wowaudit/core | https://github.com/wowaudit/core | lib/sections/live/header_data.rb | Ruby | mit | 19 | master | 1,497 | module Audit
module Live
class HeaderData
def self.altered_header(team)
new_header = HEADER[:live][0 .. HEADER[:live].length] #Copy the original header
# Parse refresh time, spreadsheet expects Europe/Amsterdam time zone
new_header[0] = Audit.now.strftime("%d-%m %H:%M")
# ... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | store_schema.gemspec | Ruby | mit | 19 | master | 1,067 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "store_schema/version"
Gem::Specification.new do |s|
s.name = "store_schema"
s.version = StoreSchema::VERSION
s.license = "MIT"
s.summary = %q{Enhances `ActiveRecord::Base.store_accessor` with data... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | Rakefile | Ruby | mit | 19 | master | 347 | require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
desc "Runs the doc server (yard)"
task :doc do |t, args|
require "yard"
YARD::CLI::CommandParser.run("server", "--reload")
end
desc "Run tes... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | test/store_schema_test.rb | Ruby | mit | 19 | master | 4,663 | require "test_helper"
models = [
PostgreSQLJSONWebsite,
PostgreSQLYAMLWebsite,
PostgreSQLHStoreWebsite,
MySQLJSONWebsite,
MySQLYAMLWebsite,
SQLiteJSONWebsite,
SQLiteYAMLWebsite,
]
models.each do |model|
describe "StoreSchema with #{model}" do
describe "nil" do
it "stays nil" do
we... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | test/test_helper.rb | Ruby | mit | 19 | master | 276 | require "simplecov"
SimpleCov.start
require "sqlite3"
require "active_record"
require_relative "../lib/store_schema"
require_relative "support/connections"
require_relative "support/schemas"
require_relative "support/models"
require "minitest/autorun"
require "minitest/spec" |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | test/support/schemas.rb | Ruby | mit | 19 | master | 1,385 | # PostgreSQL
ActiveRecord::Base.establish_connection(CONNECTIONS[:prepare][:postgresql])
ActiveRecord::Base.connection.recreate_database(:store_schema)
ActiveRecord::Base.establish_connection(CONNECTIONS[:postgresql])
Class.new(ActiveRecord::Migration[5.1]) do
def change
enable_extension "hstore"
create_tabl... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | test/support/models.rb | Ruby | mit | 19 | master | 1,062 | class CommonModel < ActiveRecord::Base
self.abstract_class = true
store_schema :config do |s|
s.string :name
s.integer :visitors
s.float :apdex
s.boolean :ssl
s.datetime :published_at
end
end
class PostgreSQLModel < CommonModel
self.abstract_class = true
establish_connection(CONNEC... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | test/support/connections.rb | Ruby | mit | 19 | master | 446 | CONNECTIONS = {
:prepare => {
:postgresql => "postgres://#{`whoami`.strip}:postgres@127.0.0.1:5432/postgres",
:mysql => "mysql2://root:root@127.0.0.1:#{ENV["MYSQL_PORT"] || 3306}/store_schema",
},
:postgresql => "postgres://#{`whoami`.strip}:postgres@127.0.0.1:5432/store_schema",
:mysql => "my... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema.rb | Ruby | mit | 19 | master | 374 | # frozen_string_literal: true
module StoreSchema
require_relative "store_schema/accessor_definer"
require_relative "store_schema/configuration"
require_relative "store_schema/converter"
require_relative "store_schema/module"
require_relative "store_schema/version"
end
if defined?(ActiveRecord::Base)
Activ... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/converter.rb | Ruby | mit | 19 | master | 1,107 | # frozen_string_literal: true
class StoreSchema::Converter
require_relative "converter/string"
require_relative "converter/integer"
require_relative "converter/float"
require_relative "converter/date_time"
require_relative "converter/boolean"
# @return [Hash] a mapping between the configuration block
# ... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/accessor_definer.rb | Ruby | mit | 19 | master | 1,772 | # frozen_string_literal: true
class StoreSchema::AccessorDefiner
# @return [Class]
#
attr_reader :klass
# @return [Symbol]
#
attr_reader :column
# @return [Symbol]
#
attr_reader :type
# @return [Symbol]
#
attr_reader :attribute
# @param klass [Class] the class to define the accessor on
... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/module.rb | Ruby | mit | 19 | master | 821 | # frozen_string_literal: true
module StoreSchema::Module
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# @example
#
# # Gemfile
# gem "store_schema"
#
# # app/models/website.rb
# class Website < ActiveRecord::Base
#
# store_schema... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/configuration.rb | Ruby | mit | 19 | master | 1,628 | # frozen_string_literal: true
class StoreSchema::Configuration
# @return [Symbol]
#
attr_reader :column
# @return [Hash]
#
attr_reader :attributes
# @param column [Symbol] the table column to generate the accessors for
#
def initialize(column)
@column = column
@attributes = {}
end
... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/converter/string.rb | Ruby | mit | 19 | master | 464 | # frozen_string_literal: true
require_relative "base"
class StoreSchema::Converter::String < StoreSchema::Converter::Base
# Simply returns {#value} if it's a String.
#
# @return [String, false] false if {#value} is an invalid date-type.
#
def to_db
if value.is_a?(::String)
value
else
fa... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/converter/integer.rb | Ruby | mit | 19 | master | 648 | # frozen_string_literal: true
require_relative "base"
class StoreSchema::Converter::Integer < StoreSchema::Converter::Base
# @return [Regexp] the int value format.
#
INT_FORMAT = /^\d+$/
# Converts the {#value} to a database-storable value.
#
# @return [String, false] false if {#value} is an invalid dat... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/converter/float.rb | Ruby | mit | 19 | master | 723 | # frozen_string_literal: true
require_relative "base"
class StoreSchema::Converter::Float < StoreSchema::Converter::Base
# @return [Regexp] an (int | float) value format.
#
INT_FLOAT_FORMAT = /^\d+|\d+\.\d+$/
# Converts the {#value} to a database-storable value.
#
# @return [String, false] false if {#va... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/converter/date_time.rb | Ruby | mit | 19 | master | 805 | # frozen_string_literal: true
require_relative "base"
class StoreSchema::Converter::DateTime < StoreSchema::Converter::Base
# @return [String] the database format for storing a DateTime object.
#
DATETIME_DB_FORMAT = "%Y-%m-%d %H:%M:%S.%N"
# Converts the {#value} to a database-storable value.
#
# @retur... |
github | mrrooijen/store_schema | https://github.com/mrrooijen/store_schema | lib/store_schema/converter/boolean.rb | Ruby | mit | 19 | master | 1,163 | # frozen_string_literal: true
require_relative "base"
class StoreSchema::Converter::Boolean < StoreSchema::Converter::Base
# @return [String] the database representation of a true value.
#
DB_TRUE_VALUE = "t"
# @return [String] the database representation of a false value.
#
DB_FALSE_VALUE = "f"
# @r... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | manageiq-providers-amazon.gemspec | Ruby | apache-2.0 | 19 | master | 1,735 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'manageiq/providers/amazon/version'
Gem::Specification.new do |spec|
spec.name = "manageiq-providers-amazon"
spec.version = ManageIQ::Providers::Amazon::VERSION
spec.authors ... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | Gemfile | Ruby | apache-2.0 | 19 | master | 596 | # Declare your gem's dependencies in manageiq-providers-amazon.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead of in
# your gemspec... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | Rakefile | Ruby | apache-2.0 | 19 | master | 339 | require 'bundler/setup'
begin
require 'rspec/core/rake_task'
APP_RAKEFILE = File.expand_path("spec/manageiq/Rakefile", __dir__)
load 'rails/tasks/engine.rake'
load 'rails/tasks/statistics.rake'
rescue LoadError
end
require 'bundler/gem_tasks'
FileList['lib/tasks_private/**/*.rake'].each { |r| load r }
task... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | lib/manageiq/providers/amazon/engine.rb | Ruby | apache-2.0 | 19 | master | 590 | module ManageIQ
module Providers
module Amazon
class Engine < ::Rails::Engine
isolate_namespace ManageIQ::Providers::Amazon
config.autoload_paths << root.join('lib')
def self.vmdb_plugin?
true
end
def self.plugin_name
_('Amazon Provider')
... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | lib/tasks/amazon.rake | Ruby | apache-2.0 | 19 | master | 205 | #namespace :manageiq do
# namespace :providers do
# namespace :amazon do
# desc "Explaining what the task does"
# task :your_task do
# # Task goes here
# end
# end
# end
#end |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | lib/tasks_private/instance_types.rake | Ruby | apache-2.0 | 19 | master | 4,702 | namespace 'aws:extract' do
desc 'Get / renew instance_types'
task :instance_types do
# Instance Types provided by the AWS SDK do not have sufficient info for provisioning
#
# This task creates a db/fixtures/aws_instance_types.yml file with data from
# https://raw.githubusercontent.com/powdahound/ec... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | lib/tasks_private/release.rake | Ruby | apache-2.0 | 19 | master | 1,199 | namespace :release do
desc "Tasks to run on a new branch when a new branch is created"
task :new_branch do
require 'pathname'
branch = ENV["RELEASE_BRANCH"]
if branch.nil? || branch.empty?
STDERR.puts "ERROR: You must set the env var RELEASE_BRANCH to the proper value."
exit 1
end
... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | lib/tasks_private/regions.rake | Ruby | apache-2.0 | 19 | master | 1,348 | # frozen_string_literal: true
namespace 'aws:extract' do
desc 'Get / renew regions list from online source of AWS gem'
task :regions do
require 'uri'
require 'set'
require 'json'
require 'yaml'
require 'net/http'
engine_root = ManageIQ::Providers::Amazon::Engine.root
# path valid for ... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | lib/tasks_private/database_types.rake | Ruby | apache-2.0 | 19 | master | 1,182 | namespace 'aws:extract' do
desc 'Get / refresh database_types'
task :database_types do
require 'open-uri'
instances = URI.open("https://instances.vantage.sh/rds/instances.json") do |io|
JSON.parse(io.read)
end
results = instances.map do |instance|
network_performance = instance["networ... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | lib/tasks_private/spec.rake | Ruby | apache-2.0 | 19 | master | 253 | namespace :spec do
desc "Setup environment specs"
task :setup => ["app:test:vmdb:setup"]
end
desc "Run all specs"
RSpec::Core::RakeTask.new(:spec => ['app:test:spec_deps', 'app:test:providers_common']) do |t|
EvmTestHelper.init_rspec_task(t)
end |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/spec_helper.rb | Ruby | apache-2.0 | 19 | master | 549 | if ENV['CI']
require 'simplecov'
SimpleCov.start
end
Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f }
Dir[File.join(__dir__, "support/**/*.rb")].each { |f| require f }
require "manageiq/providers/amazon"
VCR.configure do |config|
config.ignore_hosts 'codeclimate.com' if ENV['CI']
config.cas... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/tools/refresh_performance/aws_refresh_performance_network_manager.rb | Ruby | apache-2.0 | 19 | master | 12,286 | require_relative '../../models/manageiq/providers/amazon/aws_helper'
require_relative '../../models/manageiq/providers/amazon/aws_stubs'
describe ManageIQ::Providers::Amazon::NetworkManager::Refresher do
include AwsStubs
describe "refresh" do
before(:each) do
_guid, _server, zone = EvmSpecHelper.create_... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/tools/refresh_performance/aws_refresh_performance_cloud_manager.rb | Ruby | apache-2.0 | 19 | master | 13,830 | require_relative '../../models/manageiq/providers/amazon/aws_helper'
require_relative '../../models/manageiq/providers/amazon/aws_stubs'
describe ManageIQ::Providers::Amazon::CloudManager::Refresher do
include AwsStubs
describe "refresh" do
before(:each) do
_guid, _server, zone = EvmSpecHelper.create_gu... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/factories/orchestration_template.rb | Ruby | apache-2.0 | 19 | master | 959 | FactoryBot.define do
factory :orchestration_template_amazon,
:parent => :orchestration_template,
:class => "ManageIQ::Providers::Amazon::CloudManager::OrchestrationTemplate" do
sequence(:content) { |n| "{\"AWSTemplateFormatVersion\" : \"version(#{seq_padded_for_sorting(n)})\"}" }
end
fac... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/factories/ext_management_system.rb | Ruby | apache-2.0 | 19 | master | 1,074 | FactoryBot.define do
factory :ems_amazon_ebs,
:aliases => ["manageiq/providers/amazon/storage_manager/ebs"],
:class => "ManageIQ::Providers::Amazon::StorageManager::Ebs",
:parent => :ems_storage do
provider_region { "us-east-1" }
end
factory :ems_amazon_with_vcr_authenticatio... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/factories/cloud_object_store.rb | Ruby | apache-2.0 | 19 | master | 669 | FactoryBot.define do
factory :aws_object, :class => ManageIQ::Providers::Amazon::StorageManager::S3::CloudObjectStoreObject.name do |object|
object.sequence(:key) { |n| "object-key-#{n}" }
end
factory :aws_bucket_with_objects,
:class => ManageIQ::Providers::Amazon::StorageManager::S3::CloudObjectSt... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/factories/cloud_volume.rb | Ruby | apache-2.0 | 19 | master | 851 | FactoryBot.define do
factory :cloud_volume_amazon, :parent => :cloud_volume,
:class => "ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolume"
factory :cloud_volume_amazon_standard,
:parent => :cloud_volume,
:class => "ManageIQ::Providers::Amazon::Storag... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/factories/cloud_volume_snapshot.rb | Ruby | apache-2.0 | 19 | master | 225 | FactoryBot.define do
factory :cloud_volume_snapshot_amazon, :parent => :cloud_volume_snapshot,
:class => "ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolumeSnapshot"
end |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/models/authenticator/amazon_spec.rb | Ruby | apache-2.0 | 19 | master | 17,241 | require 'aws-sdk-iam'
require 'aws-sdk-ec2'
describe Authenticator::Amazon do
AWS_ROOT_USER_KEY = 'aws_root_key'.freeze
AWS_IAM_USER_KEY = 'AWS_IAM_KEY'.freeze
subject { Authenticator::Amazon.new(config) }
let(:local_user) { FactoryBot.create(:user, :userid => username) }
let(:username) { 'some_user' }
l... |
github | ManageIQ/manageiq-providers-amazon | https://github.com/ManageIQ/manageiq-providers-amazon | spec/models/dialog/orchestration_template_amazon_service_dialog_spec.rb | Ruby | apache-2.0 | 19 | master | 2,002 | describe "OrchestrationTemplateServiceDialog for Amazon" do
let(:dialog_service) { Dialog::OrchestrationTemplateServiceDialog.new }
let(:template_amazon) { FactoryBot.create(:orchestration_template_amazon_in_json) }
describe "#create_dialog" do
it "creates a dialog from CloudFormation template with stack ba... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.