economic-rest 0.3.1 → 0.3.2
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/Gemfile.lock +2 -2
- data/README.md +25 -0
- data/lib/economic/base_repo.rb +3 -3
- data/lib/economic/journal_voucher_repo.rb +1 -1
- data/lib/economic/pricing_repo.rb +1 -1
- data/lib/economic/product_repo.rb +1 -1
- data/lib/economic/rest/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 221401eab37a814a3b063d039a988f892cee72381f68da871695af2837cb05b7
|
|
4
|
+
data.tar.gz: 732534f686282f4c3bf450ac3d28dafdbb57fefd2a3bd9babfbba08e4104d055
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12209a6c4c0b5a55ea1bdd5f005b5defb44f12c1e95a5aff9812a663889f9da142a43de77d67a6e9430ccfef2a12a5607322e4129db5a953e020af3321be4fea
|
|
7
|
+
data.tar.gz: 9f3b304df4510392cd1b7dad538e7535d7928d546507916824ee7fd4328a8ef683fba9bf1b5eac9b9c963c8c5c2500b4450e3ad226b7aeeb6576e1071bf59384
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
economic-rest (0.3.
|
|
4
|
+
economic-rest (0.3.2)
|
|
5
5
|
rest-client
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -12,7 +12,7 @@ GEM
|
|
|
12
12
|
crack (0.4.3)
|
|
13
13
|
safe_yaml (~> 1.0.0)
|
|
14
14
|
docile (1.3.1)
|
|
15
|
-
domain_name (0.5.
|
|
15
|
+
domain_name (0.5.20190701)
|
|
16
16
|
unf (>= 0.0.5, < 1.0.0)
|
|
17
17
|
hashdiff (0.3.8)
|
|
18
18
|
http-cookie (1.0.3)
|
data/README.md
CHANGED
|
@@ -29,6 +29,31 @@ require 'economic/rest'
|
|
|
29
29
|
|
|
30
30
|
Economic::Demo.hello
|
|
31
31
|
|
|
32
|
+
Filter text can be added to the all query to avoid getting everything. e.g. a method for finding an accounting year for a specific date
|
|
33
|
+
|
|
34
|
+
def get_accounting_year(date)
|
|
35
|
+
Economic::AccountingYearRepo.all(filter_text: "toDate$gte:#{date}$and:fromDate$lte:#{date}")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
note: you need to use Lower Camel Case for variable names.
|
|
39
|
+
Filter Operators
|
|
40
|
+
|
|
41
|
+
The allowed filtering operators are:
|
|
42
|
+
|
|
43
|
+
Operator Syntax
|
|
44
|
+
Equals “$eq:”
|
|
45
|
+
Not equals “$ne:”
|
|
46
|
+
Greater than “$gt:”
|
|
47
|
+
Greater than or equal “$gte:”
|
|
48
|
+
Less than “$lt:”
|
|
49
|
+
Less than or equal “$lte:”
|
|
50
|
+
Substring match “$like:”
|
|
51
|
+
And also “$and:”
|
|
52
|
+
Or else “$or:”
|
|
53
|
+
In “$in:”
|
|
54
|
+
Not In “$nin:”
|
|
55
|
+
copy pasta from https://restdocs.e-conomic.com/#specifying-operator-affinity
|
|
56
|
+
|
|
32
57
|
## Development
|
|
33
58
|
|
|
34
59
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` or 'bundle exec m' to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/economic/base_repo.rb
CHANGED
|
@@ -16,20 +16,20 @@ module Economic
|
|
|
16
16
|
url << "?skippages=#{pageindex}&pagesize=1000"
|
|
17
17
|
url << "&filter=#{filter_text}" unless filter_text == ''
|
|
18
18
|
|
|
19
|
-
response = RestClient.get(url, headers)
|
|
19
|
+
response = RestClient.get(URI.escape(url), headers)
|
|
20
20
|
test_response(response)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def save(model)
|
|
24
24
|
post_or_put = model.id_key.nil? ? :post : :put
|
|
25
25
|
|
|
26
|
-
response = RestClient.public_send(post_or_put, endpoint_url + '/' + model.id_key.to_s, model.to_h.to_json, headers)
|
|
26
|
+
response = RestClient.public_send(post_or_put, URI.escape(endpoint_url + '/' + model.id_key.to_s), model.to_h.to_json, headers)
|
|
27
27
|
|
|
28
28
|
test_response(response)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def send(model)
|
|
32
|
-
response = RestClient.post(endpoint_url, model.to_h.to_json, headers)
|
|
32
|
+
response = RestClient.post(URI.escape(endpoint_url), model.to_h.to_json, headers)
|
|
33
33
|
test_response(response)
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -2,7 +2,7 @@ module Economic
|
|
|
2
2
|
class JournalVoucherRepo < Economic::BaseRepo
|
|
3
3
|
def self.save(voucher)
|
|
4
4
|
response = RestClient.post(
|
|
5
|
-
Economic::JournalRepo.endpoint_url + '/' + voucher.journal.journalNumber.to_s + '/vouchers',
|
|
5
|
+
URI.escape(Economic::JournalRepo.endpoint_url + '/' + voucher.journal.journalNumber.to_s + '/vouchers'),
|
|
6
6
|
voucher.to_h.to_json,
|
|
7
7
|
headers
|
|
8
8
|
)
|
|
@@ -5,7 +5,7 @@ module Economic
|
|
|
5
5
|
id ||= product_or_product_number
|
|
6
6
|
|
|
7
7
|
end_point = [superclass.endpoint_url, id, 'pricing', 'currency-specific-sales-prices'].join('/')
|
|
8
|
-
response = test_response(RestClient.get(end_point, headers))
|
|
8
|
+
response = test_response(RestClient.get(URI.escape(end_point), headers))
|
|
9
9
|
entry_hash = JSON.parse(response.body)
|
|
10
10
|
pricings = []
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ module Economic
|
|
|
5
5
|
id ||= product_group_or_product_group_number
|
|
6
6
|
|
|
7
7
|
end_point = [ProductGroupRepo.endpoint_url, id, 'products'].join('/')
|
|
8
|
-
response = test_response(RestClient.get(end_point, headers))
|
|
8
|
+
response = test_response(RestClient.get(URI.escape(end_point), headers))
|
|
9
9
|
entry_hash = JSON.parse(response.body)
|
|
10
10
|
products = []
|
|
11
11
|
|
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.3.
|
|
4
|
+
version: 0.3.2
|
|
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-
|
|
11
|
+
date: 2019-08-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -180,8 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
180
180
|
- !ruby/object:Gem::Version
|
|
181
181
|
version: '0'
|
|
182
182
|
requirements: []
|
|
183
|
-
|
|
184
|
-
rubygems_version: 2.7.6
|
|
183
|
+
rubygems_version: 3.0.1
|
|
185
184
|
signing_key:
|
|
186
185
|
specification_version: 4
|
|
187
186
|
summary: Ruby wrapper for the e-conomic REST API, that aims at making working with
|