economic-rest 0.6.5 → 0.6.6

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
  SHA256:
3
- metadata.gz: 9c576d856da2e846510883b57c779b0a666278289aa5368d2039a9328193e73f
4
- data.tar.gz: 2b0ad0048edeb01aa0617ab4c9c5b4fec8487e7a224e77154f76999169a567df
3
+ metadata.gz: a6a6df895546767151e1fff4a371b0dbf7998e5220e85d367a0253020d06e61a
4
+ data.tar.gz: 1f658c8cfdf3ef33d1de259b71d5149baa65d1407b6d37d2e9badbc7fb56a461
5
5
  SHA512:
6
- metadata.gz: 1783aa8396935d355261c12b352f7a25c6b97db7788b3289b004a9ce10f28bce05f9e3b26385055451e502c6362ec50dc0090fdcc875db8b8e64f68bb612d71a
7
- data.tar.gz: 54e4119a1259db0fbc59cf9e9f05bc72b2642ecea03c94881f86cbbd7813e5e8101f5cab4bdf2b358f0cd047b821f073a339c465116ccb5db37ce648ec460fd8
6
+ metadata.gz: 61d1e1021d8a85ca366afadaab6ed2137ca3548a4f063e6a3f2ce35010b1717bb8f354f7945ddf4d266f7b99f43f04fbff228d6aa6207c647c5f01e3ad9485cc
7
+ data.tar.gz: 296dd4b76637c61deab509163af05458d937ea616bc4a655a85ed7df14871044189ffbe3bdf05d91a78edcc45dd976d8824f7834bfe67330b4a71b8159bfadf5
@@ -30,7 +30,7 @@ module Economic
30
30
  relation :customer_group
31
31
  # field :default_delivery_location
32
32
  # field :invoices
33
- # relation :layout
33
+ relation :layout
34
34
  relation :payment_terms
35
35
  # field :sales_person
36
36
  # field :templates
@@ -0,0 +1,12 @@
1
+ module Economic
2
+ module Models
3
+ class Delivery < Economic::Model
4
+ field :address
5
+ field :city
6
+ field :country
7
+ field :delivery_date
8
+ field :delivery_terms
9
+ field :zip
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ module Economic
2
+ module Models
3
+ class DepartmentalDistribution < Economic::Model
4
+ field :id, as: :departmentalDistributionNumber
5
+ field :name
6
+ field :distribution_type
7
+
8
+ relation :customer
9
+ relation :distributions, multiple: true
10
+ # relation :sub_collections
11
+ end
12
+ end
13
+ end
@@ -23,9 +23,9 @@ module Economic
23
23
  relation :notes
24
24
  relation :references
25
25
  relation :layout
26
- # relation :delivery
26
+ relation :delivery
27
27
  # relation :delivery_location
28
- # relation :pdf
28
+ relation :pdf
29
29
  # relation :project
30
30
  end
31
31
  end
@@ -5,6 +5,7 @@ module Economic
5
5
  field :id, as: :bookedInvoiceNumber
6
6
 
7
7
  relation :draft_invoice, klass: "Economic::Models::Invoices::Draft"
8
+ relation :pdf
8
9
  end
9
10
  end
10
11
  end
@@ -14,8 +14,8 @@ module Economic
14
14
 
15
15
  relation :product
16
16
  relation :unit
17
- # relation :delivery
18
- # relation :departmental_distribution
17
+ relation :delivery
18
+ relation :departmental_distribution
19
19
  end
20
20
  end
21
21
  end
@@ -0,0 +1,14 @@
1
+ module Economic
2
+ module Models
3
+ class Pdf < Economic::Model
4
+ field :self
5
+ field :download
6
+
7
+ def download_pdf
8
+ raise StandardError, "There is no download url set" if download.nil?
9
+
10
+ Net::HTTP.get(URI(download))
11
+ end
12
+ end
13
+ end
14
+ end
@@ -15,8 +15,8 @@ module Economic
15
15
  # relation :inventory
16
16
  # field :invoices
17
17
  # field :pricing
18
- # relation :product_group
19
- # relation :unit
18
+ relation :product_group
19
+ relation :unit
20
20
  end
21
21
  end
22
22
  end
@@ -0,0 +1,10 @@
1
+ module Economic
2
+ module Models
3
+ class ProductGroup < Economic::Model
4
+ field :name
5
+ field :id, as: :productGroupNumber
6
+ field :sales_accounts
7
+ field :products
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,30 @@
1
+ module Economic
2
+ module Models
3
+ class Supplier < Economic::Model
4
+ field :id, as: :supplierNumber
5
+ field :address
6
+ field :bank_account
7
+ field :barred
8
+ field :city
9
+ field :contacts
10
+ field :corporate_identification_number
11
+ field :country
12
+ field :currency
13
+ field :default_invoice_text
14
+ field :email
15
+ field :name
16
+ field :phone
17
+ field :zip
18
+
19
+ relation :attention
20
+ relation :cost_account
21
+ relation :layout
22
+ relation :payment_terms
23
+ relation :remittance_advice
24
+ relation :sales_person
25
+ relation :supplier_contact
26
+ relation :supplier_group
27
+ relation :vat_zone
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,10 @@
1
+ module Economic
2
+ module Models
3
+ class SupplierGroup < Economic::Model
4
+ field :id, as: :supplierGroupNumber
5
+ field :name
6
+
7
+ relation :account
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ module Economic
2
+ module Repos
3
+ class Product < Economic::Repo
4
+ def self.in_group(product_group_or_product_group_number)
5
+ id = product_group_or_product_group_number.product_group_number if product_group_or_product_group_number.respond_to? :product_group_number
6
+ id ||= product_group_or_product_group_number
7
+
8
+ end_point = [ProductGroupRepo.endpoint_url, id, "products"].join("/")
9
+ response = send_request(method: :get, url: end_point)
10
+ entry_hash = JSON.parse(response.body)
11
+ products = []
12
+
13
+ entry_hash["collection"].each do |product|
14
+ products.push Product.new(product)
15
+ end
16
+ products
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ module Economic
2
+ module Repos
3
+ class Supplier < Economic::Repo
4
+ end
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module Economic
2
2
  module Rest
3
- VERSION = "0.6.5".freeze
3
+ VERSION = "0.6.6".freeze
4
4
  end
5
5
  end
data/lib/economic/rest.rb CHANGED
@@ -34,6 +34,7 @@ require "economic/repos/invoices/booked"
34
34
  require "economic/models/invoices/booked"
35
35
  require "economic/models/line"
36
36
  require "economic/models/product"
37
+ require "economic/repos/product"
37
38
  require "economic/models/unit"
38
39
  require "economic/models/recipient"
39
40
  require "economic/models/note"
@@ -44,6 +45,13 @@ require "economic/models/sales_person"
44
45
  require "economic/models/vendor_reference"
45
46
  require "economic/models/layout"
46
47
  require "economic/models/attention"
48
+ require "economic/models/delivery"
49
+ require "economic/models/departmental_distribution"
50
+ require "economic/repos/supplier"
51
+ require "economic/models/supplier"
52
+ require "economic/models/supplier_group"
53
+ require "economic/models/pdf"
54
+ require "economic/models/product_group"
47
55
 
48
56
  require "economic/attention"
49
57
  require "economic/currency"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: economic-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Klogborg
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-01-06 00:00:00.000000000 Z
10
+ date: 2025-02-28 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -192,7 +191,6 @@ dependencies:
192
191
  - - "~>"
193
192
  - !ruby/object:Gem::Version
194
193
  version: '8.0'
195
- description:
196
194
  email:
197
195
  - klogborg@traels.it
198
196
  executables: []
@@ -260,6 +258,8 @@ files:
260
258
  - lib/economic/models/customer.rb
261
259
  - lib/economic/models/customer_group.rb
262
260
  - lib/economic/models/customers/contact.rb
261
+ - lib/economic/models/delivery.rb
262
+ - lib/economic/models/departmental_distribution.rb
263
263
  - lib/economic/models/invoice.rb
264
264
  - lib/economic/models/invoices/booked.rb
265
265
  - lib/economic/models/invoices/draft.rb
@@ -267,10 +267,14 @@ files:
267
267
  - lib/economic/models/line.rb
268
268
  - lib/economic/models/note.rb
269
269
  - lib/economic/models/payment_term.rb
270
+ - lib/economic/models/pdf.rb
270
271
  - lib/economic/models/product.rb
272
+ - lib/economic/models/product_group.rb
271
273
  - lib/economic/models/recipient.rb
272
274
  - lib/economic/models/reference.rb
273
275
  - lib/economic/models/sales_person.rb
276
+ - lib/economic/models/supplier.rb
277
+ - lib/economic/models/supplier_group.rb
274
278
  - lib/economic/models/unit.rb
275
279
  - lib/economic/models/vat_zone.rb
276
280
  - lib/economic/models/vendor_reference.rb
@@ -304,6 +308,8 @@ files:
304
308
  - lib/economic/repos/invoices/booked.rb
305
309
  - lib/economic/repos/invoices/draft.rb
306
310
  - lib/economic/repos/invoices/drafts/line.rb
311
+ - lib/economic/repos/product.rb
312
+ - lib/economic/repos/supplier.rb
307
313
  - lib/economic/response.rb
308
314
  - lib/economic/response/pagination.rb
309
315
  - lib/economic/rest.rb
@@ -332,7 +338,6 @@ homepage: https://github.com/traels-it/economic-rest
332
338
  licenses:
333
339
  - MIT
334
340
  metadata: {}
335
- post_install_message:
336
341
  rdoc_options: []
337
342
  require_paths:
338
343
  - lib
@@ -347,8 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
347
352
  - !ruby/object:Gem::Version
348
353
  version: '0'
349
354
  requirements: []
350
- rubygems_version: 3.5.19
351
- signing_key:
355
+ rubygems_version: 3.6.3
352
356
  specification_version: 4
353
357
  summary: Ruby wrapper for the e-conomic REST API, that aims at making working with
354
358
  the API bearable. E-conomic is a web-based accounting system. For their marketing