class Probasketball::Collections::BaseCollection

Public Class Methods

new(api, url) click to toggle source
# File lib/probasketball/collections.rb, line 3
def initialize(api, url)
  @api = api
  @url = url
end

Public Instance Methods

fetch(options = {}) click to toggle source
# File lib/probasketball/collections.rb, line 12
def fetch(options = {})
  call!(options)
end
fetchAll() click to toggle source
# File lib/probasketball/collections.rb, line 8
def fetchAll
  call!
end
find(options) click to toggle source
# File lib/probasketball/collections.rb, line 16
def find(options)
  !call(options).first
end

Private Instance Methods

call!(options = {}) click to toggle source
# File lib/probasketball/collections.rb, line 22
def call!(options = {})
  response = @api.post(@url, options)
  return response.body if response.success?
  fail Probasketball::ApiError, response.body[:error]
end