Class: CbsFantasySportsApiTokenFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/cbs_fantasy_sports_api_token_fetcher.rb

Constant Summary collapse

TOKEN_REGEX =
/(?<=var token = ").+(?=")/
URL =
"https://www.cbssports.com/login".freeze
VERSION =
"0.1.0"

Instance Method Summary collapse

Constructor Details

#initialize(league_name:, password:, user_id:) ⇒ CbsFantasySportsApiTokenFetcher

Returns a new instance of CbsFantasySportsApiTokenFetcher.



8
9
10
11
12
# File 'lib/cbs_fantasy_sports_api_token_fetcher.rb', line 8

def initialize(league_name:, password:, user_id:)
  @league_name = league_name
  @password = password
  @user_id = user_id
end

Instance Method Details

#fetchObject



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

def fetch
  page.match(TOKEN_REGEX).to_s
end