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 +4 -4
- data/lib/economic/base.rb +1 -1
- data/lib/economic/department.rb +6 -0
- data/lib/economic/department_repo.rb +4 -0
- data/lib/economic/departmental_distribution.rb +11 -0
- data/lib/economic/departmental_distribution_repo.rb +24 -0
- data/lib/economic/distribution.rb +7 -0
- data/lib/economic/line.rb +4 -3
- data/lib/economic/rest.rb +6 -0
- data/lib/economic/rest/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94ce50466b8ce15b85bfa5a69ab8465b25e685c140cc78b3951c777991d78594
|
4
|
+
data.tar.gz: e4aa8ff955d6bb86707052efa9ae14b06f05accceab27c0231e2f75bc953d54b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5273873172be9299b84eb8cd9cf32840a33cd8bc8b125348eda67242bc232ef33a14cd2f96a218b083ea717670737b202359c7feb5306127a7f8c0dbeab5c2ed
|
7
|
+
data.tar.gz: 47eadb6a8c2b3f7fea6ac65a3231c7db46e93c320d98dc4c118c39889c7ebfb268736420289ff82b4adb1593cdb61037aec8ec08e554af4b61e662849cf6cc5e
|
data/lib/economic/base.rb
CHANGED
@@ -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,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
|
data/lib/economic/line.rb
CHANGED
@@ -11,9 +11,10 @@ module Economic
|
|
11
11
|
field :marginPercentage
|
12
12
|
field :totalNetAmount
|
13
13
|
|
14
|
-
relation :product, fields: [
|
15
|
-
relation :unit, fields: [
|
16
|
-
relation :delivery, fields: [
|
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
|
data/lib/economic/rest.rb
CHANGED
@@ -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
|
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.
|
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-
|
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
|
-
|
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
|