Class: TorgApi::Api::Fias

Inherits:
Base
  • Object
show all
Defined in:
lib/torg_api/api/fias.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

#aoidGuid

Returns Guid адреса.

Returns:

  • (Guid)

    Guid адреса



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

def aoid
  @aoid
end

#houseidGuid

Returns Guid дома.

Returns:

  • (Guid)

    Guid дома



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

def houseid
  @houseid
end

#idInteger

Returns id.

Returns:

  • (Integer)

    id



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

def id
  @id
end

#nameString

Returns Адрес.

Returns:

  • (String)

    Адрес



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

def name
  @name
end

#okatoInteger

Returns ОКАТО.

Returns:

  • (Integer)

    ОКАТО



20
21
22
# File 'lib/torg_api/api/fias.rb', line 20

def okato
  @okato
end

#oktmoInteger

Returns ОКТМО.

Returns:

  • (Integer)

    ОКТМО



22
23
24
# File 'lib/torg_api/api/fias.rb', line 22

def oktmo
  @oktmo
end

#postalcodeInteger

Returns Почтовый код.

Returns:

  • (Integer)

    Почтовый код



18
19
20
# File 'lib/torg_api/api/fias.rb', line 18

def postalcode
  @postalcode
end

#regioncodeInteger

Returns Код региона.

Returns:

  • (Integer)

    Код региона



16
17
18
# File 'lib/torg_api/api/fias.rb', line 16

def regioncode
  @regioncode
end

Class Method Details

.find(id) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/torg_api/api/fias.rb', line 25

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