Class: Cb::EducationApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cb/clients/education_api.rb

Class Method Summary collapse

Class Method Details

.get_for(country) ⇒ Object

Retrieve Education codes by country code

For detailed information around this API please visit: http://api.careerbuilder.com/EducationCodes.aspx



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cb/clients/education_api.rb', line 11

def self.get_for(country)
  Cb::Utils::Country.is_valid? country ? country : 'US'

  my_api = Cb::Utils::Api.new()
  cb_response = my_api.cb_get(Cb.configuration.uri_education_code, :query => {:countrycode => country})
  json_hash = JSON.parse(cb_response.response.body)

  codes = []
  json_hash['ResponseEducationCodes']['EducationCodes']['Education'].each do | education |
      codes << Cb::CbEducation.new(education)
    end
    my_api.append_api_responses(codes, json_hash['ResponseEducationCodes'])

    return codes
end