hh 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef1ae2f45c1abec38dfb443c1bb43c6d27c01fd1
4
- data.tar.gz: 3f4ab8f9252e32420972fce3a9c9ad97dc7723be
3
+ metadata.gz: 3c80329a14c252850f9075913ed2488d8078ec63
4
+ data.tar.gz: 14e1a1f6cd8ddc6f1a44fea3df526fe3aba95312
5
5
  SHA512:
6
- metadata.gz: cd4b6b5123b290e148c2e90cffd981287a4a35732389cc894246b6978933ece3b9415c5e8100fcdc130470b15acc01c945496263654ed5c3bc4a82f0ce097e23
7
- data.tar.gz: 62a72ea0d3a775f5f7db7f3acd06abb2f02156ea49c83f5236bdd89ebfde89f3b21c3651bb76d9768618b33b78f28d7b9f28be9fe34120ef8e1f277a975972cb
6
+ metadata.gz: 06683c208b8a67326283c03f6df6cfc5448948a631b061c581b42a2d4e7185d8a3eb715a759a9f3ecd6036cb5ff853287a7967eea4e63cae7ab1c391c3f5cce4
7
+ data.tar.gz: c773c68ea30504073737f8a693afc4f89e98bc3f8e09946640a2f57d4ff41016d5069b5f77f362c65eb07e92ac15f5808436b45f4e388a07da98c859c2995d09
data/lib/hh.rb CHANGED
@@ -10,19 +10,30 @@ module HH
10
10
  # Alias for Hh::Client.new
11
11
  #
12
12
  # @return [Hh::Client]
13
-
14
13
  def client
15
14
  HH::Client.new
16
15
  end
16
+
17
+ # Delegate to HH::Client
18
+ def method_missing(method, *args, &block)
19
+ return super unless new.respond_to?(method)
20
+ new.send(method, *args, &block)
21
+ end
22
+
23
+ def respond_to?(method, include_private = false)
24
+ new.respond_to?(method, include_private) || super(method, include_private)
25
+ end
17
26
  end
18
- end
27
+ end #HH
19
28
 
29
+ require 'hh/API/vacancy_employer'
20
30
  require 'hh/API/specialization'
21
31
  require 'hh/API/employment'
22
32
  require 'hh/API/statistic'
23
33
  require 'hh/API/schedule'
24
34
  require 'hh/API/currency'
25
35
  require 'hh/API/employer'
36
+ require 'hh/API/vacancy'
26
37
  require 'hh/API/region'
27
38
  require 'hh/API/field'
28
39
  require 'hh/API/metro'
@@ -0,0 +1,11 @@
1
+ #encoding: utf-8
2
+
3
+ module HH
4
+ module API
5
+ module Vacancy
6
+ def vacancy(vacancy_id)
7
+ get("vacancy/#{vacancy_id}")
8
+ end
9
+ end
10
+ end #API
11
+ end #HH
@@ -0,0 +1,11 @@
1
+ #encoding: utf-8
2
+
3
+ module HH
4
+ module API
5
+ module VacancyEmployer
6
+ def vavancy_employer(employer_id)
7
+ get("vacancy/employer/#{employer_id}")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -5,14 +5,16 @@ module HH
5
5
 
6
6
  API_URL = "https://api.hh.ru/1/json/"
7
7
 
8
+ include VacancyEmployer
8
9
  include Specialization
9
10
  include Employment
10
11
  include Statistic
11
12
  include Currency
12
13
  include Employer
13
14
  include Schedule
15
+ include Vacancy
14
16
  include Region
15
17
  include Field
16
18
  include Metro
17
19
  end #API
18
- end
20
+ end #HH
@@ -1,5 +1,5 @@
1
1
  #encoding: utf-8
2
2
 
3
3
  module HH
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
@@ -0,0 +1 @@
1
+ {"id":"2618300","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/2618300/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/2618300"}},"name":"Верстальщик","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter","logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1268919915"},"salary":{"from":1100,"to":1600,"currency":{"code":"USD","name":"USD"}},"region":{"id":"1002","name":"Минск"},"site":"http://hh.ru","schedule":{"id":"full","name":"полный день"},"employment":{"id":"0","name":"Полная занятость"},"experience":{"id":"between3And6","name":"3–6 лет"},"description":"<p>В компанию HeadHunter нужен верстальщик.</p> <div> <div> <div><strong><br /> </strong></div> <div><strong>Требования:</strong></div> <div> <ul> <li>Отличное знание HTML и CSS.</li> <li>Знание JavaScript, не библиотек, а именно JS.</li> <li>Опыт работы с XSLT</li> <li>Опыт работы с Python или другими серверсайд языками.</li> </ul> <div> </div> <div>Вы будете работать над проектом &quot;hh.by&quot;. Оформление согласно ТК.</div> <div> </div> </div> </div> </div>","specializations":{"field":{"id":"1","specialization":[{"id":"10","name":"Web мастер"},{"id":"9","name":"Web инженер"}],"name":"Информационные технологии, интернет, телеком"}}}
@@ -0,0 +1 @@
1
+ [{"id":"7135086","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7135086/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7135086"}},"name":"Java разработчик (Минск)","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Технический департамент","department":{"code":"hh-1455-TECH","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-TECH"}],"name":"HeadHunter::Технический департамент"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364703420"},"salary":{"from":2300,"to":3300,"currency":{"code":"USD","name":"USD"}},"region":{"id":"1002","name":"Минск"},"site":"http://hh.ru","address":{"lng":"27.579492","lat":"53.916286","city":"Минск","street":"улица Веры Хоружей","building":"1а"}},{"id":"7377610","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7377610/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7377610"}},"name":"Менеджер по маркетингу и PR","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Департамент маркетинга","department":{"code":"hh-1455-MARK","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-MARK"}],"name":"HeadHunter::Департамент маркетинга"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1363778372"},"salary":{"from":40000,"currency":{"code":"RUR","name":"руб."}},"region":{"id":"53","name":"Краснодар"},"site":"http://hh.ru"},{"id":"7459478","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7459478/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7459478"}},"name":"Менеджер по продажам","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Департамент продаж","department":{"code":"hh-1455-SALE","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-SALE"}],"name":"HeadHunter::Департамент продаж"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364547112"},"salary":{"from":28000,"currency":{"code":"RUR","name":"руб."}},"region":{"id":"76","name":"Ростов-на-Дону"},"site":"http://hh.ru"},{"id":"7659318","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7659318/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7659318"}},"name":"Менеджер по продажам","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Департамент продаж","department":{"code":"hh-1455-SALE","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-SALE"}],"name":"HeadHunter::Департамент продаж"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364817780"},"salary":{"from":600,"currency":{"code":"USD","name":"USD"}},"region":{"id":"1002","name":"Минск"},"site":"http://hh.ru"},{"id":"7559472","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7559472/"},"alternate":{"type":"text/html","href":"http://career.ru/vacancy/7559472"}},"name":"Стажер в отдел маркетинга (Event-направление)","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Департамент маркетинга","department":{"code":"hh-1455-MARK","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-MARK"}],"name":"HeadHunter::Департамент маркетинга"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1363591253"},"salary":null,"region":{"id":"2","name":"Санкт-Петербург"},"site":"http://career.ru","address":{"lng":"30.314098","lat":"59.912269","city":"Санкт-Петербург","street":"6-я Красноармейская улица","building":{}}},{"id":"7165853","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7165853/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7165853"}},"name":"Менеджер по продажам","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Департамент продаж","department":{"code":"hh-1455-SALE","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-SALE"}],"name":"HeadHunter::Департамент продаж"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364790051"},"salary":null,"region":{"id":"3","name":"Екатеринбург"},"site":"http://hh.ru"},{"id":"7568879","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7568879/"},"alternate":{"type":"text/html","href":"http://career.ru/vacancy/7568879"}},"name":"Специалист технической поддержки соискателей","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Технический департамент","department":{"code":"hh-1455-TECH","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-TECH"}],"name":"HeadHunter::Технический департамент"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364817317"},"salary":{"from":15000,"currency":{"code":"RUR","name":"руб."}},"region":{"id":"112","name":"Ярославль"},"site":"http://career.ru"},{"id":"7659055","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7659055/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7659055"}},"name":"Системный администратор","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Отдел информационных технологий","department":{"code":"hh-1455-IT","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-IT"}],"name":"HeadHunter::Отдел информационных технологий"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364816908"},"salary":{"from":300,"currency":{"code":"USD","name":"USD"}},"region":{"id":"1002","name":"Минск"},"site":"http://hh.ru"},{"id":"7604563","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7604563/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7604563"}},"name":"HR менеджер / спикер","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Департамент персонала","department":{"code":"hh-1455-HR","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-HR"}],"name":"HeadHunter::Департамент персонала"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364616835"},"salary":null,"region":{"id":"115","name":"Киев"},"site":"http://hh.ru","address":{"metro":{"line":{"id":"56","color":"","name":"Куреневско-Красноармейская","station":{"id":"339","path":"56/339","color":"","name":"Контрактовая площадь"}}}}},{"id":"7087563","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7087563/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7087563"}},"name":"Специалист по автоматизации тестирования","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Технический департамент","department":{"code":"hh-1455-TECH","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-TECH"}],"name":"HeadHunter::Технический департамент"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364368199"},"salary":{"from":1600,"to":2600,"currency":{"code":"USD","name":"USD"}},"region":{"id":"1002","name":"Минск"},"site":"http://hh.ru","address":{"lng":"27.579492","lat":"53.916286","city":"Минск","street":"улица Веры Хоружей","building":"1а"}},{"id":"7332120","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7332120/"},"alternate":{"type":"text/html","href":"http://hh.ru/vacancy/7332120"}},"name":"Менеджер проекта \"Консалтинговый центр\"","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Департамент маркетинга","department":{"code":"hh-1455-MARK","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-MARK"}],"name":"HeadHunter::Департамент маркетинга"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364616763"},"salary":null,"region":{"id":"1002","name":"Минск"},"site":"http://hh.ru"},{"id":"7634458","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/vacancy/7634458/"},"alternate":{"type":"text/html","href":"http://career.ru/vacancy/7634458"}},"name":"Стажер","employer":{"id":"1455","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1455/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1455"}},"name":"HeadHunter::Департамент маркетинга","department":{"code":"hh-1455-MARK","link":[{"type":"text/html","href":"http://hh.ru/employer/1455?dpt=hh-1455-MARK"}],"name":"HeadHunter::Департамент маркетинга"},"logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/289027.png"},"medium":{"href":"http://hh.ru/employer-logo/289169.png"}}}},"update":{"timestamp":"1364547096"},"salary":{"from":10000,"to":15000,"currency":{"code":"RUR","name":"руб."}},"region":{"id":"3","name":"Екатеринбург"},"site":"http://career.ru"}]
@@ -1,4 +1,4 @@
1
- #encodign: utf-8
1
+ #encoding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
4
 
@@ -0,0 +1,26 @@
1
+ #enoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe HH::API::Vacancy do
6
+ let(:client) { HH::Client.new }
7
+ let(:vacancy_id) { 2618300 }
8
+ let(:request_path) { "vacancy/#{vacancy_id}" }
9
+
10
+ describe "#vacancy" do
11
+ before do
12
+ stub_get(request_path).to_return(body: fixture("vacancy.json"), headers: {content_type: "application/json; charset=utf-8"})
13
+ end
14
+
15
+ it "requests the correct resource" do
16
+ client.vacancy(vacancy_id)
17
+ expect(a_get(request_path)).to have_been_made
18
+ end
19
+
20
+ it "returns the requested metro list" do
21
+ vacancy = client.vacancy(vacancy_id)
22
+ expect(vacancy).to be_an Hash
23
+ expect(vacancy[:name]).to eq "Верстальщик"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ #encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe HH::API::VacancyEmployer do
6
+ let(:client) { HH::Client.new }
7
+ let(:vacancy_id) { 7135086 }
8
+ let(:request_path) { "vacancy/employer/#{vacancy_id}" }
9
+
10
+ describe "#vavancy_employer" do
11
+ before do
12
+ stub_get(request_path).to_return(body: fixture("vacancy_employer.json"), headers: {content_type: "application/json; charset=utf-8"})
13
+ end
14
+
15
+ it "requests the correct resource" do
16
+ client.vavancy_employer(vacancy_id)
17
+ expect(a_get(request_path)).to have_been_made
18
+ end
19
+
20
+ it "returns the requested metro list" do
21
+ vavancy_employer = client.vavancy_employer(vacancy_id)
22
+ expect(vavancy_employer).to be_an Array
23
+ expect(vavancy_employer.first).to be_an Hash
24
+ expect(vavancy_employer.first[:name]).to eq "Java разработчик (Минск)"
25
+ end
26
+ end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Varavko
@@ -132,6 +132,8 @@ files:
132
132
  - lib/hh/API/schedule.rb
133
133
  - lib/hh/API/specialization.rb
134
134
  - lib/hh/API/statistic.rb
135
+ - lib/hh/API/vacancy.rb
136
+ - lib/hh/API/vacancy_employer.rb
135
137
  - lib/hh/api.rb
136
138
  - lib/hh/client.rb
137
139
  - lib/hh/request.rb
@@ -150,6 +152,8 @@ files:
150
152
  - spec/fixtures/specialization.json
151
153
  - spec/fixtures/specialization_all.json
152
154
  - spec/fixtures/statistic.json
155
+ - spec/fixtures/vacancy.json
156
+ - spec/fixtures/vacancy_employer.json
153
157
  - spec/hh/api/currency_spec.rb
154
158
  - spec/hh/api/employer_spec.rb
155
159
  - spec/hh/api/employment_spec.rb
@@ -159,6 +163,8 @@ files:
159
163
  - spec/hh/api/schedule_spec.rb
160
164
  - spec/hh/api/specialization_spec.rb
161
165
  - spec/hh/api/statistic_spec.rb
166
+ - spec/hh/api/vacancy_spec.rb
167
+ - spec/hh/api/vavancy_employer_spec.rb
162
168
  - spec/hh/client_spec.rb
163
169
  - spec/hh_spec.rb
164
170
  - spec/spec_helper.rb
@@ -201,6 +207,8 @@ test_files:
201
207
  - spec/fixtures/specialization.json
202
208
  - spec/fixtures/specialization_all.json
203
209
  - spec/fixtures/statistic.json
210
+ - spec/fixtures/vacancy.json
211
+ - spec/fixtures/vacancy_employer.json
204
212
  - spec/hh/api/currency_spec.rb
205
213
  - spec/hh/api/employer_spec.rb
206
214
  - spec/hh/api/employment_spec.rb
@@ -210,6 +218,8 @@ test_files:
210
218
  - spec/hh/api/schedule_spec.rb
211
219
  - spec/hh/api/specialization_spec.rb
212
220
  - spec/hh/api/statistic_spec.rb
221
+ - spec/hh/api/vacancy_spec.rb
222
+ - spec/hh/api/vavancy_employer_spec.rb
213
223
  - spec/hh/client_spec.rb
214
224
  - spec/hh_spec.rb
215
225
  - spec/spec_helper.rb