akeneo 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cc4f6ecb550de1781121fd9fc162e6f0404d1fe0f02c150a96d834f10711beb
4
- data.tar.gz: 055dc4d5548ec75f62bf7f806ac4ab35229fa421646c0d92afb180f9ac1bb76e
3
+ metadata.gz: e7106ae925bd2cad04c32f0c7352c2d56dcff9ea011966a993b84701b0a10646
4
+ data.tar.gz: a2af5399f0b6bdc968633af6f9271fa694588183d28b78ee27651bcb294d665b
5
5
  SHA512:
6
- metadata.gz: '08f8ee88b7104485fdbeaa7451079d430cb54eefcb1feda70045eadc4e2371bb63045bac9f0e886e4bb067e13c362336fbfab52a67868d62360a9685eb594eec'
7
- data.tar.gz: 9d63a9a995ab7ec03e0f117e89a60c647f1a620365c74426908b30824e06bb8f11fd08f7263e1eb95dbed7801e88fed25e5184984b471e2874ebc4bcac24212e
6
+ metadata.gz: 6cb9c83524f92918b7a6aa40184788db6da2161101f5d6d313f29589dd36677e84b1beba8924e5d7ff5e39c29a669a73e8fadd4466ac81bf951db12cb8d74161
7
+ data.tar.gz: da185c7637374c421ff0333940c33be170a9f101902e1a3679c136d72780e0000de65b6b4744a2792800b0fa419539dea10e204d1a410cc66b712878000d0bb3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- akeneo (1.6.1)
4
+ akeneo (1.7.1)
5
5
  httparty (~> 0.17.0)
6
6
  mime-types
7
7
  redis
@@ -33,7 +33,7 @@ GEM
33
33
  public_suffix (3.0.3)
34
34
  rainbow (3.0.0)
35
35
  rake (12.3.2)
36
- redis (4.1.1)
36
+ redis (4.1.2)
37
37
  rspec (3.8.0)
38
38
  rspec-core (~> 3.8.0)
39
39
  rspec-expectations (~> 3.8.0)
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'akeneo'
8
- spec.version = '1.7.0'
8
+ spec.version = '1.7.1'
9
9
  spec.authors = ['AWN Dev Team']
10
10
  spec.email = ['edv@awn.de']
11
11
 
@@ -19,8 +19,8 @@ module Akeneo
19
19
  authorization_service.fresh_access_token
20
20
  end
21
21
 
22
- def product(sku)
23
- product_service.find(sku)
22
+ def product(code)
23
+ product_service.find(code)
24
24
  end
25
25
 
26
26
  def products(with_family: nil, with_completeness: nil, updated_after: nil)
@@ -78,8 +78,8 @@ module Akeneo
78
78
  product_model_service.find(product_parent['parent'])
79
79
  end
80
80
 
81
- def family(family_code)
82
- family_service.find(family_code)
81
+ def family(code)
82
+ family_service.find(code)
83
83
  end
84
84
 
85
85
  def family_variant(family_code, family_variant_code)
@@ -90,14 +90,11 @@ module Akeneo
90
90
  family_variant = family_service.variant(family_code, family_variant_code)
91
91
  return [] unless family_variant
92
92
 
93
- [
94
- find_attribute_code_for_level(family_variant, 1),
95
- find_attribute_code_for_level(family_variant, 2)
96
- ].compact
93
+ [find_attribute_code_for_level(family_variant, 1), find_attribute_code_for_level(family_variant, 2)].compact
97
94
  end
98
95
 
99
- def brothers_and_sisters(id)
100
- product_service.brothers_and_sisters(id)
96
+ def brothers_and_sisters(code)
97
+ product_service.brothers_and_sisters(code)
101
98
  end
102
99
 
103
100
  def attribute(code)
@@ -9,6 +9,7 @@ module Akeneo
9
9
  class ServiceBase
10
10
  prepend Cache
11
11
 
12
+ API_VERSION = 'v1'
12
13
  DEFAULT_PAGINATION_TYPE = :search_after
13
14
  DEFAULT_PAGINATION_LIMIT = 100
14
15
 
@@ -55,21 +56,21 @@ module Akeneo
55
56
 
56
57
  def get_request(path, options = {})
57
58
  HTTParty.get(
58
- "#{@url}/api/rest/v1#{path}",
59
+ build_url(path),
59
60
  options.merge(headers: default_request_headers)
60
61
  )
61
62
  end
62
63
 
63
64
  def patch_request(path, options = {})
64
65
  HTTParty.patch(
65
- "#{@url}/api/rest/v1#{path}",
66
+ build_url(path),
66
67
  options.merge(headers: default_request_headers)
67
68
  )
68
69
  end
69
70
 
70
71
  def patch_for_collection_request(path, options = {})
71
72
  HTTParty.patch(
72
- "#{@url}/api/rest/v1#{path}",
73
+ build_url(path),
73
74
  options.merge(headers: collection_request_headers)
74
75
  )
75
76
  end
@@ -92,7 +93,17 @@ module Akeneo
92
93
  return unless response.success?
93
94
 
94
95
  url = response.parsed_response.dig('_links', 'next', 'href')
95
- url.to_s.split('/api/rest/v1').last
96
+ url.to_s.split("/api/rest/#{API_VERSION}").last
97
+ end
98
+
99
+ def build_url(path)
100
+ "#{@url}/api/rest/#{API_VERSION}#{escape_path(path)}"
101
+ end
102
+
103
+ def escape_path(path)
104
+ return if path.nil?
105
+
106
+ path.to_s.gsub(' ', '%20')
96
107
  end
97
108
  end
98
109
  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.7.0
4
+ version: 1.7.1
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-05-28 00:00:00.000000000 Z
11
+ date: 2019-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake