Sha256: 89c6727f4cac7bd2d744d343a99a0dd59b6e503a9a82f333b4d0bc24522fe336

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 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', CounterpartyProperty: '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

1 entries across 1 versions & 1 rubygems

Version Path
novaposhta_api-0.2.0 lib/novaposhta_api/resources/counterparty_resource.rb