Sha256: 7bcdff681c1a656413f46f60fdd8fb3aec0e5fdd881081e1fb8fccf0dfa5ec30

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

module NovaposhtaApi
  module Resources
    class CounterpartyResource < Resource
      def create(params = {})
        response = request('Counterparty/save', params)

        NovaposhtaApi::Models::Counterparty.extract_single(response)
      end

      def senders
        response = request('Counterparty/getCounterparties', counterparty_property: 'Sender')

        NovaposhtaApi::Models::Counterparty.extract_collection(response)
      end

      def addresses(ref)
        response = request('Counterparty/getCounterpartyAddresses', ref: ref)

        NovaposhtaApi::Models::Address.extract_collection(response)
      end

      def contacts(ref)
        response = request('Counterparty/getCounterpartyContactPersons', ref: ref)

        NovaposhtaApi::Models::ContactPerson.extract_collection(response)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
novaposhta_api-0.1.9 lib/novaposhta_api/resources/counterparty_resource.rb
novaposhta_api-0.1.8 lib/novaposhta_api/resources/counterparty_resource.rb