Class: AocCli::Tools::Request

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

Direct Known Subclasses

Convert

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(u: Metafile.get(:user), y: Metafile.get(:year), d: Metafile.get(:day), p:) ⇒ Request

Returns a new instance of Request.



6
7
8
9
10
11
12
13
14
15
# File 'lib/aoc_cli/tools.rb', line 6

def initialize(u:Metafile.get(:user),
         y:Metafile.get(:year),
         d:Metafile.get(:day), p:)
  @user = Validate.user(u)
  @year = Validate.year(y)
  @day  = d
  @page = p
  @base = "https://adventofcode.com/#{year}"
  @ua   = "github.com/apexatoll/aoc-cli"
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



5
6
7
# File 'lib/aoc_cli/tools.rb', line 5

def base
  @base
end

#dayObject (readonly)

Returns the value of attribute day.



5
6
7
# File 'lib/aoc_cli/tools.rb', line 5

def day
  @day
end

#pageObject (readonly)

Returns the value of attribute page.



5
6
7
# File 'lib/aoc_cli/tools.rb', line 5

def page
  @page
end

#uaObject (readonly)

Returns the value of attribute ua.



5
6
7
# File 'lib/aoc_cli/tools.rb', line 5

def ua
  @ua
end

#userObject (readonly)

Returns the value of attribute user.



5
6
7
# File 'lib/aoc_cli/tools.rb', line 5

def user
  @user
end

#yearObject (readonly)

Returns the value of attribute year.



5
6
7
# File 'lib/aoc_cli/tools.rb', line 5

def year
  @year
end