ruconomic 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 271118522e73b3ba82a8ba62c7cd65459e491802
4
- data.tar.gz: 4c725caea918b671b1a3ea7d085d815f026a58aa
3
+ metadata.gz: 7776054f005bb98b19444eaff7b8b0c8a8874477
4
+ data.tar.gz: 0d9de84e8ba54a88aff2deca04a934604558b494
5
5
  SHA512:
6
- metadata.gz: 73e4ca801e6c5d4c2bd802b1a49e00188fcf00c730bcca9f4c187aaa3bf24112ecfc7ba3af67de5ebfad17dff66f71e2f6f5c52e3a4b8ad2f3c5d729bb94092c
7
- data.tar.gz: e6cf323279ed3f659096933a7b7fb406780b79c75f82139371ea3942b4e9b8981248c9b5555d68daf69e78eb87c0136a82d6822c1087666959f1df00b53ad463
6
+ metadata.gz: 7c9948789c91888522388a521821a4f87d6a1ecb68d8aa33bd2d4459f18db393275aee06429cd28a6f845ae1d85561a158bc622bd49ef8bde0f6cec325dbd9e0
7
+ data.tar.gz: 91e028c86371b168c48d4ed4adbf462b938213083c6993ca5cee7ba09ab7870af88a1a7053dfa269ef61df7c93fe33388cd852903f004f9d0aff98160f14b59b
@@ -127,13 +127,17 @@ module Ruconomic
127
127
 
128
128
  # Get the next available voucher number for the cashbook.
129
129
  #
130
- # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
131
130
  # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=CashBook_GetNextVoucherNumber
132
- # @return [Hash] The body content of the SOAP response.
133
- def self.get_next_voucher_number
131
+ # @return [int] The body content of the SOAP response.
132
+ def self.get_next_voucher_number(handle)
134
133
  response = invoke('CashBook_GetNextVoucherNumber') do |message|
135
- raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
134
+ message.add_handle('cashBookHandle', handle)
136
135
  end
136
+
137
+ response.to_hash.dig(
138
+ :cash_book_get_next_voucher_number_response,
139
+ :cash_book_get_next_voucher_number_result
140
+ )
137
141
  end
138
142
 
139
143
  # Gets the entries in the cashbook.
@@ -235,7 +235,7 @@ module Ruconomic
235
235
  # Parameters: data: The data object that specifies the properties of the new cash book entry.
236
236
  #
237
237
  # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=CashBookEntry_CreateFromData
238
- # @return [Hash] The body content of the SOAP response.
238
+ # @return [Array] with cashbook entry ids.
239
239
  def self.create_from_data(entry_data)
240
240
  response = invoke('CashBookEntry_CreateFromData') do |message|
241
241
  message.add 'data' do |data|
@@ -282,7 +282,7 @@ module Ruconomic
282
282
  response.to_hash.dig(
283
283
  :cash_book_entry_create_from_data_response,
284
284
  :cash_book_entry_create_from_data_result
285
- )
285
+ ).values
286
286
  end
287
287
 
288
288
  # Creates new cash book entries from data objects.
@@ -489,48 +489,38 @@ module Ruconomic
489
489
  def self.create_from_data(invoice_data)
490
490
  response = invoke('CurrentInvoice_CreateFromData') do |message|
491
491
  message.add 'data' do |data|
492
- data.add 'Id', invoice_data.fetch(:id, nil)
493
- data.add 'DebtorHandle' do |debtor_handle|
494
- debtor_handle.add 'Number', invoice_data.fetch(:debtor_handle, {}).fetch(:number, nil)
495
- end
496
- data.add 'DebtorName', invoice_data.fetch(:debtor_name, nil)
497
- data.add 'DebtorAddress', invoice_data.fetch(:debtor_address, nil)
498
- data.add 'DebtorPostalCode', invoice_data.fetch(:debtor_postal_code, nil)
499
- data.add 'DebtorCity', invoice_data.fetch(:debtor_city, nil)
500
- data.add 'DebtorCountry', invoice_data.fetch(:debtor_country, nil)
501
- if attention_id = invoice_data.fetch(:attention_handle, {}).fetch(:id, nil)
502
- data.add 'AttentionHandle' do |attention_handle|
503
- attention_handle.add 'Id', attention_id
504
- end
505
- end
506
- data.add 'Date', invoice_data.fetch(:date, nil)
507
- data.add 'TermOfPaymentHandle' do |term_handle|
508
- term_handle.add 'Id', invoice_data.fetch(:term_of_payment_handle, {}).fetch(:id, nil)
509
- end
510
- data.add 'DueDate', invoice_data.fetch(:due_date, nil)
511
- data.add "CurrencyHandle" do |currency_handle|
512
- currency_handle.add 'Code', invoice_data.fetch(:currency_handle, {}).fetch(:code, nil)
513
- end
514
- data.add 'ExchangeRate', invoice_data.fetch(:exchange_rate, nil)
515
- data.add 'IsVatIncluded', invoice_data.fetch(:is_vat_included, nil)
516
- data.add 'LayoutHandle' do |layout_handle|
517
- layout_handle.add 'Id', invoice_data.fetch(:layout_handle, {}).fetch(:id, nil)
518
- end
519
- data.add 'DeliveryDate', invoice_data.fetch(:delivery_date, nil)
520
- data.add 'Heading', invoice_data.fetch(:heading, nil)
521
- data.add 'TextLine1', invoice_data.fetch(:text_line1, nil)
522
- data.add 'TextLine2', invoice_data.fetch(:text_line2, nil)
523
- data.add 'NetAmount', invoice_data.fetch(:net_amount, nil)
524
- data.add 'VatAmount', invoice_data.fetch(:vat_amount, nil)
525
- data.add 'GrossAmount', invoice_data.fetch(:gross_amount, nil)
526
- data.add 'Margin', invoice_data.fetch(:margin, nil)
527
- data.add 'MarginAsPercent', invoice_data.fetch(:margin_as_percent, nil)
492
+ data.add('Id', invoice_data.dig(:id))
493
+ data.add_handle('DebtorHandle', invoice_data.dig(:debtor_handle, :number))
494
+ data.add('DebtorName', invoice_data.dig(:debtor_name))
495
+ data.add_optional('DebtorAddress', invoice_data.dig(:debtor_address))
496
+ data.add_optional('DebtorPostalCode', invoice_data.dig(:debtor_postal_code))
497
+ data.add_optional('DebtorCity', invoice_data.dig(:debtor_city))
498
+ data.add_optional('DebtorCountry', invoice_data.dig(:debtor_country))
499
+ data.add_handle('AttentionHandle', invoice_data.dig(:attention_handle, :id), 'Id')
500
+ data.add('Date', invoice_data.dig(:date))
501
+ data.add_handle('TermOfPaymentHandle', invoice_data.dig(:term_of_payment_handle, :id), 'Id')
502
+ data.add('DueDate', invoice_data.dig(:due_date))
503
+ data.add_handle('CurrencyHandle', invoice_data.dig(:currency_handle, :code), 'Code')
504
+ data.add_optional('ExchangeRate', invoice_data.dig(:exchange_rate))
505
+ data.add('IsVatIncluded', invoice_data.dig(:is_vat_included))
506
+ data.add_handle('LayoutHandle', invoice_data.dig(:layout_handle, :id), 'Id')
507
+ data.add('DeliveryDate', invoice_data.dig(:delivery_date))
508
+ data.add_optional('Heading', invoice_data.dig(:heading))
509
+ data.add_optional('TextLine1', invoice_data.dig(:text_line1))
510
+ data.add_optional('TextLine2', invoice_data.dig(:text_line2))
511
+ data.add('NetAmount', invoice_data.dig(:net_amount))
512
+ data.add('VatAmount', invoice_data.dig(:vat_amount))
513
+ data.add('GrossAmount', invoice_data.dig(:gross_amount))
514
+ data.add('Margin', invoice_data.dig(:margin))
515
+ data.add('MarginAsPercent', invoice_data.dig(:margin_as_percent))
528
516
  end
529
517
  end
530
518
 
531
- response.to_hash[:current_invoice_create_from_data_response] \
532
- [:current_invoice_create_from_data_result] \
533
- [:id]
519
+ response.to_hash.dig(
520
+ :current_invoice_create_from_data_response,
521
+ :current_invoice_create_from_data_result,
522
+ :id
523
+ )
534
524
  end
535
525
 
536
526
  # Creates new current invoices from data objects.
@@ -9,29 +9,26 @@ module Ruconomic
9
9
  def self.create_from_data(line_data)
10
10
  response = invoke('CurrentInvoiceLine_CreateFromData') do |message|
11
11
  message.add 'data' do |data|
12
- data.add 'Number', line_data.fetch(:number, nil)
13
- data.add 'InvoiceHandle' do |invoice_handle|
14
- invoice_handle.add 'Id', line_data.fetch(:invoice_handle, {}).fetch(:id, nil)
15
- end
16
- data.add 'Description', line_data.fetch(:description, nil)
17
- data.add 'DeliveryDate', line_data.fetch(:delivery_date, nil)
18
- data.add 'UnitHandle' do |unit_handle|
19
- unit_handle.add 'Number', line_data.fetch(:unit_handle, {}).fetch(:number, nil)
20
- end
21
- data.add 'ProductHandle' do |product_handle|
22
- product_handle.add 'Number', line_data.fetch(:product_handle, {}).fetch(:number, nil)
23
- end
24
- data.add 'Quantity', line_data.fetch(:quantity, nil)
25
- data.add 'UnitNetPrice', line_data.fetch(:unit_net_price, nil)
26
- data.add 'DiscountAsPercent', line_data.fetch(:discount_as_percent, nil)
27
- data.add 'UnitCostPrice', line_data.fetch(:unit_cost_price, nil)
28
- data.add 'TotalNetAmount', line_data.fetch(:total_net_amount, nil)
29
- data.add 'TotalMargin', line_data.fetch(:total_margin, nil)
30
- data.add 'MarginAsPercent', line_data.fetch(:margin_as_percent, nil)
12
+ data.add 'Number', line_data.dig(:number)
13
+ data.add_handle('InvoiceHandle', line_data.dig(:invoice_handle, :id), 'Id')
14
+ data.add_optional('Description', line_data.dig(:description))
15
+ data.add 'DeliveryDate', line_data.dig(:delivery_date)
16
+ data.add_handle('UnitHandle', line_data.dig(:unit_handle, :number))
17
+ data.add_handle('ProductHandle', line_data.dig(:product_handle, :number))
18
+ data.add('Quantity', line_data.dig(:quantity))
19
+ data.add('UnitNetPrice', line_data.dig(:unit_net_price))
20
+ data.add('DiscountAsPercent', line_data.dig(:discount_as_percent))
21
+ data.add_optional('UnitCostPrice', line_data.dig(:unit_cost_price))
22
+ data.add('TotalNetAmount', line_data.dig(:total_net_amount))
23
+ data.add('TotalMargin', line_data.dig(:total_margin))
24
+ data.add('MarginAsPercent', line_data.dig(:margin_as_percent))
31
25
  end
32
26
  end
33
27
 
34
- response.to_hash[:current_invoice_line_create_from_data_response][:current_invoice_line_create_from_data_result]
28
+ response.to_hash.dig(
29
+ :current_invoice_line_create_from_data_response,
30
+ :current_invoice_line_create_from_data_result
31
+ )
35
32
  end
36
33
 
37
34
  # Creates new current invoice lines from data objects.
@@ -206,74 +206,42 @@ module Ruconomic
206
206
  def self.create_from_data(debtor_data)
207
207
  response = invoke('Debtor_CreateFromData') do |message|
208
208
  message.add 'data' do |data|
209
- data.add 'Handle' do |handle|
210
- handle.add 'Number', debtor_data.fetch(:handle, {}).fetch(:number, nil)
211
- end
212
- data.add 'Number', debtor_data.fetch(:number, nil)
213
- data.add 'DebtorGroupHandle' do |handle|
214
- handle.add 'Number', debtor_data.fetch(:debtor_group_handle, {}).fetch(:number, nil)
215
- end
216
- data.add 'Name', debtor_data.fetch(:name, nil)
217
- data.add 'VatZone', debtor_data.fetch(:vat_zone, nil)
218
- data.add 'ExtendedVatZone' do |handle|
219
- handle.add 'Number', debtor_data.fetch(:extended_vat_zone, {}).fetch(:number, nil)
220
- end
221
- data.add 'CurrencyHandle' do |handle|
222
- handle.add 'Code', debtor_data.fetch(:currency_handle, {}).fetch(:code, nil)
223
- end
224
- if price_group_handle = debtor_data.fetch(:price_group_handle, {}).fetch(:number, nil)
225
- data.add 'PriceGroupHandle' do |handle|
226
- handle.add 'Number', price_group_handle
227
- end
228
- end
229
- data.add 'IsAccessible', debtor_data.fetch(:is_accessible, nil)
230
- data.add 'Ean', debtor_data.fetch(:ean, nil)
231
- data.add 'PublicEntryNumber', debtor_data.fetch(:public_entry_number, nil)
232
- data.add 'Email', debtor_data.fetch(:email, nil)
233
- data.add 'TelephoneAndFaxNumber', debtor_data.fetch(:telephone_and_fax_number, nil)
234
- data.add 'Website', debtor_data.fetch(:website, nil)
235
- data.add 'Address', debtor_data.fetch(:address, nil)
236
- data.add 'PostalCode', debtor_data.fetch(:postal_code, nil)
237
- data.add 'City', debtor_data.fetch(:city, nil)
238
- data.add 'Country', debtor_data.fetch(:country, nil)
239
- if credit_maximum = debtor_data.fetch(:credit_maximum, nil)
240
- data.add 'CreditMaximum', credit_maximum
241
- end
242
- data.add 'VatNumber', debtor_data.fetch(:vat_number, nil)
243
- data.add 'CINumber', debtor_data.fetch(:ci_number, nil)
244
- data.add 'TermOfPaymentHandle' do |handle|
245
- handle.add 'Id', debtor_data.fetch(:term_of_payment_handle, {}).fetch(:id, nil)
246
- end
247
- if layout_id = debtor_data.fetch(:layout_handle, {}).fetch(:id, nil)
248
- data.add 'LayoutHandle' do |handle|
249
- handle.add 'Id', layout_id
250
- end
251
- end
252
- if attention_id = debtor_data.fetch(:attention_handle, {}).fetch(:id, nil)
253
- data.add 'AttentionHandle' do |handle|
254
- handle.add 'Id', attention_id
255
- end
256
- end
257
- if your_reference_id = debtor_data.fetch(:your_reference_handle, {}).fetch(:id, nil)
258
- data.add 'YourReferenceHandle' do |handle|
259
- handle.add 'Id', your_reference_id
260
- end
261
- end
262
- if our_reference_handle = debtor_data.fetch(:our_reference_handle, {}).fetch(:number, nil)
263
- data.add 'OurReferenceHandle' do |handle|
264
- handle.add 'Number', our_reference_handle
265
- end
266
- end
267
- data.add 'Balance', debtor_data.fetch(:balance, nil)
268
- if delivery_id = debtor_data.fetch(:default_delivery_location_handle, {}).fetch(:id, nil)
269
- data.add 'DefaultDeliveryLocationHandle' do |handle|
270
- handle.add 'Id', delivery_id
271
- end
272
- end
209
+ data.add_handle('Handle', debtor_data.dig(:handle, :number))
210
+ data.add('Number', debtor_data.dig(:number))
211
+ data.add_handle('DebtorGroupHandle', debtor_data.dig(:debtor_group_handle, :number))
212
+ data.add('Name', debtor_data.dig(:name))
213
+ data.add('VatZone', debtor_data.dig(:vat_zone))
214
+ data.add_handle('ExtendedVatZone', debtor_data.dig(:extended_vat_zone, :number))
215
+ data.add_handle('CurrencyHandle', debtor_data.dig(:currency_handle, :code), 'Code')
216
+ data.add_handle('PriceGroupHandle', debtor_data.dig(:price_group_handle, :number))
217
+ data.add('IsAccessible', debtor_data.dig(:is_accessible))
218
+ data.add_optional('Ean', debtor_data.dig(:ean))
219
+ data.add_optional('PublicEntryNumber', debtor_data.dig(:public_entry_number))
220
+ data.add_optional('Email', debtor_data.dig(:email))
221
+ data.add_optional('TelephoneAndFaxNumber', debtor_data.dig(:telephone_and_fax_number))
222
+ data.add_optional('Website', debtor_data.dig(:website))
223
+ data.add_optional('Address', debtor_data.dig(:address))
224
+ data.add_optional('PostalCode', debtor_data.dig(:postal_code))
225
+ data.add_optional('City', debtor_data.dig(:city))
226
+ data.add_optional('Country', debtor_data.dig(:country))
227
+ data.add_optional('CreditMaximum', debtor_data.dig(:credit_maximum))
228
+ data.add_optional('VatNumber', debtor_data.dig(:vat_number))
229
+ data.add_optional('CINumber', debtor_data.dig(:ci_number))
230
+ data.add_handle('TermOfPaymentHandle', debtor_data.dig(:term_of_payment_handle, :id), 'Id')
231
+ data.add_handle('LayoutHandle', debtor_data.dig(:layout_handle, :id), 'Id')
232
+ data.add_handle('AttentionHandle', debtor_data.dig(:attention_handle, :id), 'Id')
233
+ data.add_handle('YourReferenceHandle', debtor_data.dig(:your_reference_handle, :id), 'Id')
234
+ data.add_handle('OurReferenceHandle', debtor_data.dig(:our_reference_handle, :number))
235
+ data.add_optional('Balance', debtor_data.dig(:balance))
236
+ data.add_handle('DefaultDeliveryLocationHandle', debtor_data.dig(:default_delivery_location_handle, :id), 'Id')
273
237
  end
274
238
  end
275
239
 
276
- response.to_hash[:debtor_create_from_data_response][:debtor_create_from_data_result][:number]
240
+ response.to_hash.dig(
241
+ :debtor_create_from_data_response,
242
+ :debtor_create_from_data_result,
243
+ :number
244
+ )
277
245
  end
278
246
 
279
247
  # Creates new debtors from data objects.
@@ -303,13 +271,44 @@ module Ruconomic
303
271
  # Updates a debtor from a data object.
304
272
  # Parameters: data: The data object.
305
273
  #
306
- # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
307
274
  # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=Debtor_UpdateFromData
308
275
  # @return [Hash] The body content of the SOAP response.
309
- def self.update_from_data
276
+ def self.update_from_data(debtor_data)
310
277
  response = invoke('Debtor_UpdateFromData') do |message|
311
- raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
278
+ message.add 'data' do |data|
279
+ data.add_handle('Handle', debtor_data.dig(:handle, :number))
280
+ data.add('Number', debtor_data.dig(:number))
281
+ data.add_handle('DebtorGroupHandle', debtor_data.dig(:debtor_group_handle, :number))
282
+ data.add('Name', debtor_data.dig(:name))
283
+ data.add('VatZone', debtor_data.dig(:vat_zone))
284
+ data.add_handle('ExtendedVatZone', debtor_data.dig(:extended_vat_zone, :number))
285
+ data.add_handle('CurrencyHandle', debtor_data.dig(:currency_handle, :code), 'Code')
286
+ data.add_handle('PriceGroupHandle', debtor_data.dig(:price_group_handle, :number))
287
+ data.add('IsAccessible', debtor_data.dig(:is_accessible))
288
+ data.add_optional('Ean', debtor_data.dig(:ean))
289
+ data.add_optional('PublicEntryNumber', debtor_data.dig(:public_entry_number))
290
+ data.add_optional('Email', debtor_data.dig(:email))
291
+ data.add_optional('TelephoneAndFaxNumber', debtor_data.dig(:telephone_and_fax_number))
292
+ data.add_optional('Website', debtor_data.dig(:website))
293
+ data.add_optional('Address', debtor_data.dig(:address))
294
+ data.add_optional('PostalCode', debtor_data.dig(:postal_code))
295
+ data.add_optional('City', debtor_data.dig(:city))
296
+ data.add_optional('Country', debtor_data.dig(:country))
297
+ data.add_optional('CreditMaximum', debtor_data.dig(:credit_maximum))
298
+ data.add_optional('VatNumber', debtor_data.dig(:vat_number))
299
+ data.add_optional('CINumber', debtor_data.dig(:ci_number))
300
+ data.add_handle('TermOfPaymentHandle', debtor_data.dig(:term_of_payment_handle, :id), 'Id')
301
+ data.add_handle('LayoutHandle', debtor_data.dig(:layout_handle, :id), 'Id')
302
+ data.add_handle('AttentionHandle', debtor_data.dig(:attention_handle, :id), 'Id')
303
+ data.add_handle('YourReferenceHandle', debtor_data.dig(:your_reference_handle, :id), 'Id')
304
+ data.add_handle('OurReferenceHandle', debtor_data.dig(:our_reference_handle, :number))
305
+ data.add_optional('Balance', debtor_data.dig(:balance))
306
+ data.add_handle('DefaultDeliveryLocationHandle', debtor_data.dig(:default_delivery_location_handle, :id), 'Id')
307
+ end
312
308
  end
309
+
310
+ response.to_hash[:debtor_update_from_data_response] \
311
+ [:debtor_update_from_data_result][:number]
313
312
  end
314
313
 
315
314
  # Returns a debtor data object for a given debtor.
@@ -1,3 +1,3 @@
1
1
  module Ruconomic
2
- VERSION = "0.9.8"
2
+ VERSION = "0.9.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruconomic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tonni Tølbøll Lund Aagesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-23 00:00:00.000000000 Z
11
+ date: 2017-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb