Class: NovaposhtaApi::Resources::CounterpartyResource

Inherits:
NovaposhtaApi::Resource show all
Defined in:
lib/novaposhta_api/resources/counterparty_resource.rb

Instance Attribute Summary

Attributes inherited from NovaposhtaApi::Resource

#http

Instance Method Summary collapse

Methods inherited from NovaposhtaApi::Resource

#initialize, #request

Constructor Details

This class inherits a constructor from NovaposhtaApi::Resource

Instance Method Details

#addresses(ref) ⇒ Object



18
19
20
21
22
# File 'lib/novaposhta_api/resources/counterparty_resource.rb', line 18

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

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

#contacts(ref) ⇒ Object



24
25
26
27
28
# File 'lib/novaposhta_api/resources/counterparty_resource.rb', line 24

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

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

#create(params = {}) ⇒ Object



6
7
8
9
10
# File 'lib/novaposhta_api/resources/counterparty_resource.rb', line 6

def create(params = {})
  response = request('Counterparty/save', params)

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

#sendersObject



12
13
14
15
16
# File 'lib/novaposhta_api/resources/counterparty_resource.rb', line 12

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

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