hh 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +6 -14
- data/hh.gemspec +1 -0
- data/lib/hh/API/currency.rb +11 -0
- data/lib/hh/API/employer.rb +11 -0
- data/lib/hh/API/employment.rb +11 -0
- data/lib/hh/API/field.rb +15 -0
- data/lib/hh/API/metro.rb +5 -6
- data/lib/hh/API/region.rb +15 -0
- data/lib/hh/API/schedule.rb +11 -0
- data/lib/hh/API/specialization.rb +2 -4
- data/lib/hh/API/statistic.rb +11 -0
- data/lib/hh/api.rb +8 -1
- data/lib/hh/client.rb +3 -6
- data/lib/hh/request.rb +25 -0
- data/lib/hh/version.rb +3 -1
- data/lib/hh.rb +9 -1
- data/spec/fixtures/currency.json +1 -0
- data/spec/fixtures/employer.json +1 -0
- data/spec/fixtures/employment.json +1 -0
- data/spec/fixtures/field.json +1 -0
- data/spec/fixtures/field_all.json +1 -0
- data/spec/fixtures/region.json +1 -0
- data/spec/fixtures/regions_all.json +1 -0
- data/spec/fixtures/schedule.json +1 -0
- data/spec/fixtures/specialization.json +1 -0
- data/spec/fixtures/specialization_all.json +1 -0
- data/spec/fixtures/statistic.json +1 -0
- data/spec/hh/api/currency_spec.rb +26 -0
- data/spec/hh/api/employer_spec.rb +24 -0
- data/spec/hh/api/employment_spec.rb +26 -0
- data/spec/hh/api/field_spec.rb +42 -0
- data/spec/hh/api/metro_spec.rb +13 -4
- data/spec/hh/api/region_spec.rb +42 -0
- data/spec/hh/api/schedule_spec.rb +26 -0
- data/spec/hh/api/specialization_spec.rb +44 -0
- data/spec/hh/api/statistic_spec.rb +24 -0
- data/spec/hh/client_spec.rb +0 -3
- metadata +66 -6
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MDE1ZThkNjYwZTg0Njg0MTE1YWZlOTE2MmQ2ZjVkMzQ2NWVhYmZjZDRiYjYy
|
10
|
-
Nzc3ZTg2NjZlMDA3OTczN2YxYmUwMGJhNDNkMGEyNTdjYWI0NzFjYzdlNWYw
|
11
|
-
MTgwMWRmYTU4ZTI3MGJmNGUyMzY4MTA2ZmViYzg1MDJkNDg4OGY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ODM1MDkzNWYwYjgzMTJkZWMwNGY4ZjZhZjFlMjE3ODlkMTM2Y2ZjMGE1M2Ix
|
14
|
-
NWMzYzliYzNiM2JiN2Y2MmZmMzY1OWU3NjdmMzMxNmI1MGIwYmIzNjE2OTA3
|
15
|
-
ZDcxNTM3NzE5YWEwNGU3ZTE3MDBkMjk2YTYzMmI3YjZiNWQ4NTg=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef1ae2f45c1abec38dfb443c1bb43c6d27c01fd1
|
4
|
+
data.tar.gz: 3f4ab8f9252e32420972fce3a9c9ad97dc7723be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cd4b6b5123b290e148c2e90cffd981287a4a35732389cc894246b6978933ece3b9415c5e8100fcdc130470b15acc01c945496263654ed5c3bc4a82f0ce097e23
|
7
|
+
data.tar.gz: 62a72ea0d3a775f5f7db7f3acd06abb2f02156ea49c83f5236bdd89ebfde89f3b21c3651bb76d9768618b33b78f28d7b9f28be9fe34120ef8e1f277a975972cb
|
data/hh.gemspec
CHANGED
data/lib/hh/API/field.rb
ADDED
data/lib/hh/API/metro.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
1
3
|
module HH
|
2
4
|
module API
|
3
5
|
module Metro
|
4
6
|
def metro
|
5
|
-
|
6
|
-
response.body
|
7
|
+
get("metro")
|
7
8
|
end
|
8
9
|
|
9
10
|
def metro_line(line_id)
|
10
|
-
|
11
|
-
response.body
|
11
|
+
get("metro/#{line_id}")
|
12
12
|
end
|
13
13
|
|
14
14
|
def metro_station(station_id, line_id)
|
15
|
-
|
16
|
-
response.body
|
15
|
+
get("metro/#{station_id},#{line_id}")
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
@@ -4,13 +4,11 @@ module HH
|
|
4
4
|
module API
|
5
5
|
module Specialization
|
6
6
|
def specializations
|
7
|
-
|
8
|
-
response.body
|
7
|
+
get("specialization/all")
|
9
8
|
end
|
10
9
|
|
11
10
|
def specialization(specialization_id)
|
12
|
-
|
13
|
-
response.body
|
11
|
+
get("specialization/#{specialization_id}")
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
data/lib/hh/api.rb
CHANGED
@@ -6,6 +6,13 @@ module HH
|
|
6
6
|
API_URL = "https://api.hh.ru/1/json/"
|
7
7
|
|
8
8
|
include Specialization
|
9
|
+
include Employment
|
10
|
+
include Statistic
|
11
|
+
include Currency
|
12
|
+
include Employer
|
13
|
+
include Schedule
|
14
|
+
include Region
|
15
|
+
include Field
|
9
16
|
include Metro
|
10
|
-
end
|
17
|
+
end #API
|
11
18
|
end
|
data/lib/hh/client.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module HH
|
4
4
|
class Client
|
5
5
|
include API
|
6
|
+
include Request
|
6
7
|
|
7
8
|
# @param options [Hash]
|
8
9
|
def default_middleware(options={})
|
@@ -10,11 +11,7 @@ module HH
|
|
10
11
|
conn.request :multipart
|
11
12
|
conn.adapter :net_http
|
12
13
|
|
13
|
-
if ENV['DEBUG']
|
14
|
-
conn.response :logger
|
15
|
-
else
|
16
|
-
conn.response :json
|
17
|
-
end
|
14
|
+
conn.response :logger if ENV['DEBUG']
|
18
15
|
end
|
19
16
|
end
|
20
17
|
|
@@ -58,4 +55,4 @@ module HH
|
|
58
55
|
}.merge(options)
|
59
56
|
end
|
60
57
|
end
|
61
|
-
end
|
58
|
+
end #HH
|
data/lib/hh/request.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'multi_json'
|
4
|
+
|
5
|
+
module HH
|
6
|
+
|
7
|
+
# Define HTTP methods
|
8
|
+
module Request
|
9
|
+
|
10
|
+
# Perform an HTTP GET request
|
11
|
+
def get(path, params={})
|
12
|
+
request(path, params)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def request(path, params) # :nodoc:
|
18
|
+
response = connection.get do |request|
|
19
|
+
request.url(path, params)
|
20
|
+
end
|
21
|
+
MultiJson.load(response.body, symbolize_keys: true)
|
22
|
+
end
|
23
|
+
|
24
|
+
end #Request
|
25
|
+
end #HH
|
data/lib/hh/version.rb
CHANGED
data/lib/hh.rb
CHANGED
@@ -18,6 +18,14 @@ module HH
|
|
18
18
|
end
|
19
19
|
|
20
20
|
require 'hh/API/specialization'
|
21
|
+
require 'hh/API/employment'
|
22
|
+
require 'hh/API/statistic'
|
23
|
+
require 'hh/API/schedule'
|
24
|
+
require 'hh/API/currency'
|
25
|
+
require 'hh/API/employer'
|
26
|
+
require 'hh/API/region'
|
27
|
+
require 'hh/API/field'
|
21
28
|
require 'hh/API/metro'
|
22
29
|
require 'hh/api'
|
23
|
-
require 'hh/
|
30
|
+
require 'hh/request'
|
31
|
+
require 'hh/client'
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"code":"RUR","name":"руб.","rate":"1.000000"},{"code":"AZN","name":"AZN","rate":"0.024628"}]
|
@@ -0,0 +1 @@
|
|
1
|
+
{"id":"1454","type":"company","links":{"self":{"type":"application/json","href":"http://api.hh.ru/1/json/employer/1454/"},"alternate":{"type":"text/html","href":"http://hh.ru/employer/1454"},"related":{"type":"text/html","href":"http://www.nrb.ru"}},"name":"Национальный резервный банк, АКБ","logos":{"links":{"small":{"href":"http://hh.ru/employer-logo/495319.png"},"medium":{"href":"http://hh.ru/employer-logo/495320.png"},"big":{"href":"http://hh.ru/employer-logo/495318.png"},"original":{"href":"http://hh.ru/file/7902011.png"}}},"short-description":{},"full-description":"<p><strong>АКБ "Национальный Резервный Банк"</strong> был основан в апреле 1994 года.<br /><br />Высокая капитализация, строгий контроль за рисками, а также высокий профессионализм команды сделали возможной эффективную работу Банка в любых условиях.<br />Стратегия развития любого банка основывается на определении его миссии. Миссия нашего Банка состоит в оказании содействия экономическому развитию и процветанию Российской Федерации, превращению страны в действительно великую державу, полноценного партнера на международных рынках.</p> <p>Клиенты АКБ "Национальный Резервный Банк" сегодня - это, прежде всего, крупнейшие предприятия, лидеры российского бизнеса. Работа с такой клиентурой требует высочайшего профессионализма и быстрой реакции на меняющиеся условия конкуренции на рынке банковских услуг.<br /><br />В своей деятельности мы ориентируемся на долгосрочное сотрудничество со всеми клиентами. Наряду с предложением классических банковских услуг по ведению расчетных и валютных счетов, осуществлению расчетов, привлечению и размещению денежных средств, операций с ценными бумагами и т.п., АКБ "Национальный Резервный Банк" осуществляет деятельность в качестве кредитора, гаранта, финансового агента, организатора и участника синдицированных кредитов, оказывает услуги в области проектного финансирования. Свою задачу Банк видит в оказании клиентам полного спектра инвестиционно-банковских услуг, отвечающих по качеству мировым стандартам, а также во внедрении новых, прогрессивных банковских технологий и продуктов, в развитии и совершенствовании банковской системы в целом.<br /><br />На сегодняшний день АКБ "НРБанк" реализует проекты в таких отраслях, как топливно-энергетический комплекс, авиастроение, судостроение, автомобилестроение и агропромышленный комплекс. Рост производства в них стимулирует развитие многих смежных отраслей, что самым благоприятным образом сказывается на экономике Российской Федерации.</p>"}
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"id":"0","code":"FULL","name":"Полная занятость"},{"id":"1","code":"PART","name":"Частичная занятость"}]
|
@@ -0,0 +1 @@
|
|
1
|
+
{"id":"2","name":"Бухгалтерия, управленческий учет, финансы предприятия"}
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"id":"0","name":"Любая"},{"id":"1","name":"Информационные технологии, интернет, телеком"}]
|
@@ -0,0 +1 @@
|
|
1
|
+
{"id":"1","parent":"232","name":"Москва"}
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"id":"1","parent":"232","name":"Москва"},{"id":"2","parent":"231","name":"Санкт-Петербург"}]
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"id":"0","code":"full","name":"Полный день"},{"id":"1","code":"shift","name":"Сменный график"}]
|
@@ -0,0 +1 @@
|
|
1
|
+
{"id":"474","field":"1","name":"Стартапы"}
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"id":"471","field":"10","name":"Маркшейдер"}, {"id":"474","field":"1","name":"Стартапы"}]
|
@@ -0,0 +1 @@
|
|
1
|
+
{"vacancies":"262530","resumes":"9866973","employers":"550881","invitations":"378520"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe HH::API::Currency do
|
6
|
+
let(:client) { HH::Client.new }
|
7
|
+
|
8
|
+
describe "#currency" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
stub_get("currency").to_return(body: fixture("currency.json"), headers: {content_type: "application/json; charset=utf-8"})
|
12
|
+
end
|
13
|
+
|
14
|
+
it "requests the correct resource" do
|
15
|
+
client.currency
|
16
|
+
expect(a_get("currency")).to have_been_made
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns the requested currency list" do
|
20
|
+
currency = client.currency
|
21
|
+
expect(currency).to be_an Array
|
22
|
+
expect(currency.first).to be_an Hash
|
23
|
+
expect(currency.first[:code]).to eq "RUR"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#encodign: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe HH::API::Employer do
|
6
|
+
let(:client) { HH::Client.new }
|
7
|
+
|
8
|
+
describe "#employer" do
|
9
|
+
before do
|
10
|
+
stub_get("employer").to_return(body: fixture("employer.json"), headers: {content_type: "application/json; charset=utf-8"})
|
11
|
+
end
|
12
|
+
|
13
|
+
it "requests the correct resource" do
|
14
|
+
client.employer
|
15
|
+
expect(a_get("employer")).to have_been_made
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the requested metro list" do
|
19
|
+
employer = client.employer
|
20
|
+
expect(employer).to be_an Hash
|
21
|
+
expect(employer[:name]).to eq "Национальный резервный банк, АКБ"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe "HH::API::Employment" do
|
6
|
+
let(:client) { HH::Client.new }
|
7
|
+
|
8
|
+
describe "#employment" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
stub_get("employment").to_return(body: fixture("employment.json"), headers: {content_type: "application/json; charset=utf-8"})
|
12
|
+
end
|
13
|
+
|
14
|
+
it "requests the correct resource" do
|
15
|
+
client.employment
|
16
|
+
expect(a_get("employment")).to have_been_made
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns the requested employments" do
|
20
|
+
employment = client.employment
|
21
|
+
expect(employment).to be_an Array
|
22
|
+
expect(employment.first).to be_an Hash
|
23
|
+
expect(employment.first[:name]).to eq "Полная занятость"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe HH::API::Field do
|
6
|
+
let(:client) { HH::Client.new }
|
7
|
+
|
8
|
+
describe "#fields" do
|
9
|
+
before do
|
10
|
+
stub_get("field/all").to_return(body: fixture("field_all.json"), headers: {content_type: "application/json; charset=utf-8"})
|
11
|
+
end
|
12
|
+
|
13
|
+
it "requests the correct resource" do
|
14
|
+
client.fields
|
15
|
+
expect(a_get("field/all")).to have_been_made
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the requested fields" do
|
19
|
+
fields = client.fields
|
20
|
+
expect(fields).to be_an Array
|
21
|
+
expect(fields.first).to be_an Hash
|
22
|
+
expect(fields.first[:name]).to eq "Любая"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "field" do
|
27
|
+
before do
|
28
|
+
stub_get("field/2").to_return(body: fixture("field.json"), headers: {content_type: "application/json; charset=utf-8"})
|
29
|
+
end
|
30
|
+
|
31
|
+
it "requested line the correct resource" do
|
32
|
+
client.field(2)
|
33
|
+
expect(a_get("field/2")).to have_been_made
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns the requested field id" do
|
37
|
+
field = client.field(2)
|
38
|
+
expect(field).to be_an Hash
|
39
|
+
expect(field[:name]).to eq "Бухгалтерия, управленческий учет, финансы предприятия"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/hh/api/metro_spec.rb
CHANGED
@@ -1,53 +1,62 @@
|
|
1
1
|
#encoding: utf-8
|
2
|
+
|
2
3
|
require 'spec_helper'
|
3
4
|
|
4
5
|
describe HH::API::Metro do
|
5
|
-
|
6
6
|
let(:client) { HH::Client.new }
|
7
7
|
|
8
8
|
describe "#metro" do
|
9
|
+
|
9
10
|
before do
|
10
11
|
stub_get("metro").to_return(body: fixture("metro.json"), headers: {content_type: "application/json; charset=utf-8"})
|
11
12
|
end
|
13
|
+
|
12
14
|
it "requests the correct resource" do
|
13
15
|
client.metro
|
14
16
|
expect(a_get("metro")).to have_been_made
|
15
17
|
end
|
18
|
+
|
16
19
|
it "returns the requested metro list" do
|
17
20
|
metro = client.metro
|
18
21
|
expect(metro).to be_an Array
|
19
22
|
expect(metro.first).to be_an Hash
|
20
|
-
expect(metro.first[
|
23
|
+
expect(metro.first[:name]).to eq "Калининская"
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
24
27
|
describe "metro_line" do
|
28
|
+
|
25
29
|
before do
|
26
30
|
stub_get("metro/6").to_return(body: fixture("metro_line.json"), headers: {content_type: "application/json; charset=utf-8"})
|
27
31
|
end
|
32
|
+
|
28
33
|
it "requested line the correct resource" do
|
29
34
|
client.metro_line(6)
|
30
35
|
expect(a_get("metro/6")).to have_been_made
|
31
36
|
end
|
37
|
+
|
32
38
|
it "returns the requested metro line" do
|
33
39
|
metro_line = client.metro_line(6)
|
34
40
|
expect(metro_line).to be_an Hash
|
35
|
-
expect(metro_line[
|
41
|
+
expect(metro_line[:id]) == 6
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|
39
45
|
describe "metro_station" do
|
46
|
+
|
40
47
|
before do
|
41
48
|
stub_get("metro/6,8").to_return(body: fixture("metro_station.json"), headers: {content_type: "application/json; charset=utf-8"})
|
42
49
|
end
|
50
|
+
|
43
51
|
it "requested station the correct resource" do
|
44
52
|
client.metro_station(6, 8)
|
45
53
|
expect(a_get("metro/6,8")).to have_been_made
|
46
54
|
end
|
55
|
+
|
47
56
|
it "returns the requested metro station" do
|
48
57
|
metro_station = client.metro_station(6, 8)
|
49
58
|
expect(metro_station).to be_an Hash
|
50
|
-
expect(metro_station[
|
59
|
+
expect(metro_station[:name]).to eq "Калужско-Рижская"
|
51
60
|
end
|
52
61
|
end
|
53
62
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe HH::API::Region do
|
6
|
+
let(:client) { HH::Client.new }
|
7
|
+
|
8
|
+
describe "#regions" do
|
9
|
+
before do
|
10
|
+
stub_get("region/all").to_return(body: fixture("regions_all.json"), headers: {content_type: "application/json; charset=utf-8"})
|
11
|
+
end
|
12
|
+
|
13
|
+
it "requests the correct resource" do
|
14
|
+
client.regions
|
15
|
+
expect(a_get("region/all")).to have_been_made
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the requested regions all" do
|
19
|
+
regions = client.regions
|
20
|
+
expect(regions).to be_an Array
|
21
|
+
expect(regions.first).to be_an Hash
|
22
|
+
expect(regions.first[:name]).to eq "Москва"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#region" do
|
27
|
+
before do
|
28
|
+
stub_get("region/1").to_return(body: fixture("region.json"), headers: {content_type: "application/json; charset=utf-8"})
|
29
|
+
end
|
30
|
+
|
31
|
+
it "requests the correct resource" do
|
32
|
+
client.region(1)
|
33
|
+
expect(a_get("region/1")).to have_been_made
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns the requested regions all" do
|
37
|
+
region = client.region(1)
|
38
|
+
expect(region).to be_an Hash
|
39
|
+
expect(region[:name]).to eq "Москва"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe HH::API::Schedule do
|
6
|
+
let(:client) { HH::Client.new }
|
7
|
+
|
8
|
+
describe "#schedule" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
stub_get("schedule").to_return(body: fixture("schedule.json"), headers: {content_type: "application/json; charset=utf-8"})
|
12
|
+
end
|
13
|
+
|
14
|
+
it "requests the correct resource" do
|
15
|
+
client.schedule
|
16
|
+
expect(a_get("schedule")).to have_been_made
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns the requested schedule list" do
|
20
|
+
schedule = client.schedule
|
21
|
+
expect(schedule).to be_an Array
|
22
|
+
expect(schedule.first).to be_an Hash
|
23
|
+
expect(schedule.first[:name]).to eq "Полный день"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe HH::API::Specialization do
|
6
|
+
let(:client) { HH::Client.new }
|
7
|
+
|
8
|
+
describe "#specializations" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
stub_get("specialization/all").to_return(body: fixture("specialization_all.json"), headers: {content_type: "application/json; charset=utf-8"})
|
12
|
+
end
|
13
|
+
|
14
|
+
it "requests the correct resource" do
|
15
|
+
client.specializations
|
16
|
+
expect(a_get("specialization/all")).to have_been_made
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns the requested specializations" do
|
20
|
+
specializations = client.specializations
|
21
|
+
expect(specializations).to be_an Array
|
22
|
+
expect(specializations.first).to be_an Hash
|
23
|
+
expect(specializations.first[:name]).to eq "Маркшейдер"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#specialization" do
|
28
|
+
|
29
|
+
before do
|
30
|
+
stub_get("specialization/474").to_return(body: fixture("specialization.json"), headers: {content_type: "application/json; charset=utf-8"})
|
31
|
+
end
|
32
|
+
|
33
|
+
it "requests the correct resource" do
|
34
|
+
client.specialization(474)
|
35
|
+
expect(a_get("specialization/474")).to have_been_made
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns the requested specialization" do
|
39
|
+
specializations = client.specialization(474)
|
40
|
+
expect(specializations).to be_an Hash
|
41
|
+
expect(specializations[:id]) == 474
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe HH::API::Statistic do
|
6
|
+
let(:client) { HH::Client.new }
|
7
|
+
|
8
|
+
describe "#statistic" do
|
9
|
+
before do
|
10
|
+
stub_get("statistic").to_return(body: fixture("statistic.json"), headers: {content_type: "application/json; charset=utf-8"})
|
11
|
+
end
|
12
|
+
|
13
|
+
it "requests the correct resource" do
|
14
|
+
client.statistic
|
15
|
+
expect(a_get("statistic")).to have_been_made
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the requested statistic list" do
|
19
|
+
statistic = client.statistic
|
20
|
+
expect(statistic).to be_an Hash
|
21
|
+
expect(statistic[:invitations]) == 378520
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/hh/client_spec.rb
CHANGED
@@ -7,9 +7,6 @@ describe HH::Client do
|
|
7
7
|
it "connection use Faraday::Request::Multipart" do
|
8
8
|
expect(connection.inspect).to include('Faraday::Request::Multipart')
|
9
9
|
end
|
10
|
-
it "response parse by ParseJson" do
|
11
|
-
expect(connection.inspect).to include('FaradayMiddleware::ParseJson')
|
12
|
-
end
|
13
10
|
it "default adapter is NetHttp" do
|
14
11
|
expect(connection.inspect).to include('Faraday::Adapter::NetHttp')
|
15
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Varavko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -92,6 +92,20 @@ dependencies:
|
|
92
92
|
- - <
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0.11'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: multi_json
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.7'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ~>
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '1.7'
|
95
109
|
description: A Ruby interface to the HeadHanter.
|
96
110
|
email:
|
97
111
|
- ivaravko@me.com
|
@@ -109,15 +123,42 @@ files:
|
|
109
123
|
- Rakefile
|
110
124
|
- hh.gemspec
|
111
125
|
- lib/hh.rb
|
126
|
+
- lib/hh/API/currency.rb
|
127
|
+
- lib/hh/API/employer.rb
|
128
|
+
- lib/hh/API/employment.rb
|
129
|
+
- lib/hh/API/field.rb
|
112
130
|
- lib/hh/API/metro.rb
|
131
|
+
- lib/hh/API/region.rb
|
132
|
+
- lib/hh/API/schedule.rb
|
113
133
|
- lib/hh/API/specialization.rb
|
134
|
+
- lib/hh/API/statistic.rb
|
114
135
|
- lib/hh/api.rb
|
115
136
|
- lib/hh/client.rb
|
137
|
+
- lib/hh/request.rb
|
116
138
|
- lib/hh/version.rb
|
139
|
+
- spec/fixtures/currency.json
|
140
|
+
- spec/fixtures/employer.json
|
141
|
+
- spec/fixtures/employment.json
|
142
|
+
- spec/fixtures/field.json
|
143
|
+
- spec/fixtures/field_all.json
|
117
144
|
- spec/fixtures/metro.json
|
118
145
|
- spec/fixtures/metro_line.json
|
119
146
|
- spec/fixtures/metro_station.json
|
147
|
+
- spec/fixtures/region.json
|
148
|
+
- spec/fixtures/regions_all.json
|
149
|
+
- spec/fixtures/schedule.json
|
150
|
+
- spec/fixtures/specialization.json
|
151
|
+
- spec/fixtures/specialization_all.json
|
152
|
+
- spec/fixtures/statistic.json
|
153
|
+
- spec/hh/api/currency_spec.rb
|
154
|
+
- spec/hh/api/employer_spec.rb
|
155
|
+
- spec/hh/api/employment_spec.rb
|
156
|
+
- spec/hh/api/field_spec.rb
|
120
157
|
- spec/hh/api/metro_spec.rb
|
158
|
+
- spec/hh/api/region_spec.rb
|
159
|
+
- spec/hh/api/schedule_spec.rb
|
160
|
+
- spec/hh/api/specialization_spec.rb
|
161
|
+
- spec/hh/api/statistic_spec.rb
|
121
162
|
- spec/hh/client_spec.rb
|
122
163
|
- spec/hh_spec.rb
|
123
164
|
- spec/spec_helper.rb
|
@@ -131,12 +172,12 @@ require_paths:
|
|
131
172
|
- lib
|
132
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
174
|
requirements:
|
134
|
-
- -
|
175
|
+
- - '>='
|
135
176
|
- !ruby/object:Gem::Version
|
136
177
|
version: '0'
|
137
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
179
|
requirements:
|
139
|
-
- -
|
180
|
+
- - '>='
|
140
181
|
- !ruby/object:Gem::Version
|
141
182
|
version: '0'
|
142
183
|
requirements: []
|
@@ -146,10 +187,29 @@ signing_key:
|
|
146
187
|
specification_version: 4
|
147
188
|
summary: A Ruby interface to the HeadHanter.
|
148
189
|
test_files:
|
190
|
+
- spec/fixtures/currency.json
|
191
|
+
- spec/fixtures/employer.json
|
192
|
+
- spec/fixtures/employment.json
|
193
|
+
- spec/fixtures/field.json
|
194
|
+
- spec/fixtures/field_all.json
|
149
195
|
- spec/fixtures/metro.json
|
150
196
|
- spec/fixtures/metro_line.json
|
151
197
|
- spec/fixtures/metro_station.json
|
198
|
+
- spec/fixtures/region.json
|
199
|
+
- spec/fixtures/regions_all.json
|
200
|
+
- spec/fixtures/schedule.json
|
201
|
+
- spec/fixtures/specialization.json
|
202
|
+
- spec/fixtures/specialization_all.json
|
203
|
+
- spec/fixtures/statistic.json
|
204
|
+
- spec/hh/api/currency_spec.rb
|
205
|
+
- spec/hh/api/employer_spec.rb
|
206
|
+
- spec/hh/api/employment_spec.rb
|
207
|
+
- spec/hh/api/field_spec.rb
|
152
208
|
- spec/hh/api/metro_spec.rb
|
209
|
+
- spec/hh/api/region_spec.rb
|
210
|
+
- spec/hh/api/schedule_spec.rb
|
211
|
+
- spec/hh/api/specialization_spec.rb
|
212
|
+
- spec/hh/api/statistic_spec.rb
|
153
213
|
- spec/hh/client_spec.rb
|
154
214
|
- spec/hh_spec.rb
|
155
215
|
- spec/spec_helper.rb
|