class Kit::Client

Constants

BLANK_PAGE

Public Class Methods

new() click to toggle source

Creates a new Client

# File lib/kit/client.rb, line 9
def initialize
  @template = Addressable::Template.new(
    'https://legacy.usacycling.org/results/{?compid}'
  )
end

Public Instance Methods

find(license_number) click to toggle source

Builds a Table for the given license-holder

@param license_number [Fixnum] a valid USAC License Number

@return [Member] the member with the given license number

# File lib/kit/client.rb, line 20
def find(license_number)
  Kit::Member.from_table(table_for(license_number))
end

Private Instance Methods

raw(license_number) click to toggle source
# File lib/kit/client.rb, line 36
def raw(license_number)
  url = @template.expand(compid: Integer(license_number))

  HTTP.get(url).to_s
end
table_for(license_number) click to toggle source
# File lib/kit/client.rb, line 26
def table_for(license_number)
  begin
    license_number = Integer(license_number)
  rescue ArgumentError
    Kit::Table.new(BLANK_PAGE)
  else
    Kit::Table.new(raw(license_number))
  end
end