# frozen_string_literal: true require "espn_ffl_api/version" require "espn_ffl_api/api_client" require "espn_ffl_api/owner" require "espn_ffl_api/team" require "espn_ffl_api" require "dotenv" EspnAPI = EspnFflApi module EspnFflApi Dotenv.load class Error < StandardError; end @config = { league_id: ENV["ESPN_LEAGUE_ID"], base_uri: ENV["ESPN_API_URL_BASE"] } def self.config OpenStruct.new(@config) end def self.client @@client ||= ApiClient.new(2019) end def self.owners client.views = [:team] @@owners ||= client.get["members"].map do |member_hash| Owner.build(member_hash) end end def self.teams client.views = [:team] @@teams ||= client.get["teams"].map do |team_hash| Team.build(team_hash) end end end