Class: Edools::Core::Address

Inherits:
Base
  • Object
show all
Defined in:
lib/edools/core/address.rb

Class Method Summary collapse

Methods inherited from Base

refresh_config!, version, version=

Class Method Details

.collection_path(prefix_options = {}, query_options = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/edools/core/address.rb', line 7

def self.collection_path(prefix_options = {}, query_options = nil)
  super

  student_id = prefix_options[:student_id] || query_options.try(:[], :student_id)
  collaborator_id = prefix_options[:collaborator_id] || query_options.try(:[], :collaborator_id)

  if student_id
    "/students/#{student_id}/#{collection_name}.#{format.extension}#{query_string(query_options)}"
  elsif collaborator_id
    "/collaborators/#{collaborator_id}/#{collection_name}.#{format.extension}#{query_string(query_options)}"
  end
end