Class: Devbootcamp::Cohort

Inherits:
Model
  • Object
show all
Defined in:
lib/devbootcamp/cohort.rb

Instance Attribute Summary

Attributes inherited from Model

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#as_json, attributes, #initialize, #serializable_hash

Constructor Details

This class inherits a constructor from Devbootcamp::Model

Class Method Details

.allObject



5
6
7
# File 'lib/devbootcamp/cohort.rb', line 5

def self.all
  Devbootcamp::Auth.get("/cohorts", cache_for: 1.week).map(&method(:new))
end

.namesObject



9
10
11
# File 'lib/devbootcamp/cohort.rb', line 9

def self.names
  all.map(&:name)
end

Instance Method Details

#chi?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/devbootcamp/cohort.rb', line 17

def chi?
  location == "Chicago"
end

#sf?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/devbootcamp/cohort.rb', line 13

def sf?
  location == "San Francisco"
end

#usersObject



21
22
23
# File 'lib/devbootcamp/cohort.rb', line 21

def users
  @users ||=Devbootcamp::Auth.get("/cohorts/#{id}/users", cache_for: 1.day).map(&Devbootcamp::User.method(:new))
end