akeneo 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/akeneo.gemspec +1 -1
- data/lib/akeneo/api.rb +7 -8
- data/lib/akeneo/product_service.rb +9 -5
- data/lib/akeneo/published_product_service.rb +1 -1
- data/lib/akeneo/service_base.rb +14 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f303ceb4a14dd7ab8dbc34262a322e34202c6eb4370139aa3ef0b3472db7b356
|
4
|
+
data.tar.gz: f9ef743047f2579fa8b76d63ae1594e039dd693c2ac2efc6021a7fbc389f719d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce6e025a9e0cd24b4fe174c0d7fbcc4a409f609e76c9da60f61b7eddd324b4631c94f5eea0466559f87f2599958c574e66e61b95c81153c29c883883e2a8f284
|
7
|
+
data.tar.gz: 5b57fe99232ffaa7b8d1e5f7c47099bf46afb5d8f09a58a540f4605f99d538da7efbd220192d5e3623065029afbb342bc071bae016bd1530df21382a522eea44
|
data/Gemfile.lock
CHANGED
data/akeneo.gemspec
CHANGED
data/lib/akeneo/api.rb
CHANGED
@@ -12,12 +12,7 @@ module Akeneo
|
|
12
12
|
|
13
13
|
def initialize(url:, client_id:, secret:, username:, password:)
|
14
14
|
@url = url
|
15
|
-
authorization_service.authorize!(
|
16
|
-
client_id: client_id,
|
17
|
-
secret: secret,
|
18
|
-
username: username,
|
19
|
-
password: password
|
20
|
-
)
|
15
|
+
authorization_service.authorize!(client_id: client_id, secret: secret, username: username, password: password)
|
21
16
|
end
|
22
17
|
|
23
18
|
def fresh_access_token
|
@@ -28,8 +23,12 @@ module Akeneo
|
|
28
23
|
product_service.find(sku)
|
29
24
|
end
|
30
25
|
|
31
|
-
def products(with_family: nil)
|
32
|
-
product_service.all(
|
26
|
+
def products(with_family: nil, with_completeness: nil, updated_after: nil)
|
27
|
+
product_service.all(
|
28
|
+
with_family: with_family,
|
29
|
+
with_completeness: with_completeness,
|
30
|
+
updated_after: updated_after
|
31
|
+
)
|
33
32
|
end
|
34
33
|
|
35
34
|
def published_products(updated_after: nil)
|
@@ -27,10 +27,9 @@ module Akeneo
|
|
27
27
|
load_products(akeneo_product, akeneo_product['family'], parents)
|
28
28
|
end
|
29
29
|
|
30
|
-
def all(with_family: nil)
|
30
|
+
def all(with_family: nil, with_completeness: nil, updated_after: nil)
|
31
31
|
Enumerator.new do |products|
|
32
|
-
path =
|
33
|
-
path += search_with_family_param(with_family) if with_family
|
32
|
+
path = build_path(with_family, with_completeness, updated_after)
|
34
33
|
|
35
34
|
loop do
|
36
35
|
response = get_request(path)
|
@@ -47,8 +46,13 @@ module Akeneo
|
|
47
46
|
|
48
47
|
private
|
49
48
|
|
50
|
-
def
|
51
|
-
|
49
|
+
def build_path(family, completeness, updated_after)
|
50
|
+
path = "/products?#{pagination_param}&#{limit_param}"
|
51
|
+
path + search_params(
|
52
|
+
family: family,
|
53
|
+
completeness: completeness,
|
54
|
+
updated_after: updated_after
|
55
|
+
)
|
52
56
|
end
|
53
57
|
|
54
58
|
def load_akeneo_parent(code)
|
@@ -12,7 +12,7 @@ module Akeneo
|
|
12
12
|
def published_products(updated_after: nil)
|
13
13
|
Enumerator.new do |products|
|
14
14
|
path = "/published-products?#{pagination_param}"
|
15
|
-
path +=
|
15
|
+
path += search_params(updated_after: updated_after)
|
16
16
|
|
17
17
|
loop do
|
18
18
|
response = get_request(path)
|
data/lib/akeneo/service_base.rb
CHANGED
@@ -19,6 +19,20 @@ module Akeneo
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
+
def search_params(family: nil, completeness: nil, updated_after: nil)
|
23
|
+
return '' if family.nil? && completeness.nil? && updated_after.nil?
|
24
|
+
|
25
|
+
"&search=#{search_params_hash(family, completeness, updated_after).to_json}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def search_params_hash(family, completeness, updated_after)
|
29
|
+
{}.tap do |hash|
|
30
|
+
hash[:family] = [{ operator: 'IN', value: [family] }] if family
|
31
|
+
hash[:completeness] = [completeness] if completeness
|
32
|
+
hash[:updated] = [{ operator: '>', value: updated_after.strftime('%F %T') }] if updated_after
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
22
36
|
def json_headers
|
23
37
|
{ 'Content-Type' => 'application/json' }
|
24
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akeneo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AWN Dev Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -179,7 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
|
-
|
182
|
+
rubyforge_project:
|
183
|
+
rubygems_version: 2.7.6
|
183
184
|
signing_key:
|
184
185
|
specification_version: 4
|
185
186
|
summary: API client for accessing Akeneo
|