Class: Careerjetr
- Inherits:
-
Object
- Object
- Careerjetr
- Defined in:
- lib/careerjetr/careerjetr.rb
Constant Summary collapse
- LOCALES =
{ :cs_CZ => {:language =>'Czech' , :location => 'Czech Republic' , :url => 'http://www.careerjet.cz' }, :da_DK => {:language =>'Danish' , :location => 'Denmark' , :url => 'http://www.careerjet.dk' }, :de_AT => {:language =>'German' , :location => 'Austria' , :url => 'http://www.careerjet.at' }, :de_CH => {:language =>'German' , :location => 'Switzerland' , :url => 'http://www.careerjet.ch' }, :de_DE => {:language =>'German' , :location => 'Germany' , :url => 'http://www.careerjet.de' }, :en_AE => {:language =>'English' , :location => 'United Arab Emirates', :url => 'http://www.careerjet.ae' }, :en_AU => {:language =>'English' , :location => 'Australia' , :url => 'http://www.careerjet.com.au' }, :en_CA => {:language =>'English' , :location => 'Canada' , :url => 'http://www.careerjet.ca' }, :en_CN => {:language =>'English' , :location => 'China' , :url => 'http://en.careerjet.cn' }, :en_HK => {:language =>'English' , :location => 'Hong Kong' , :url => 'http://www.careerjet.hk' }, :en_IE => {:language =>'English' , :location => 'Ireland' , :url => 'http://www.careerjet.ie' }, :en_IN => {:language =>'English' , :location => 'India' , :url => 'http://www.careerjet.co.in' }, :en_MY => {:language =>'English' , :location => 'Malaysia' , :url => 'http://www.careerjet.com.my' }, :en_NZ => {:language =>'English' , :location => 'New Zealand' , :url => 'http://www.careerjet.co.nz' }, :en_OM => {:language =>'English' , :location => 'Oman' , :url => 'http://www.careerjet.com.om' }, :en_PH => {:language =>'English' , :location => 'Philippines' , :url => 'http://www.careerjet.ph' }, :en_PK => {:language =>'English' , :location => 'Pakistan' , :url => 'http://www.careerjet.com.pk' }, :en_QA => {:language =>'English' , :location => 'Qatar' , :url => 'http://www.careerjet.com.qa' }, :en_SG => {:language =>'English' , :location => 'Singapore' , :url => 'http://www.careerjet.sg' }, :en_GB => {:language =>'English' , :location => 'United Kingdom' , :url => 'http://www.careerjet.co.uk' }, :en_US => {:language =>'English' , :location => 'United States' , :url => 'http://www.careerjet.com' }, :en_ZA => {:language =>'English' , :location => 'South Africa' , :url => 'http://www.careerjet.co.za' }, :en_TW => {:language =>'English' , :location => 'Taiwan' , :url => 'http://www.careerjet.com.tw' }, :en_VN => {:language =>'English' , :location => 'Vietnam' , :url => 'http://www.careerjet.vn' }, :es_AR => {:language =>'Spanish' , :location => 'Argentina' , :url => 'http://www.opcionempleo.com.ar' }, :es_BO => {:language =>'Spanish' , :location => 'Bolivia' , :url => 'http://www.opcionempleo.com.bo' }, :es_CL => {:language =>'Spanish' , :location => 'Chile' , :url => 'http://www.opcionempleo.cl' }, :es_CR => {:language =>'Spanish' , :location => 'Costa Rica' , :url => 'http://www.opcionempleo.co.cr' }, :es_DO => {:language =>'Spanish' , :location => 'Dominican Republic' , :url => 'http://www.opcionempleo.com.do' }, :es_EC => {:language =>'Spanish' , :location => 'Ecuador' , :url => 'http://www.opcionempleo.ec' }, :es_ES => {:language =>'Spanish' , :location => 'Spain' , :url => 'http://www.opcionempleo.com' }, :es_GT => {:language =>'Spanish' , :location => 'Guatemala' , :url => 'http://www.opcionempleo.com.gt' }, :es_MX => {:language =>'Spanish' , :location => 'Mexico' , :url => 'http://www.opcionempleo.com.mx' }, :es_PA => {:language =>'Spanish' , :location => 'Panama' , :url => 'http://www.opcionempleo.com.pa' }, :es_PE => {:language =>'Spanish' , :location => 'Peru' , :url => 'http://www.opcionempleo.com.pe' }, :es_PR => {:language =>'Spanish' , :location => 'Puerto Rico' , :url => 'http://www.opcionempleo.com.pr' }, :es_PY => {:language =>'Spanish' , :location => 'Paraguay' , :url => 'http://www.opcionempleo.com.py' }, :es_UY => {:language =>'Spanish' , :location => 'Uruguay' , :url => 'http://www.opcionempleo.com.uy' }, :es_VE => {:language =>'Spanish' , :location => 'Venezuela' , :url => 'http://www.opcionempleo.com.ve' }, :fi_FI => {:language =>'Finnish' , :location => 'Finland' , :url => 'http://www.careerjet.fi' }, :fr_CA => {:language =>'French' , :location => 'Canada' , :url => 'http://fr.careerjet.ca' }, :fr_BE => {:language =>'French' , :location => 'Belgium' , :url => 'http://www.optioncarriere.be' }, :fr_CH => {:language =>'French' , :location => 'Switzerland' , :url => 'http://www.optioncarriere.ch' }, :fr_FR => {:language =>'French' , :location => 'France' , :url => 'http://www.optioncarriere.com' }, :fr_LU => {:language =>'French' , :location => 'Luxembourg' , :url => 'http://www.optioncarriere.lu' }, :fr_MA => {:language =>'French' , :location => 'Morocco' , :url => 'http://www.optioncarriere.ma' }, :hu_HU => {:language =>'Hungarian' , :location => 'Hungary' , :url => 'http://www.careerjet.hu' }, :it_IT => {:language =>'Italian' , :location => 'Italy' , :url => 'http://www.careerjet.it' }, :ja_JP => {:language =>'Japanese' , :location => 'Japan' , :url => 'http://www.careerjet.jp' }, :ko_KR => {:language =>'Korean' , :location => 'Korea' , :url => 'http://www.careerjet.co.kr' }, :nl_BE => {:language =>'Dutch' , :location => 'Belgium' , :url => 'http://www.careerjet.be' }, :nl_NL => {:language =>'Dutch' , :location => 'Netherlands' , :url => 'http://www.careerjet.nl' }, :no_NO => {:language =>'Norwegian' , :location => 'Norway' , :url => 'http://www.careerjet.no' }, :pl_PL => {:language =>'Polish' , :location => 'Poland' , :url => 'http://www.careerjet.pl' }, :pt_PT => {:language =>'Portuguese' , :location => 'Portugal' , :url => 'http://www.careerjet.pt' }, :pt_BR => {:language =>'Portuguese' , :location => 'Brazil' , :url => 'http://www.careerjet.com.br' }, :ru_RU => {:language =>'Russian' , :location => 'Russia' , :url => 'http://www.careerjet.ru' }, :ru_UA => {:language =>'Russian' , :location => 'Ukraine' , :url => 'http://www.careerjet.com.ua' }, :sv_SE => {:language =>'Swedish' , :location => 'Sweden' , :url => 'http://www.careerjet.se' }, :sk_SK => {:language =>'Slovak' , :location => 'Slovakia' , :url => 'http://www.careerjet.sk' }, :tr_TR => {:language =>'Turkish' , :location => 'Turkey' , :url => 'http://www.careerjet.com.tr' }, :uk_UA => {:language =>'Ukrainian' , :location => 'Ukraine' , :url => 'http://www.careerjet.ua' }, :vi_VN => {:language =>'Vietnamese' , :location => 'Vietnam' , :url => 'http://www.careerjet.com.vn' }, :zh_CN => {:language =>'Chinese' , :location => 'China' , :url=> 'http://www.careerjet.cn' } }
Instance Attribute Summary collapse
-
#jobs ⇒ Object
readonly
Returns the value of attribute jobs.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#get_url(locale, params) ⇒ Object
Generamos la url completa para la llamada a la api.
-
#initialize(locale, params = {}) ⇒ Careerjetr
constructor
A new instance of Careerjetr.
-
#parse_json ⇒ Object
Devuelve un hash con la informaciĆ³n disponible.
Constructor Details
#initialize(locale, params = {}) ⇒ Careerjetr
Returns a new instance of Careerjetr.
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/careerjetr/careerjetr.rb', line 72 def initialize(locale, params = {}) @url = get_url(locale, params) json = parse_json @current_page @pages = json[:pages] @jobs = json[:jobs] @type = json[:type] @hits = json[:hits] end |
Instance Attribute Details
#jobs ⇒ Object (readonly)
Returns the value of attribute jobs.
70 71 72 |
# File 'lib/careerjetr/careerjetr.rb', line 70 def jobs @jobs end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
70 71 72 |
# File 'lib/careerjetr/careerjetr.rb', line 70 def pages @pages end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
70 71 72 |
# File 'lib/careerjetr/careerjetr.rb', line 70 def url @url end |
Instance Method Details
#get_url(locale, params) ⇒ Object
Generamos la url completa para la llamada a la api
85 86 87 |
# File 'lib/careerjetr/careerjetr.rb', line 85 def get_url(locale, params) URI.escape(get_base(locale) + '?' + url_params(params)) end |
#parse_json ⇒ Object
Devuelve un hash con la informaciĆ³n disponible
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/careerjetr/careerjetr.rb', line 90 def parse_json hash = {} json = JSON::Parser.new(Net::HTTP.get(URI.parse(@url))).parse hash.store(:type, json['type']) hash.store(:hits, json['hits']) hash.store(:pages, json['pages']) hash.store(:jobs, json['jobs']) hash end |