Sha256: dd90403409a9dcf6a571dc57d521842eea70617fded84ea0a1a0245bf04acfa9

Contents?: true

Size: 858 Bytes

Versions: 7

Compression:

Stored size: 858 Bytes

Contents

# frozen_string_literal: true

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

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

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

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

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

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
novaposhta_api-0.1.7 lib/novaposhta_api/resources/counterparty_resource.rb
novaposhta_api-0.1.5 lib/novaposhta_api/resources/counterparty_resource.rb
novaposhta_api-0.1.4 lib/novaposhta_api/resources/counterparty_resource.rb
novaposhta_api-0.1.3 lib/novaposhta_api/resources/counterparty_resource.rb
novaposhta_api-0.1.2 lib/novaposhta_api/resources/counterparty_resource.rb
novaposhta_api-0.1.1 lib/novaposhta_api/resources/counterparty_resource.rb
novaposhta_api-0.1.0 lib/novaposhta_api/resources/counterparty_resource.rb