Class: Meibo::Demographic

Inherits:
Object
  • Object
show all
Defined in:
lib/meibo/demographic.rb

Direct Known Subclasses

JapanProfile::Demographic

Constant Summary collapse

SEX =
{
  male: "male",
  female: "female",
  unspecified: "unspecified",
  other: "other"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(sourced_id:, status: nil, date_last_modified: nil, birth_date: nil, sex: nil, american_indian_or_alaska_native: nil, asian: nil, black_or_african_american: nil, native_hawaiian_or_other_pacific_islander: nil, white: nil, demographic_race_two_or_more_races: nil, hispanic_or_latino_ethnicity: nil, country_of_birth_code: nil, state_of_birth_abbreviation: nil, city_of_birth: nil, public_school_residence_status: nil, **extension_fields) ⇒ Demographic

Returns a new instance of Demographic.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/meibo/demographic.rb', line 50

def initialize(sourced_id:, status: nil, date_last_modified: nil, birth_date: nil, sex: nil,
               american_indian_or_alaska_native: nil, asian: nil, black_or_african_american: nil, native_hawaiian_or_other_pacific_islander: nil, white: nil, demographic_race_two_or_more_races: nil, hispanic_or_latino_ethnicity: nil, country_of_birth_code: nil, state_of_birth_abbreviation: nil, city_of_birth: nil, public_school_residence_status: nil, **extension_fields)
  @sourced_id = sourced_id
  @status = status
  @date_last_modified = date_last_modified
  @birth_date = birth_date
  @sex = sex
  @american_indian_or_alaska_native = american_indian_or_alaska_native
  @asian = asian
  @black_or_african_american = black_or_african_american
  @native_hawaiian_or_other_pacific_islander = native_hawaiian_or_other_pacific_islander
  @white = white
  @demographic_race_two_or_more_races = demographic_race_two_or_more_races
  @hispanic_or_latino_ethnicity = hispanic_or_latino_ethnicity
  @country_of_birth_code = country_of_birth_code
  @state_of_birth_abbreviation = state_of_birth_abbreviation
  @city_of_birth = city_of_birth
  @public_school_residence_status = public_school_residence_status
  @extension_fields = extension_fields
end

Instance Method Details

#collectionObject



71
72
73
# File 'lib/meibo/demographic.rb', line 71

def collection
  Meibo.current_roster.demographics
end

#female?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/meibo/demographic.rb', line 79

def female?
  sex == SEX[:female]
end

#male?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/meibo/demographic.rb', line 75

def male?
  sex == SEX[:male]
end

#other?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/meibo/demographic.rb', line 87

def other?
  sex == SEX[:other]
end

#unspecified?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/meibo/demographic.rb', line 83

def unspecified?
  sex == SEX[:unspecified]
end

#userObject



91
92
93
# File 'lib/meibo/demographic.rb', line 91

def user
  Meibo.current_roster.users.find(sourced_id)
end