class B2bCenterApi::RemoteMarket

Методы класса RemoteMarket

Public Class Methods

new(client) click to toggle source
# File lib/b2b_center_api/remote_market.rb, line 6
def initialize(client)
  @client = client
  @client_web = WebService::RemoteMarket.new(client)
end

Public Instance Methods

find_firm_by_inn(inn) click to toggle source

Получить информацию об организации по инн @param inn [String] ИНН организации @return [WebService::Types::FirmData]

# File lib/b2b_center_api/remote_market.rb, line 69
def find_firm_by_inn(inn)
  response = @client_web.command :find_firm, firm_request: { inn: inn }
  WebService::Types::FirmData.from_response(response, @client)
end
get_address(address_id) click to toggle source

Получить адрес @param address_id [Integer] ID адреса @return [String

# File lib/b2b_center_api/remote_market.rb, line 53
def get_address(address_id)
  response = @client_web.command :get_address, address_id: address_id
  WebService::Types::AddressData.from_response(response, @client)
end
get_address_id_by_okato(okato:, address:, country: 0, firm_id: 0) click to toggle source

Получить адрес организации по ОКАТО @param okato [String] ОКАТО организации @param country [Integer] Код страны. Если значение равно = 0, то используется код России = 643 @param address [String] Адрес (обязательно для заполнения) @param firm_id [Integer] ID своей или подчиненной организации. Если = 0, то получаем идентификатор адреса своей организации @return [String

# File lib/b2b_center_api/remote_market.rb, line 45
def get_address_id_by_okato(okato:, address:, country: 0, firm_id: 0)
  response = @client_web.command :get_address_id_by_okato, okato: okato, address: address, country: country, firm_id: firm_id
  WebService::Types::Id.from_response(response)
end
get_addresses_ids(firm_id = 0) click to toggle source

Получить список адресов организации @param firm_id [Integer] ID организации или 0 для своей организации @return [String

# File lib/b2b_center_api/remote_market.rb, line 34
def get_addresses_ids(firm_id = 0)
  response = @client_web.command :get_addresses_ids, firm_id: firm_id
  WebService::Types::ArrayOfIds.from_response(response)
end
get_classifier_rows(ids) click to toggle source

Получить строки классификатора @param ids [String ID категорий классификатора организации @return [String

# File lib/b2b_center_api/remote_market.rb, line 26
def get_classifier_rows(ids)
  response = @client_web.command :get_classifier_rows, ids: ids
  WebService::Types::OkdpRow.from_response(response)
end
get_firm_classifier(firm_id, type) click to toggle source

Получить категории классификатора организации @param firm_id [Integer] ID организации или 0 для своей организации @param type [Integer] Тип продукции и услуг

Возможные значения:
  '0' - Потребляемая продукция и услуги
  '1' - Предлагаемая продукция и услуги

@return [String

# File lib/b2b_center_api/remote_market.rb, line 18
def get_firm_classifier(firm_id, type)
  response = @client_web.command :get_firm_classifier, firm_id: firm_id, type: type
  WebService::Types::ArrayOfIds.from_response(response)
end
get_firm_info(firm_id) click to toggle source

Получить информацию об организации @param firm_id [Integer] ID организации @return [WebService::Types::FirmInfo]

# File lib/b2b_center_api/remote_market.rb, line 61
def get_firm_info(firm_id)
  response = @client_web.command :get_firm_info, firm_id: firm_id
  WebService::Types::FirmInfo.from_response(response, @client, firm_id)
end
get_services() click to toggle source

Получить список услуг @param @return [String

# File lib/b2b_center_api/remote_market.rb, line 77
def get_services
  response = @client_web.command :get_services, {}
  WebService::Types::ArrayOfServices.from_response(response)
end
update_address(address_data) click to toggle source

Создание/изменение адреса @param address_id [Integer] ID адреса. Чтобы создать новый адрес поле id должно быть = 0, либо отсутствовать

firm_id [Integer] ID организации

@return [Integer]

# File lib/b2b_center_api/remote_market.rb, line 87
def update_address(address_data)
  response = @client_web.command :update_address, data: address_data.to_h
  WebService::Types::Id.from_response(response)
end