class ChicagoEmployee::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/chicago_employee.rb, line 18 def self.all Unirest.get(ChicagoAPI) .body .map { |employee| Employee.new(employee) } end
find(key,option)
click to toggle source
# File lib/chicago_employee.rb, line 24 def self.find(key,option) ruby_data = [] bulk_data = Unirest.get(ChicagoAPI+'?'+key+"=#{option}").body bulk_data.each do |employee| ruby_data << Employee.new(employee) end ruby_data end
highest_paid()
click to toggle source
# File lib/chicago_employee.rb, line 33 def self.highest_paid employees = Unirest.get(ChicagoAPI) .body .map { |employee| Employee.new(employee) } employees.max_by { |employee| employee.salary } end
new(input_options)
click to toggle source
# File lib/chicago_employee.rb, line 9 def initialize(input_options) @job_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