torg_api 0.1.3 → 0.1.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 +4 -4
- data/lib/torg_api/api/bidder.rb +10 -10
- data/lib/torg_api/api/commission.rb +48 -0
- data/lib/torg_api/api/contractor.rb +5 -24
- data/lib/torg_api/api/department.rb +60 -0
- data/lib/torg_api/api/fias.rb +39 -0
- data/lib/torg_api/api/lot.rb +6 -3
- data/lib/torg_api/api/offer.rb +63 -54
- data/lib/torg_api/api/okdp.rb +45 -0
- data/lib/torg_api/api/okved.rb +33 -0
- data/lib/torg_api/api/open_protocol.rb +67 -0
- data/lib/torg_api/api/plan_lot.rb +155 -0
- data/lib/torg_api/api/tender.rb +43 -27
- data/lib/torg_api/api/user.rb +43 -0
- data/lib/torg_api/base.rb +22 -4
- data/lib/torg_api/version.rb +1 -1
- data/lib/torg_api.rb +1 -0
- data/torg_api.gemspec +2 -2
- metadata +13 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cb5aeb42ea234f4e82fa775d4f8966bb0eac795
|
4
|
+
data.tar.gz: 7357b5b2440e9dee98b41a3db3c046adc2474514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 417c5836f733402eba111392b8f425d6a82af264c62e7effaec8354fe42590c6e42791823fab7eaa37b3bf0449f6c89e12dae4bf6d2f2c36ef71de2fd6740230
|
7
|
+
data.tar.gz: f716e8d1223f2b907a8024bcb682927843bac8e226c2b8feb056f8b8a878ec3d10c72c020b01f7750681e7e137da62ae4a3f82100c4048a343d2a325c0e92990
|
data/lib/torg_api/api/bidder.rb
CHANGED
@@ -42,11 +42,7 @@ module TorgApi
|
|
42
42
|
symbolize_names: true
|
43
43
|
)
|
44
44
|
|
45
|
-
|
46
|
-
b.tender_id = responce_b[:tender_id]
|
47
|
-
b.contractor_id = responce_b[:contractor_id]
|
48
|
-
b.id = responce_b[:id]
|
49
|
-
b
|
45
|
+
new(responce_b)
|
50
46
|
end
|
51
47
|
end
|
52
48
|
# Проверяет, есть ли файл с таким именем у данного участника
|
@@ -54,7 +50,7 @@ module TorgApi
|
|
54
50
|
# return [Boolean]
|
55
51
|
def file_exists?(file_name)
|
56
52
|
responce = JSON.parse(
|
57
|
-
torg_resource["tenders/#{tender_id}/bidders/#{id}/file_exists"].get(
|
53
|
+
TorgApi::Base.torg_resource["tenders/#{tender_id}/bidders/#{id}/file_exists"].get(
|
58
54
|
params: { file_name: file_name },
|
59
55
|
accept: :json,
|
60
56
|
content_type: :json,
|
@@ -71,14 +67,18 @@ module TorgApi
|
|
71
67
|
# @param note [String] Комментарии
|
72
68
|
# @return Nothing
|
73
69
|
def add_file(file, name = nil, note = nil)
|
70
|
+
document = if file.start_with?('http')
|
71
|
+
{ remote_document_url: file }
|
72
|
+
else
|
73
|
+
{ document: File.open(file) }
|
74
|
+
end
|
74
75
|
responce_f = JSON.parse(
|
75
|
-
torg_resource["tender_files"].post(
|
76
|
+
TorgApi::Base.torg_resource["tender_files"].post(
|
76
77
|
tender_file: {
|
77
78
|
area_id: TenderFileArea::BIDDER,
|
78
79
|
year: Date.current.year,
|
79
|
-
document: File.open(file),
|
80
80
|
external_filename: name
|
81
|
-
},
|
81
|
+
}.merge(document),
|
82
82
|
accept: :json,
|
83
83
|
content_type: :json,
|
84
84
|
format: :json
|
@@ -87,7 +87,7 @@ module TorgApi
|
|
87
87
|
)
|
88
88
|
|
89
89
|
responce_bf = JSON.parse(
|
90
|
-
torg_resource["tenders/#{tender_id}/bidders/#{id}"].patch(
|
90
|
+
TorgApi::Base.torg_resource["tenders/#{tender_id}/bidders/#{id}"].patch(
|
91
91
|
bidder: {
|
92
92
|
bidder_files_attributes: {
|
93
93
|
'0' => {
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module TorgApi
|
2
|
+
module Api
|
3
|
+
# Комиссия
|
4
|
+
class Commission < TorgApi::Base
|
5
|
+
|
6
|
+
# @return [Integer] id
|
7
|
+
attr_accessor :id
|
8
|
+
|
9
|
+
# @return [String] Наименование комиссии
|
10
|
+
attr_accessor :name
|
11
|
+
|
12
|
+
# @return [String] Наименование комиссии, родительный падеж
|
13
|
+
attr_accessor :name_r
|
14
|
+
|
15
|
+
# @return [Integer] id подразделения
|
16
|
+
attr_accessor :department_id
|
17
|
+
|
18
|
+
# @return [Integer] id типа комиссии
|
19
|
+
attr_accessor :commission_type_id
|
20
|
+
|
21
|
+
# @return [Boolean] Актуальность
|
22
|
+
attr_accessor :is_actual
|
23
|
+
|
24
|
+
# @return [Boolean] Может проводить закупки для сторонних заказчиков
|
25
|
+
attr_accessor :for_customers
|
26
|
+
|
27
|
+
# @return [Array] Члены комиссии
|
28
|
+
attr_accessor :commission_users
|
29
|
+
|
30
|
+
class << self
|
31
|
+
# Поиск коммиссии по id
|
32
|
+
# @param commission_id [Integer] id комиссии
|
33
|
+
# @return [Commission] возвращает объект комиссии
|
34
|
+
def find(commission_id)
|
35
|
+
responce = JSON.parse(
|
36
|
+
torg_resource["/commissions/#{commission_id}"].get(
|
37
|
+
accept: :json,
|
38
|
+
content_type: :json,
|
39
|
+
format: :json
|
40
|
+
),
|
41
|
+
symbolize_names: true
|
42
|
+
)
|
43
|
+
new(responce[:commission])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -55,38 +55,19 @@ module TorgApi
|
|
55
55
|
# Поиск id контрагентов по ИНН
|
56
56
|
# @param inn [String] ИНН
|
57
57
|
# @return [Integer[]] Массив id найденных контрагентов отсортированных по статусу и дате изменения
|
58
|
-
def find_by_inn(inn)
|
58
|
+
def find_by_inn(inn, kpp = nil)
|
59
59
|
responce = JSON.parse(
|
60
60
|
torg_resource["contractors/find_by_inn"].get(
|
61
|
-
params: { inn: inn },
|
61
|
+
params: { inn: inn, kpp: kpp },
|
62
62
|
accept: :json,
|
63
63
|
content_type: :json,
|
64
64
|
format: :json
|
65
65
|
),
|
66
|
-
symbolize_names: true
|
66
|
+
symbolize_names: true,
|
67
|
+
quirks_mode: true
|
67
68
|
)
|
68
69
|
|
69
|
-
|
70
|
-
c.id = responce[:id]
|
71
|
-
c.name = responce[:name]
|
72
|
-
c.fullname = responce[:fullname]
|
73
|
-
c.ownership = responce[:ownership]
|
74
|
-
c.inn = responce[:inn]
|
75
|
-
c.kpp = responce[:kpp]
|
76
|
-
c.ogrn = responce[:ogrn]
|
77
|
-
c.okpo = responce[:okpo]
|
78
|
-
c.status = responce[:status]
|
79
|
-
c.form = responce[:form]
|
80
|
-
c.legal_addr = responce[:legal_addr]
|
81
|
-
c.user_id = responce[:user_id]
|
82
|
-
c.is_resident = responce[:is_resident]
|
83
|
-
c.is_dzo = responce[:is_dzo]
|
84
|
-
c.is_sme = responce[:is_sme]
|
85
|
-
c.jsc_form_id = responce[:jsc_form_id]
|
86
|
-
c.sme_type_id = responce[:sme_type_id]
|
87
|
-
c.oktmo = responce[:oktmo]
|
88
|
-
c.reg_date = responce[:reg_date]
|
89
|
-
c
|
70
|
+
responce && new(responce)
|
90
71
|
end
|
91
72
|
|
92
73
|
# Создаёт контрагента
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module TorgApi
|
2
|
+
module Api
|
3
|
+
# Подразделение заказчика в ТОРГ
|
4
|
+
class Department < TorgApi::Base
|
5
|
+
# @param id [Integer] id department
|
6
|
+
|
7
|
+
# @return [Integer] id
|
8
|
+
attr_accessor :id
|
9
|
+
# @return [Integer] id подразделения верхнего уровня
|
10
|
+
attr_accessor :parent_dept_id
|
11
|
+
# @return [String] Наименование
|
12
|
+
attr_accessor :name
|
13
|
+
# @return [String] Юридический адрес
|
14
|
+
attr_accessor :legal_address
|
15
|
+
# @return [String] Фактический адрес
|
16
|
+
attr_accessor :fact_address
|
17
|
+
# @return [Boolean] Является заказчиком?
|
18
|
+
attr_accessor :is_customer
|
19
|
+
# @return [Boolean] Является организатором?
|
20
|
+
attr_accessor :is_organizer
|
21
|
+
# @return [Integer] id на ЭТП
|
22
|
+
attr_accessor :etp_id
|
23
|
+
# @return [String] Родословная
|
24
|
+
attr_accessor :ancestry
|
25
|
+
# @return [String] Полное наименование
|
26
|
+
attr_accessor :fullname
|
27
|
+
# @return [Integer] ИНН
|
28
|
+
attr_accessor :inn
|
29
|
+
# @return [Integer] КПП
|
30
|
+
attr_accessor :kpp
|
31
|
+
# @return [Integer] id формы собственности
|
32
|
+
attr_accessor :ownership_id
|
33
|
+
# @return [String] Краткое наименование
|
34
|
+
attr_accessor :shortname
|
35
|
+
# @return [Boolean] Является потребителем
|
36
|
+
attr_accessor :is_consumer
|
37
|
+
# @return [Numeric] Лимит по 223 ФЗ
|
38
|
+
attr_accessor :eis223_limit
|
39
|
+
# @return [Array] Форма собственности
|
40
|
+
attr_accessor :ownership
|
41
|
+
# @return [Array] Контактная информация
|
42
|
+
attr_accessor :contact
|
43
|
+
|
44
|
+
|
45
|
+
class << self
|
46
|
+
def find(id)
|
47
|
+
responce = JSON.parse(
|
48
|
+
torg_resource["departments/#{id}"].get(
|
49
|
+
accept: :json,
|
50
|
+
content_type: :json,
|
51
|
+
format: :json
|
52
|
+
),
|
53
|
+
symbolize_names: true
|
54
|
+
)
|
55
|
+
new(responce[:department])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module TorgApi
|
2
|
+
module Api
|
3
|
+
# Адреса (ФИАС) системы ТОРГ
|
4
|
+
class Fias < TorgApi::Base
|
5
|
+
# @param id [Integer] id user
|
6
|
+
|
7
|
+
# @return [Integer] id
|
8
|
+
attr_accessor :id
|
9
|
+
# @return [Guid] Guid адреса
|
10
|
+
attr_accessor :aoid
|
11
|
+
# @return [Guid] Guid дома
|
12
|
+
attr_accessor :houseid
|
13
|
+
# @return [String] Адрес
|
14
|
+
attr_accessor :name
|
15
|
+
# @return [Integer] Код региона
|
16
|
+
attr_accessor :regioncode
|
17
|
+
# @return [Integer] Почтовый код
|
18
|
+
attr_accessor :postalcode
|
19
|
+
# @return [Integer] ОКАТО
|
20
|
+
attr_accessor :okato
|
21
|
+
# @return [Integer] ОКТМО
|
22
|
+
attr_accessor :oktmo
|
23
|
+
|
24
|
+
class << self
|
25
|
+
def find(id)
|
26
|
+
responce = JSON.parse(
|
27
|
+
torg_resource["fias/#{id}"].get(
|
28
|
+
accept: :json,
|
29
|
+
content_type: :json,
|
30
|
+
format: :json
|
31
|
+
),
|
32
|
+
symbolize_names: true
|
33
|
+
)
|
34
|
+
new(responce)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/torg_api/api/lot.rb
CHANGED
@@ -6,7 +6,8 @@ module TorgApi
|
|
6
6
|
attr_accessor :id
|
7
7
|
# @return [Integer] Номер
|
8
8
|
attr_accessor :num
|
9
|
-
|
9
|
+
# @return [Array] Спецификации
|
10
|
+
attr_accessor :specifications
|
10
11
|
class << self
|
11
12
|
# Поиск закупки по id
|
12
13
|
# @param id [Integer] id закупки
|
@@ -17,9 +18,11 @@ module TorgApi
|
|
17
18
|
accept: :json,
|
18
19
|
content_type: :json,
|
19
20
|
format: :json
|
20
|
-
)
|
21
|
+
),
|
22
|
+
symbolize_names: true
|
21
23
|
)
|
22
|
-
responce[
|
24
|
+
lot = responce[:lots].select { |value| value[:num] == num }.first
|
25
|
+
new(lot) if lot
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
data/lib/torg_api/api/offer.rb
CHANGED
@@ -2,66 +2,75 @@ module TorgApi
|
|
2
2
|
module Api
|
3
3
|
# Оферта участника
|
4
4
|
class Offer < TorgApi::Base
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# @param hash [Integer] хэш ответа веб-сервиса B2B
|
10
|
-
# @return [Integer] id созданного объекта
|
11
|
-
def create(lot_id, bidder_id, hash)
|
12
|
-
o = nil
|
13
|
-
TorgApi::Models::Offer.transaction do
|
14
|
-
o = TorgApi::Models::Offer.create!(
|
15
|
-
lot_id: lot_id,
|
16
|
-
bidder_id: bidder_id,
|
17
|
-
num: hash[:offer_num],
|
18
|
-
version: 0,
|
19
|
-
type_id: CoverLabels::REQUEST,
|
20
|
-
status_id: extract_status(hash[:winner])
|
21
|
-
)
|
5
|
+
# Создаёт оферту
|
6
|
+
# @param lot_id [Integer] id лота
|
7
|
+
# @param bidder_id [Integer] id участника
|
8
|
+
# @param hash [Integer] хэш ответа веб-сервиса B2B
|
22
9
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
10
|
+
# @return [Integer] id созданного объекта
|
11
|
+
attr_accessor :id
|
12
|
+
# @return [Integer] id лота
|
13
|
+
attr_accessor :lot_id
|
14
|
+
# @return [Integer] id участника
|
15
|
+
attr_accessor :bidder_id
|
16
|
+
# @return [String] номер оферты
|
17
|
+
attr_accessor :num
|
18
|
+
# @return [Integer] версия
|
19
|
+
attr_accessor :version
|
20
|
+
# @return [Integer] id типа оферты
|
21
|
+
attr_accessor :type_id
|
22
|
+
# @return [Integer] id статуса
|
23
|
+
attr_accessor :status_id
|
24
|
+
# @return [Array] Спецификация оферты
|
25
|
+
attr_accessor :offer_specifications
|
34
26
|
|
35
|
-
|
27
|
+
class << self
|
28
|
+
def create(lot_id, bidder_id, hash, torg_spec_id, tender_id)
|
29
|
+
responce_o = JSON.parse(
|
30
|
+
torg_resource["tenders/#{tender_id}/bidders/#{bidder_id}/offers"].post(
|
31
|
+
offer: {
|
32
|
+
lot_id: lot_id,
|
33
|
+
bidder_id: bidder_id,
|
34
|
+
num: hash[:num],
|
35
|
+
version: 0,
|
36
|
+
type_id: CoverLabels::REQUEST,
|
37
|
+
status_id: OfferStatuses::NEW,
|
38
|
+
offer_specifications_attributes: {
|
39
|
+
'0' => {
|
40
|
+
specification_id: torg_spec_id,
|
41
|
+
cost: hash[:cost],
|
42
|
+
cost_nds: hash[:cost_nds],
|
43
|
+
final_cost: hash[:cost],
|
44
|
+
final_cost_nds: hash[:cost_nds]
|
45
|
+
}
|
46
|
+
}
|
47
|
+
},
|
48
|
+
accept: :json,
|
49
|
+
content_type: :json,
|
50
|
+
format: :json
|
51
|
+
),
|
52
|
+
symbolize_names: true
|
53
|
+
)
|
54
|
+
new(responce_o)
|
36
55
|
end
|
37
56
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
offer_spec.final_cost_nds = index == 0 ? hash[:final_price] : 0
|
54
|
-
end
|
55
|
-
|
56
|
-
offer.save
|
57
|
-
end
|
58
|
-
|
59
|
-
offer.id
|
57
|
+
def find(tender_id, bidder_id, lot_id, offer_num, spec_id)
|
58
|
+
responce = JSON.parse(
|
59
|
+
torg_resource["tenders/#{tender_id}/bidders/#{bidder_id}/offers"].get(
|
60
|
+
accept: :json,
|
61
|
+
content_type: :json,
|
62
|
+
format: :json
|
63
|
+
),
|
64
|
+
symbolize_names: true
|
65
|
+
)
|
66
|
+
offer = responce.select { |value|
|
67
|
+
value[:lot_id] == lot_id &&
|
68
|
+
value[:num] == offer_num &&
|
69
|
+
value[:offer_specifications][0][:offer_specification][:specification_id] == spec_id
|
70
|
+
}
|
71
|
+
offer
|
60
72
|
end
|
61
73
|
|
62
|
-
def extract_status(winner)
|
63
|
-
winner ? OfferStatuses::WIN : OfferStatuses::NEW
|
64
|
-
end
|
65
74
|
end
|
66
75
|
end
|
67
76
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module TorgApi
|
2
|
+
module Api
|
3
|
+
# Справочник кодов ОКДП
|
4
|
+
class Okdp < TorgApi::Base
|
5
|
+
# @param id [Integer] id okdp
|
6
|
+
|
7
|
+
# @return [Integer] id
|
8
|
+
attr_accessor :id
|
9
|
+
# @return [Integer] Полное наименование
|
10
|
+
attr_accessor :fullname
|
11
|
+
# @return [Integer] Наименование
|
12
|
+
attr_accessor :title
|
13
|
+
# @return [Integer] Код
|
14
|
+
attr_accessor :code
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def find(id)
|
18
|
+
responce = JSON.parse(
|
19
|
+
torg_resource["okdp/show"].get(
|
20
|
+
params: { id: id },
|
21
|
+
accept: :json,
|
22
|
+
content_type: :json,
|
23
|
+
format: :json
|
24
|
+
),
|
25
|
+
symbolize_names: true
|
26
|
+
)
|
27
|
+
new(responce[:okdp])
|
28
|
+
end
|
29
|
+
|
30
|
+
def find_old_code(new_value)
|
31
|
+
JSON.parse(
|
32
|
+
torg_resource["okdp/reform_old_value"].get(
|
33
|
+
params: { new_value: new_value },
|
34
|
+
accept: :json,
|
35
|
+
content_type: :json,
|
36
|
+
format: :json
|
37
|
+
),
|
38
|
+
symbolize_names: true
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module TorgApi
|
2
|
+
module Api
|
3
|
+
# Справочник кодов ОКВЭД
|
4
|
+
class Okved < TorgApi::Base
|
5
|
+
# @param id [Integer] id okved
|
6
|
+
|
7
|
+
# @return [Integer] id
|
8
|
+
attr_accessor :id
|
9
|
+
# @return [Integer] Полное наименование
|
10
|
+
attr_accessor :fullname
|
11
|
+
# @return [Integer] Наименование
|
12
|
+
attr_accessor :title
|
13
|
+
# @return [Integer] Код
|
14
|
+
attr_accessor :code
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def find(id)
|
18
|
+
responce = JSON.parse(
|
19
|
+
torg_resource["okveds/show"].get(
|
20
|
+
params: { id: id },
|
21
|
+
accept: :json,
|
22
|
+
content_type: :json,
|
23
|
+
format: :json
|
24
|
+
),
|
25
|
+
symbolize_names: true
|
26
|
+
)
|
27
|
+
new(responce[:okved])
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module TorgApi
|
2
|
+
module Api
|
3
|
+
# Протокол вскрытия
|
4
|
+
class OpenProtocol < TorgApi::Base
|
5
|
+
# @return [Integer] id
|
6
|
+
attr_accessor :id
|
7
|
+
|
8
|
+
# @return [Integer] ID закупки
|
9
|
+
attr_accessor :tender_id
|
10
|
+
|
11
|
+
# @return [Integer] ID секретаря
|
12
|
+
attr_accessor :clerk_id
|
13
|
+
|
14
|
+
# @return [String] Место проведения
|
15
|
+
attr_accessor :location
|
16
|
+
|
17
|
+
# @return [Integer] Номер протокола
|
18
|
+
attr_accessor :num
|
19
|
+
|
20
|
+
# @return [String] Дата составления протокола
|
21
|
+
attr_accessor :open_date
|
22
|
+
|
23
|
+
# @return [String] Решение комиссии
|
24
|
+
attr_accessor :resolve
|
25
|
+
|
26
|
+
# @return [String] Город
|
27
|
+
attr_accessor :sign_city
|
28
|
+
|
29
|
+
# @return [String] Дата подписания протокола
|
30
|
+
attr_accessor :sign_date
|
31
|
+
|
32
|
+
# @return [Integer] ID комиссии
|
33
|
+
attr_accessor :commission_id,
|
34
|
+
|
35
|
+
class << self
|
36
|
+
# Создает протокол вскрытия в системе
|
37
|
+
# @param tender_id [Integer] id закупки
|
38
|
+
# @param params [Hash] Параметры протокола вскрытия B2B-Center
|
39
|
+
# @return [OpenProtocol]
|
40
|
+
def create(tender_id, params)
|
41
|
+
responce = JSON.parse(
|
42
|
+
torg_resource["tenders/#{tender_id}/open_protocols"].post(
|
43
|
+
open_protocol: {
|
44
|
+
tender_id: tender_id,
|
45
|
+
num: params[:number],
|
46
|
+
open_date: params[:date],
|
47
|
+
sign_city: params[:place],
|
48
|
+
sign_date: params[:sign_protocol_date],
|
49
|
+
compound_open_date: params[:procedure_stage_date],
|
50
|
+
commission_id: params[:commission_id],
|
51
|
+
resolve: params[:resolve],
|
52
|
+
location: params[:location],
|
53
|
+
clerk_id: params[:clerk_id]
|
54
|
+
},
|
55
|
+
accept: :json,
|
56
|
+
content_type: :json,
|
57
|
+
format: :json
|
58
|
+
),
|
59
|
+
symbolize_names: true
|
60
|
+
)
|
61
|
+
|
62
|
+
new(responce)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
module TorgApi
|
2
|
+
module Api
|
3
|
+
# Планирование
|
4
|
+
class PlanLot < TorgApi::Base
|
5
|
+
# @return [Integer] id
|
6
|
+
attr_accessor :id
|
7
|
+
|
8
|
+
# ГУИД лота
|
9
|
+
# @return [String]]
|
10
|
+
attr_accessor :guid
|
11
|
+
|
12
|
+
# Версия записи (0 - текущая)
|
13
|
+
# @return [Integer]
|
14
|
+
attr_accessor :version
|
15
|
+
|
16
|
+
# Год ГКПЗ
|
17
|
+
# @return [Integer]
|
18
|
+
attr_accessor :gkpz_year
|
19
|
+
|
20
|
+
# Номер закупки
|
21
|
+
# @return [Integer]
|
22
|
+
attr_accessor :num_tender
|
23
|
+
|
24
|
+
# Номер лота
|
25
|
+
# @return [Integer]
|
26
|
+
attr_accessor :num_lot
|
27
|
+
|
28
|
+
# Наименование лота
|
29
|
+
# @return [String]
|
30
|
+
attr_accessor :lot_name
|
31
|
+
|
32
|
+
# ИД организатора
|
33
|
+
# @return [Integer]
|
34
|
+
attr_accessor :department_id
|
35
|
+
|
36
|
+
# ИД способа закупки
|
37
|
+
# @return [Integer]
|
38
|
+
attr_accessor :tender_type_id
|
39
|
+
|
40
|
+
# Обоснование выбора способа закупки
|
41
|
+
# @return [String]
|
42
|
+
attr_accessor :tender_type_explanations
|
43
|
+
|
44
|
+
# Предмет закупки
|
45
|
+
# @return [Integer]
|
46
|
+
attr_accessor :subject_type_id
|
47
|
+
|
48
|
+
# ИД адреса ЭТП, на которой будет объявлена закупка
|
49
|
+
# @return [Integer]
|
50
|
+
attr_accessor :etp_address_id
|
51
|
+
|
52
|
+
# Дата объявления
|
53
|
+
# @return [Date]
|
54
|
+
attr_accessor :announce_date
|
55
|
+
|
56
|
+
# Обосновывающий док-т (только для ЕИ)
|
57
|
+
# @return [String]
|
58
|
+
attr_accessor :explanations_doc
|
59
|
+
|
60
|
+
# Пункт положения
|
61
|
+
# @return [String]
|
62
|
+
attr_accessor :point_clause
|
63
|
+
|
64
|
+
# ИД протокола
|
65
|
+
# @return [Integer]
|
66
|
+
attr_accessor :protocol_id
|
67
|
+
|
68
|
+
# ИД статуса
|
69
|
+
# @return [Integer]
|
70
|
+
attr_accessor :status_id
|
71
|
+
|
72
|
+
# ИД комиссии
|
73
|
+
# @return [Integer]
|
74
|
+
attr_accessor :commission_id
|
75
|
+
|
76
|
+
# ИД пользователя
|
77
|
+
# @return [Integer]
|
78
|
+
attr_accessor :user_id
|
79
|
+
|
80
|
+
# ИД рутового заказчика
|
81
|
+
# @return [Integer]
|
82
|
+
attr_accessor :root_customer_id
|
83
|
+
|
84
|
+
# ГУИД основной закупки
|
85
|
+
# @return [String]
|
86
|
+
attr_accessor :additional_to
|
87
|
+
|
88
|
+
# Состояние в ГКПЗ: 0 - внеплан, 1 - план
|
89
|
+
# @return [Integer]
|
90
|
+
attr_accessor :state
|
91
|
+
|
92
|
+
# Отношение к участию субъектов малого и среднего предпринимательства
|
93
|
+
# @return [Integer]
|
94
|
+
attr_accessor :sme_type_id
|
95
|
+
|
96
|
+
# Номер доп. соглашения
|
97
|
+
# @return [Integer]
|
98
|
+
attr_accessor :additional_num
|
99
|
+
|
100
|
+
# Главное направление
|
101
|
+
# @return [Integer]
|
102
|
+
attr_accessor :main_direction_id
|
103
|
+
|
104
|
+
# Типы закупок из постановления правительства №1352 от 11.12.2014
|
105
|
+
# @return [Integer]
|
106
|
+
attr_accessor :order1352_id
|
107
|
+
|
108
|
+
# GUID закупки предварительного отбора
|
109
|
+
# @return [String]
|
110
|
+
attr_accessor :preselection_guid
|
111
|
+
|
112
|
+
# Ссылка на пункт положения
|
113
|
+
# @return [Integer]
|
114
|
+
attr_accessor :regulation_item_id
|
115
|
+
|
116
|
+
# Дата направления поручения
|
117
|
+
# @return [Date]
|
118
|
+
attr_accessor :charge_date
|
119
|
+
|
120
|
+
# Протокол
|
121
|
+
# @return [Hash]
|
122
|
+
attr_accessor :protocol
|
123
|
+
|
124
|
+
# Готовые лимиты
|
125
|
+
# @return [Array]
|
126
|
+
attr_accessor :plan_annual_limits
|
127
|
+
|
128
|
+
# Спецификации
|
129
|
+
# @return [Array]
|
130
|
+
attr_accessor :plan_specifications
|
131
|
+
|
132
|
+
# Планируемые участники
|
133
|
+
# @return [Array]
|
134
|
+
attr_accessor :plan_lot_contractors
|
135
|
+
|
136
|
+
|
137
|
+
class << self
|
138
|
+
# Поиск лота из планирования по id
|
139
|
+
# @param plan_lot_id [Integer] id закупки
|
140
|
+
# @return [PlanLot] возвращает объект лот планирования
|
141
|
+
def find(plan_lot_id)
|
142
|
+
responce = JSON.parse(
|
143
|
+
torg_resource["plan_lots/#{plan_lot_id}"].get(
|
144
|
+
accept: :json,
|
145
|
+
content_type: :json,
|
146
|
+
format: :json
|
147
|
+
),
|
148
|
+
symbolize_names: true
|
149
|
+
)
|
150
|
+
new(responce[:plan_lot])
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
data/lib/torg_api/api/tender.rb
CHANGED
@@ -12,6 +12,8 @@ module TorgApi
|
|
12
12
|
attr_accessor :tender_type_id
|
13
13
|
# @return [String] Наименование способа закупки
|
14
14
|
attr_accessor :tender_type_name
|
15
|
+
# @return [String] Полное наименование способа закупки
|
16
|
+
attr_accessor :tender_type_fullname
|
15
17
|
# @return [String] Обоснование выбора способа
|
16
18
|
attr_accessor :tender_type_explanations
|
17
19
|
# @return [Integer] Адрес ЭТП
|
@@ -133,20 +135,27 @@ module TorgApi
|
|
133
135
|
# @return [String] Место предоставления конвертов
|
134
136
|
attr_accessor :offer_reception_place
|
135
137
|
# @return [Integer] Часовой пояс проведения закупки
|
138
|
+
attr_accessor :b2b_classifiers
|
139
|
+
# @return [integer] Классификатор B2B-Center
|
136
140
|
attr_accessor :local_time_zone_id
|
141
|
+
# @return [Array] Лоты
|
142
|
+
attr_accessor :lots
|
143
|
+
# @return [Array] Файлы
|
144
|
+
attr_accessor :link_tender_files
|
137
145
|
# Поиск участника по его идентификатору в справочнике
|
138
146
|
# @param contractor_id [Integer] Идентификатор котрагента в справочнике
|
139
147
|
# return [Bidder] возвращает объект участника
|
140
148
|
def find_bidder(contractor_id)
|
141
149
|
responce = JSON.parse(
|
142
|
-
torg_resource["tenders/#{id}/bidders"].get(
|
150
|
+
TorgApi::Base.torg_resource["tenders/#{id}/bidders"].get(
|
143
151
|
accept: :json,
|
144
152
|
content_type: :json,
|
145
153
|
format: :json
|
146
|
-
)
|
154
|
+
),
|
155
|
+
symbolize_names: true
|
147
156
|
)
|
148
|
-
bidder = responce.select { |value| value[
|
149
|
-
bidder
|
157
|
+
bidder = responce.select { |value| value[:contractor_id] == contractor_id }[0]
|
158
|
+
Bidder.new(bidder) if bidder
|
150
159
|
end
|
151
160
|
|
152
161
|
def find_lot(num)
|
@@ -167,29 +176,36 @@ module TorgApi
|
|
167
176
|
symbolize_names: true
|
168
177
|
)
|
169
178
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
179
|
+
new(responce)
|
180
|
+
end
|
181
|
+
|
182
|
+
def update_etp_num(tender_id, etp_num)
|
183
|
+
responce = JSON.parse(
|
184
|
+
torg_resource["tenders/#{tender_id}"].patch(
|
185
|
+
tender: {
|
186
|
+
etp_num: etp_num
|
187
|
+
},
|
188
|
+
accept: :json,
|
189
|
+
content_type: :json,
|
190
|
+
format: :json
|
191
|
+
),
|
192
|
+
symbolize_names: true
|
193
|
+
)
|
194
|
+
new(responce)
|
195
|
+
end
|
196
|
+
|
197
|
+
# Поиск закупки по guid запланированного лота
|
198
|
+
# @param guid [Guid] guid запланированного лота
|
199
|
+
# @return [Tender] возвращает объект закупки
|
200
|
+
def find_by_guid(guid)
|
201
|
+
responce = JSON.parse(
|
202
|
+
torg_resource["tenders?tender_filter[plan_lot_guids=#{guid}"].get(
|
203
|
+
accept: :json,
|
204
|
+
content_type: :json,
|
205
|
+
format: :json
|
206
|
+
),
|
207
|
+
symbolize_names: true
|
208
|
+
)
|
193
209
|
end
|
194
210
|
end
|
195
211
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module TorgApi
|
2
|
+
module Api
|
3
|
+
# Пользователи системы ТОРГ
|
4
|
+
class User < TorgApi::Base
|
5
|
+
# @param id [Integer] id user
|
6
|
+
|
7
|
+
# @return [Integer] id
|
8
|
+
attr_accessor :id
|
9
|
+
# @return [Integer] Электронная почта
|
10
|
+
attr_accessor :email
|
11
|
+
# @return [Integer] Фамилия
|
12
|
+
attr_accessor :surname
|
13
|
+
# @return [Integer] Имя
|
14
|
+
attr_accessor :name
|
15
|
+
# @return [Integer] Отчество
|
16
|
+
attr_accessor :patronymic
|
17
|
+
# @return [Integer] Должность
|
18
|
+
attr_accessor :user_job
|
19
|
+
# @return [Integer] Телефон рабочий
|
20
|
+
attr_accessor :phone_public
|
21
|
+
# @return [Integer] Телефон сотовый
|
22
|
+
attr_accessor :phone_cell
|
23
|
+
# @return [Integer] Факс
|
24
|
+
attr_accessor :fax
|
25
|
+
# @return [Integer] ID подразделения
|
26
|
+
attr_accessor :department_id
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def find(id)
|
30
|
+
responce = JSON.parse(
|
31
|
+
torg_resource["user/#{id}"].get(
|
32
|
+
accept: :json,
|
33
|
+
content_type: :json,
|
34
|
+
format: :json
|
35
|
+
),
|
36
|
+
symbolize_names: true
|
37
|
+
)
|
38
|
+
new(responce)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/torg_api/base.rb
CHANGED
@@ -4,6 +4,28 @@ module TorgApi
|
|
4
4
|
extend TorgApi::Constants
|
5
5
|
REMOVE_HASH_ATTRS = [:@id]
|
6
6
|
|
7
|
+
class << self
|
8
|
+
def attr_accessor(*vars)
|
9
|
+
@attributes ||= []
|
10
|
+
@attributes.concat vars
|
11
|
+
super(*vars)
|
12
|
+
end
|
13
|
+
|
14
|
+
def attributes
|
15
|
+
@attributes
|
16
|
+
end
|
17
|
+
|
18
|
+
def torg_resource
|
19
|
+
@@torg_resource ||= RestClient::Resource.new(Settings.torg_url[:host], Settings.torg_url[:ssl])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(args = {})
|
24
|
+
self.class.attributes.each do |attribute|
|
25
|
+
self.send("#{attribute}=", args[attribute]) if args.key?(attribute)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
7
29
|
def to_h
|
8
30
|
hash = {}
|
9
31
|
vars = instance_variables
|
@@ -12,9 +34,5 @@ module TorgApi
|
|
12
34
|
vars.each { |var| hash[var.to_s.delete('@').to_sym] = instance_variable_get(var) }
|
13
35
|
hash
|
14
36
|
end
|
15
|
-
|
16
|
-
def self.torg_resource
|
17
|
-
@@torg_resource ||= RestClient::Resource.new(Settings.torg_url[:host], Settings.torg_url[:ssl])
|
18
|
-
end
|
19
37
|
end
|
20
38
|
end
|
data/lib/torg_api/version.rb
CHANGED
data/lib/torg_api.rb
CHANGED
data/torg_api.gemspec
CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'torg_api'
|
8
8
|
spec.version = TorgApi::VERSION
|
9
9
|
spec.authors = ['Archakov Aleksandr', 'Andrew Ageev', 'Dmitrii Bodakov']
|
10
|
-
spec.email = ['
|
10
|
+
spec.email = ['bodakovda@arink-group.ru']
|
11
11
|
spec.description = %q{API for Torg system}
|
12
12
|
spec.summary = %q{Torg API}
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/LtdArink-Group/torg_api/'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($RS)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torg_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Archakov Aleksandr
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-09-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '0'
|
57
57
|
description: API for Torg system
|
58
58
|
email:
|
59
|
-
-
|
59
|
+
- bodakovda@arink-group.ru
|
60
60
|
executables: []
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
@@ -70,16 +70,24 @@ files:
|
|
70
70
|
- lib/torg_api.rb
|
71
71
|
- lib/torg_api/api.rb
|
72
72
|
- lib/torg_api/api/bidder.rb
|
73
|
+
- lib/torg_api/api/commission.rb
|
73
74
|
- lib/torg_api/api/contractor.rb
|
75
|
+
- lib/torg_api/api/department.rb
|
76
|
+
- lib/torg_api/api/fias.rb
|
74
77
|
- lib/torg_api/api/lot.rb
|
75
78
|
- lib/torg_api/api/offer.rb
|
79
|
+
- lib/torg_api/api/okdp.rb
|
80
|
+
- lib/torg_api/api/okved.rb
|
81
|
+
- lib/torg_api/api/open_protocol.rb
|
82
|
+
- lib/torg_api/api/plan_lot.rb
|
76
83
|
- lib/torg_api/api/tender.rb
|
84
|
+
- lib/torg_api/api/user.rb
|
77
85
|
- lib/torg_api/base.rb
|
78
86
|
- lib/torg_api/constants.rb
|
79
87
|
- lib/torg_api/settings.rb
|
80
88
|
- lib/torg_api/version.rb
|
81
89
|
- torg_api.gemspec
|
82
|
-
homepage: https://github.com/
|
90
|
+
homepage: https://github.com/LtdArink-Group/torg_api/
|
83
91
|
licenses:
|
84
92
|
- MIT
|
85
93
|
metadata: {}
|
@@ -99,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
107
|
version: '0'
|
100
108
|
requirements: []
|
101
109
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.6.11
|
103
111
|
signing_key:
|
104
112
|
specification_version: 4
|
105
113
|
summary: Torg API
|