Class: TorgApi::Api::Okdp

Inherits:
Base
  • Object
show all
Defined in:
lib/torg_api/api/okdp.rb

Overview

Справочник кодов ОКДП

Constant Summary

Constants inherited from Base

Base::REMOVE_HASH_ATTRS

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

attr_accessor, attributes, #initialize, #to_h, torg_resource

Constructor Details

This class inherits a constructor from TorgApi::Base

Instance Attribute Details

#codeInteger

Returns Код.

Returns:

  • (Integer)

    Код



14
15
16
# File 'lib/torg_api/api/okdp.rb', line 14

def code
  @code
end

#fullnameInteger

Returns Полное наименование.

Returns:

  • (Integer)

    Полное наименование



10
11
12
# File 'lib/torg_api/api/okdp.rb', line 10

def fullname
  @fullname
end

#idInteger

Returns id.

Returns:

  • (Integer)

    id



8
9
10
# File 'lib/torg_api/api/okdp.rb', line 8

def id
  @id
end

#titleInteger

Returns Наименование.

Returns:

  • (Integer)

    Наименование



12
13
14
# File 'lib/torg_api/api/okdp.rb', line 12

def title
  @title
end

Class Method Details

.find(id) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/torg_api/api/okdp.rb', line 17

def find(id)
  responce = JSON.parse(
    torg_resource["okdp/show"].get(
      params: { id: id },
      accept: :json,
      content_type: :json,
      format: :json
    ),
    symbolize_names: true
  )
  new(responce[:okdp])
end

.find_old_code(new_value) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/torg_api/api/okdp.rb', line 30

def find_old_code(new_value)
  JSON.parse(
    torg_resource["okdp/reform_old_value"].get(
      params: { new_value: new_value },
      accept: :json,
      content_type: :json,
      format: :json
    ),
    symbolize_names: true
  )
end