class ChigagoEmployeesAhsan::Employee

Attributes

department[R]
first_name[R]
last_name[R]
name[R]
salary[R]
title[R]

Public Class Methods

all() click to toggle source
# File lib/chigago_employees_ahsan.rb, line 17
def self.all
  Unirest.get("https://data.cityofchicago.org/resource/tt4n-kn4t.json")
      .body
      .map{|employee| Employee.new(employee)}
end
department(param_option) click to toggle source
# File lib/chigago_employees_ahsan.rb, line 23
def self.department(param_option)
  Unirest.get("https://data.cityofchicago.org/resource/tt4n-kn4t.json?department=#{param_option}")
      .body
      .map{|employee| Employee.new(employee)}
end
highest_paid_three() click to toggle source
# File lib/chigago_employees_ahsan.rb, line 29
def self.highest_paid_three
  employee = Unirest.get("https://data.cityofchicago.org/resource/tt4n-kn4t.json")
      .body
      .map{|employee| Employee.new(employee)}
  employee.max_by(3){|employee| employee.salary}
end
new(input_options) click to toggle source
# File lib/chigago_employees_ahsan.rb, line 7
def initialize(input_options)
  @title = input_options['job_titles']
  @department = input_options['department']
  @name = input_options['name']
  @salary = input_options['annual_salary'].to_i
  @first_name = @name.split(', ')[1]
  @last_name = @name.split(', ')[0]

end