Module: TeamSnap::Collection

Defined in:
lib/teamsnap.rb

Instance Method Summary collapse

Instance Method Details

#hrefObject



367
368
369
# File 'lib/teamsnap.rb', line 367

def href
  self.instance_variable_get(:@href)
end

#parse_collectionObject



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/teamsnap.rb', line 379

def parse_collection
  if resp
    if resp.status == 200
      collection = Oj.load(resp.body)
        .fetch(:collection) { [] }
    else
      error_message = TeamSnap.parse_error(resp)
      raise TeamSnap::Error.new(error_message)
    end
  elsif parsed_collection
    collection = parsed_collection
  end

  TeamSnap.apply_endpoints(self, collection)
  enable_find if respond_to?(:search)
end

#parsed_collectionObject



375
376
377
# File 'lib/teamsnap.rb', line 375

def parsed_collection
  self.instance_variable_get(:@parsed_collection)
end

#respObject



371
372
373
# File 'lib/teamsnap.rb', line 371

def resp
  self.instance_variable_get(:@resp)
end