class PlayWhe::Fetcher

Attributes

http_adapter[R]
url[R]

Public Class Methods

new(http_adapter, url) click to toggle source
# File lib/playwhe/fetcher.rb, line 7
def initialize(http_adapter, url)
  @http_adapter = http_adapter
  @url = url
end

Public Instance Methods

get(year:, month: nil) click to toggle source
# File lib/playwhe/fetcher.rb, line 12
def get(year:, month: nil)
  y = normalize_year(year)
  m = normalize_month(month)

  response = http_adapter.post(url, year: y, month: m)

  if response.ok?
    response.body
  else
    raise BadResponseError, response
  end
end