economic-rest 0.5.10 → 0.5.11

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: ec06c8760ea6c2c97777086789faf1cc3a9c4c16f8c66a968c8cd4ecf996bd95
4
- data.tar.gz: c04eb4ba040c5e701dd0e239b11ece5d24591539cfa77e7207bf9d7d4093193a
3
+ metadata.gz: 94ce50466b8ce15b85bfa5a69ab8465b25e685c140cc78b3951c777991d78594
4
+ data.tar.gz: e4aa8ff955d6bb86707052efa9ae14b06f05accceab27c0231e2f75bc953d54b
5
5
  SHA512:
6
- metadata.gz: feb3b14f3646417e9cb8cdfdf529294d2fddfb612f46522f1c139a7576435d2e0866464bd291957652bbba6535124437f7316475c446617d69fb5ac1f26766b4
7
- data.tar.gz: 86cb60fc957737e4acf489240548d6b24634ab71e3d8fd3d2464a02ab939b62c5a907ea232a04a6e9e893ae495ac53cf58952ce6c10fbad4af79f027c66a57ad
6
+ metadata.gz: 5273873172be9299b84eb8cd9cf32840a33cd8bc8b125348eda67242bc232ef33a14cd2f96a218b083ea717670737b202359c7feb5306127a7f8c0dbeab5c2ed
7
+ data.tar.gz: 47eadb6a8c2b3f7fea6ac65a3231c7db46e93c320d98dc4c118c39889c7ebfb268736420289ff82b4adb1593cdb61037aec8ec08e554af4b61e662849cf6cc5e
@@ -75,7 +75,7 @@ module Economic
75
75
  relation_fields = relation_hash[:fields]
76
76
  begin
77
77
  arr = public_send(relation_name).map { |relation| relation.to_h(only_fields: relation_fields) }
78
- return_hash[relation_name] = arr
78
+ return_hash[relation_name] = arr unless arr.empty?
79
79
  rescue NoMethodError
80
80
  end
81
81
  else
@@ -0,0 +1,6 @@
1
+ module Economic
2
+ class Department < Base
3
+ field :name
4
+ field :departmentNumber, id: true
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ module Economic
2
+ class DepartmentRepo < Economic::BaseRepo
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ module Economic
2
+ class DepartmentalDistribution < Base
3
+ field :name
4
+ field :departmentalDistributionNumber, id: true
5
+ field :distributionType
6
+
7
+ relation :customer, fields: []
8
+ relation :distributions, fields: [], multiple: true
9
+ # relation :subCollections, fields: [?]
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ module Economic
2
+ class DepartmentalDistributionRepo < Economic::BaseRepo
3
+ class << self
4
+ def all(distribution: nil)
5
+ return super(url: endpoint_url(distribution)) unless distribution.nil?
6
+
7
+ super(url: endpoint_url(distribution))
8
+ end
9
+
10
+ def find(id, distribution:)
11
+ super(id, url: endpoint_url(distribution))
12
+ end
13
+
14
+ private
15
+
16
+ def endpoint_url(distribution)
17
+ return super() if distribution.nil?
18
+ return super() + "/departments" if distribution == :single_department
19
+
20
+ super() + "/distributions"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ module Economic
2
+ class Distribution < Base
3
+ field :percentage
4
+
5
+ relation :department, fields: [:departmentNumber]
6
+ end
7
+ end
@@ -11,9 +11,10 @@ module Economic
11
11
  field :marginPercentage
12
12
  field :totalNetAmount
13
13
 
14
- relation :product, fields: [:productNumber]
15
- relation :unit, fields: [:unitNumber, :name]
16
- relation :delivery, fields: [:address, :zip, :city, :country, :deliveryDate]
14
+ relation :product, fields: []
15
+ relation :unit, fields: []
16
+ relation :delivery, fields: []
17
+ relation :departmentalDistribution, fields: []
17
18
 
18
19
  def self.build_from_soap_api(data)
19
20
  # This is not instantiated with the hash, as lines are never pulled out by themselves, but always as part of
@@ -90,6 +90,12 @@ require "economic/remittance_advice"
90
90
  require "economic/payment_type"
91
91
  require "economic/payment_type_repo"
92
92
 
93
+ require "economic/department"
94
+ require "economic/department_repo"
95
+ require "economic/departmental_distribution"
96
+ require "economic/distribution"
97
+ require "economic/departmental_distribution_repo"
98
+
93
99
  require "economic/account"
94
100
 
95
101
  module Economic
@@ -1,5 +1,5 @@
1
1
  module Economic
2
2
  module Rest
3
- VERSION = "0.5.10".freeze
3
+ VERSION = "0.5.11".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: economic-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Klogborg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-03 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -241,6 +241,11 @@ files:
241
241
  - lib/economic/customer_group_repo.rb
242
242
  - lib/economic/customer_repo.rb
243
243
  - lib/economic/delivery.rb
244
+ - lib/economic/department.rb
245
+ - lib/economic/department_repo.rb
246
+ - lib/economic/departmental_distribution.rb
247
+ - lib/economic/departmental_distribution_repo.rb
248
+ - lib/economic/distribution.rb
244
249
  - lib/economic/inventory.rb
245
250
  - lib/economic/invoice.rb
246
251
  - lib/economic/invoices/booked_repo.rb
@@ -319,7 +324,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
324
  - !ruby/object:Gem::Version
320
325
  version: '0'
321
326
  requirements: []
322
- rubygems_version: 3.0.3
327
+ rubyforge_project:
328
+ rubygems_version: 2.7.6
323
329
  signing_key:
324
330
  specification_version: 4
325
331
  summary: Ruby wrapper for the e-conomic REST API, that aims at making working with