plenty_client 0.0.6 → 0.0.7

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
  SHA1:
3
- metadata.gz: eb010c2d8eea674495b4be5eb1ce7e102a8858b7
4
- data.tar.gz: d841c52fbed4b6179cfd5f5a51886dd3b8fba67b
3
+ metadata.gz: ea9423f7820574f84a5db81a76266019cfab31ee
4
+ data.tar.gz: 4b7ff9a57da2b049c64a005c89140a141046e441
5
5
  SHA512:
6
- metadata.gz: 606bce14518ea588a855af13adbafb2d457a34fac6cba6e03aa9701a09a4903286edb153de24ad985d6ebfcf42cce2601222f6e70099c89b81c96b009640213e
7
- data.tar.gz: 29fd04970b0c76450e9f32c7364dfd491df7c739d04bebe551b9981842111ff438ea893cea9ec17044645451d44b107cf3369fc21eac31310144131b1b63616e
6
+ metadata.gz: 0751e8c157b9aac8dadccd5cf0253d5bb2c54680ed6ed02e5ab2ecbd1e4ab8a171103ff567559cd9f4dad7e6ab975b5a3f2b278fec98006438ccfc75b4c204cc
7
+ data.tar.gz: 389ad689f6c626fc4fdbe2d4e6b35d7e895950528f2d9a4ebba0d5ec4083dba56ae81ca0b551300cf5bf195be4a8bf0ec2bc5ef255876bfb5718994f676cc5f9
@@ -4,9 +4,11 @@ module PlentyClient
4
4
  include PlentyClient::Endpoint
5
5
  include PlentyClient::Request
6
6
 
7
- CREATE_ITEMS_UNITS = '/items/{itemId}/units'.freeze
8
- GET_ITEMS_UNIT = '/items/{itemId}/units'.freeze
9
- DELETE_ITEMS_UNIT = '/items/{itemId}/units/{unitId}'.freeze
7
+ CREATE_ITEMS_UNITS = '/items/units'.freeze
8
+ LIST_ITEM_UNITS = '/items/units'.freeze
9
+ GET_ITEMS_UNIT = '/items/units'.freeze
10
+ UPDATE_ITEM_UNIT = '/items/units/{unitId}'.freeze
11
+ DELETE_ITEMS_UNIT = '/items/units/{unitId}'.freeze
10
12
 
11
13
  class << self
12
14
  def create(headers = {})
@@ -14,7 +16,7 @@ module PlentyClient
14
16
  end
15
17
 
16
18
  def list(headers = {}, &block)
17
- get(build_endpoint(GET_ITEMS_UNIT), headers, &block)
19
+ get(build_endpoint(LIST_ITEM_UNITS), headers, &block)
18
20
  end
19
21
 
20
22
  def find(unit_id, headers = {}, &block)
@@ -22,7 +24,7 @@ module PlentyClient
22
24
  end
23
25
 
24
26
  def update(unit_id, headers = {}, &block)
25
- put(build_endpoint(GET_ITEMS_UNIT, unit: unit_id), headers, &block)
27
+ put(build_endpoint(UPDATE_ITEM_UNIT, unit: unit_id), headers, &block)
26
28
  end
27
29
 
28
30
  def destroy(unit_id)
@@ -1,37 +1,36 @@
1
- # TODO: Fix class, PlentyMarkets changed syntax
1
+ # frozen_string_literal: true
2
+
2
3
  module PlentyClient
3
4
  module Item
4
5
  class UnitName
5
6
  include PlentyClient::Endpoint
6
7
  include PlentyClient::Request
7
8
 
8
- ITEM_UNIT_PATH = '/items/{itemId}/units'.freeze
9
-
10
- ITEM_UNITS = '/names'.freeze
11
- LIST_ITEM_UNIT = '/names'.freeze
12
- GET_ITEMS_UNIT = '/names/{lang}'.freeze
13
- UPDATE_ITEMS_UNIT = '/names/{lang}'.freeze
14
- DELETE_ITEMS_UNIT = '/names/{lang}'.freeze
9
+ LIST_ITEM_UNIT_NAMES = '/item/units/{unitID}/names'.freeze
10
+ FIND_ITEM_UNIT_NAME = '/item/units/{unitID}/names/{lang}'.freeze
11
+ CREATE_ITEMS_UNIT_NAME = '/item/units/{unitID}/names'.freeze
12
+ UPDATE_ITEMS_UNIT_NAME = '/item/units/{unitID}/names/{lang}'.freeze
13
+ DELETE_ITEMS_UNIT_NAME = '/item/units/{unitID}/names/{lang}'.freeze
15
14
 
16
15
  class << self
17
- def create(item_id, headers = {})
18
- post(build_endpoint(CREATE_ITEMS_UNITS, item: item_id), headers)
16
+ def list(unit_id, headers = {}, &block)
17
+ get(build_endpoint(LIST_ITEM_UNIT_NAMES, unit: unit_id), headers, &block)
19
18
  end
20
19
 
21
- def list(item_id, headers = {}, &block)
22
- get(build_endpoint(LIST_ITEM_UNIT, item: item_id), headers, &block)
20
+ def find(unit_id, lang, headers = {}, &block)
21
+ get(build_endpoint(FIND_ITEM_UNIT_NAME, unit: unit_id, lang: lang), headers, &block)
23
22
  end
24
23
 
25
- def find(item_id, unit_id, lang, headers = {}, &block)
26
- get(build_endpoint(GET_ITEMS_UNIT, item: item_id, unit: unit_id, lang: lang), headers, &block)
24
+ def create(unit_id, headers = {})
25
+ post(build_endpoint(CREATE_ITEMS_UNIT_NAME, unit: unit_id), headers)
27
26
  end
28
27
 
29
- def update(item_id, unit_id, lang, headers = {}, &block)
30
- put(build_endpoint(UPDATE_ITEMS_UNIT, item: item_id, unit: unit_id, lang: lang), headers, &block)
28
+ def update(unit_id, lang, headers = {}, &block)
29
+ put(build_endpoint(UPDATE_ITEMS_UNIT_NAME, unit: unit_id, lang: lang), headers, &block)
31
30
  end
32
31
 
33
- def destroy(item_id, unit_id, lang)
34
- delete(build_endpoint(DELETE_ITEMS_UNIT, item: item_id, unit: unit_id, lang: lang))
32
+ def destroy(unit_id, lang)
33
+ delete(build_endpoint(DELETE_ITEMS_UNIT_NAME, unit: unit_id, lang: lang))
35
34
  end
36
35
  end
37
36
  end
@@ -0,0 +1,49 @@
1
+ module PlentyClient
2
+ module Item
3
+ module Variation
4
+ module Property
5
+ class Text
6
+ include PlentyClient::Endpoint
7
+ include PlentyClient::Request
8
+
9
+ VARIATION_PROPERTY_TEXT_BASE_PATH = '/items/{itemId}/variations/{variationId}'.freeze
10
+
11
+ GET_VARIATION_PROPERTY_TEXT = '/variation_properties/{propertyId}/texts'.freeze
12
+ GET_VARIATION_PROPERTY_TEXT_BY_LANG = '/variation_properties/{propertyId}/texts/{lang}'.freeze
13
+ CREATE_VARIATION_PROPERTY_TEXT = '/variation_properties/{propertyId}/texts'.freeze
14
+ UPDATE_VARIATION_PROPERTY_TEXT = '/variation_properties/{propertyId}/texts/{lang}'.freeze
15
+ DELETE_VARIATION_PROPERTY_TEXT = '/variation_properties/{propertyId}/texts/{lang}'.freeze
16
+
17
+ class << self
18
+ def find(item_id, variation_id, property_id, headers = {}, &block)
19
+ get(build_endpoint("#{VARIATION_PROPERTY_TEXT_BASE_PATH}#{GET_VARIATION_PROPERTY_TEXT}",
20
+ item: item_id, variation: variation_id, property: property_id), headers, &block)
21
+ end
22
+
23
+ def find_by_language(item_id, variation_id, property_id, lang, headers = {}, &block)
24
+ get(build_endpoint("#{VARIATION_PROPERTY_TEXT_BASE_PATH}#{GET_VARIATION_PROPERTY_TEXT_BY_LANG}",
25
+ item: item_id, variation: variation_id, property: property_id, lang: lang),
26
+ headers, &block)
27
+ end
28
+
29
+ def create(item_id, variation_id, property_id, headers = {})
30
+ post(build_endpoint("#{VARIATION_PROPERTY_TEXT_BASE_PATH}#{CREATE_VARIATION_PROPERTY_TEXT}",
31
+ item: item_id, variation: variation_id, property: property_id), headers)
32
+ end
33
+
34
+ def update(item_id, variation_id, property_id, lang, headers = {})
35
+ put(build_endpoint("#{VARIATION_PROPERTY_TEXT_BASE_PATH}#{UPDATE_VARIATION_PROPERTY_TEXT}",
36
+ item: item_id, variation: variation_id, property: property_id, lang: lang),
37
+ headers)
38
+ end
39
+
40
+ def destroy(item_id, variation_id, property_id, lang)
41
+ delete(build_endpoint("#{VARIATION_PROPERTY_TEXT_BASE_PATH}#{DELETE_VARIATION_PROPERTY_TEXT}",
42
+ item: item_id, variation: variation_id, property: property_id, lang: lang))
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,45 @@
1
+ module PlentyClient
2
+ module Item
3
+ module Variation
4
+ module Property
5
+ include PlentyClient::Endpoint
6
+ include PlentyClient::Request
7
+
8
+ VARIATION_PROPERTY_BASE_PATH = '/items/{itemId}/variations/{variationId}'.freeze
9
+
10
+ LIST_ALL_VARIATION_PROPERTIES = '/variation_properties'.freeze
11
+ GET_VARIATION_PROPERTY = '/variation_properties/{propertyId}'.freeze
12
+ CREATE_VARIATION_PROPERTY = '/variation_properties'.freeze
13
+ UPDATE_VARIATION_PROPERTY = '/variation_properties/{propertyId}'.freeze
14
+ DELETE_VARIATION_PROPERTY = '/variation_properties/{propertyId}'.freeze
15
+
16
+ class << self
17
+ def list(item_id, variation_id, headers = {}, &block)
18
+ get(build_endpoint("#{VARIATION_PROPERTY_BASE_PATH}#{LIST_ALL_VARIATION_PROPERTIES}",
19
+ item: item_id, variation: variation_id), headers, &block)
20
+ end
21
+
22
+ def find(item_id, variation_id, property_id, headers = {}, &block)
23
+ get(build_endpoint("#{VARIATION_PROPERTY_BASE_PATH}#{GET_VARIATION_PROPERTY}",
24
+ item: item_id, variation: variation_id, property: property_id), headers, &block)
25
+ end
26
+
27
+ def create(item_id, variation_id, headers = {})
28
+ post(build_endpoint("#{VARIATION_PROPERTY_BASE_PATH}#{CREATE_VARIATION_PROPERTY}",
29
+ item: item_id, variation: variation_id), headers)
30
+ end
31
+
32
+ def update(item_id, variation_id, property_id, headers = {})
33
+ put(build_endpoint("#{VARIATION_PROPERTY_BASE_PATH}#{UPDATE_VARIATION_PROPERTY}",
34
+ item: item_id, variation: variation_id, property: property_id), headers)
35
+ end
36
+
37
+ def destroy(item_id, variation_id, property_id)
38
+ delete(build_endpoint("#{VARIATION_PROPERTY_BASE_PATH}#{DELETE_VARIATION_PROPERTY}",
39
+ item: item_id, variation: variation_id, property: property_id))
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -45,7 +45,7 @@ module PlentyClient
45
45
  variation: variation_id), body)
46
46
  end
47
47
 
48
- def update_rediestributions(item_id, variation_id, body = {})
48
+ def update_redistributions(item_id, variation_id, body = {})
49
49
  put(build_endpoint("#{ITEM_VARIATION_STOCK_PATH}#{UPDATE_ITEM_VARIATIONS_STOCK_REDISTRIBUTE}",
50
50
  item: item_id,
51
51
  variation: variation_id), body)
@@ -11,20 +11,20 @@ module PlentyClient
11
11
  DELETE_LISTING_MARKET = '/listings/markets/directories/{directoryId}'.freeze
12
12
 
13
13
  class << self
14
- def find(market_listing_id, headers = {}, &block)
15
- get(build_endpoint(FIND_LISTING_MARKET, market_listing: market_listing_id), headers, &block)
14
+ def find(directory_id, headers = {}, &block)
15
+ get(build_endpoint(FIND_LISTING_MARKET, directory: directory_id), headers, &block)
16
16
  end
17
17
 
18
18
  def create(body = {})
19
19
  post(build_endpoint(CREATE_LISTING_MARKET), body)
20
20
  end
21
21
 
22
- def update(market_listing_id, body = {})
23
- put(build_endpoint(UPDATE_LISTING_MARKET, market_listing: market_listing_id), body)
22
+ def update(directory_id, body = {})
23
+ put(build_endpoint(UPDATE_LISTING_MARKET, directory: directory_id), body)
24
24
  end
25
25
 
26
- def destroy(market_listing_id, body = {})
27
- delete(build_endpoint(DELETE_LISTING_MARKET, market_listing: market_listing_id), body)
26
+ def destroy(directory_id, body = {})
27
+ delete(build_endpoint(DELETE_LISTING_MARKET, directory: directory_id), body)
28
28
  end
29
29
  end
30
30
  end
@@ -115,7 +115,10 @@ module PlentyClient
115
115
 
116
116
  def extract_message(response)
117
117
  if response.key?('validation_errors') && response['validation_errors'] && !response['validation_errors']&.empty?
118
- response['validation_errors'].values.flatten.join(', ')
118
+ errors = response['validation_errors']
119
+ rval = errors.values if response['validation_errors'].is_a?(Hash)
120
+ rval = errors.flatten.values if response['validation_errors'].is_a?(Array)
121
+ rval.flatten.join(', ')
119
122
  else
120
123
  response['error']['message']
121
124
  end
@@ -1,3 +1,3 @@
1
1
  module PlentyClient
2
- VERSION = '0.0.6'.freeze
2
+ VERSION = '0.0.7'.freeze
3
3
  end
data/lib/plenty_client.rb CHANGED
@@ -66,8 +66,6 @@ module PlentyClient
66
66
  autoload :Unit, 'plenty_client/item/unit'
67
67
  autoload :UnitName, 'plenty_client/item/unit_name'
68
68
  autoload :Variation, 'plenty_client/item/variation'
69
- autoload :VariationProperty, 'plenty_client/item/variation_property'
70
- autoload :VariationPropertyValue, 'plenty_client/item/variation_property_value'
71
69
 
72
70
  module Attribute
73
71
  autoload :Name, 'plenty_client/item/attribute/name'
@@ -99,11 +97,16 @@ module PlentyClient
99
97
  autoload :Image, 'plenty_client/item/variation/image'
100
98
  autoload :Market, 'plenty_client/item/variation/market'
101
99
  autoload :MarketIdentNumber, 'plenty_client/item/variation/market_ident_number'
100
+ autoload :Property, 'plenty_client/item/variation/property'
102
101
  autoload :SalesPrice, 'plenty_client/item/variation/sales_price'
103
102
  autoload :Sku, 'plenty_client/item/variation/sku'
104
103
  autoload :Stock, 'plenty_client/item/variation/stock'
105
104
  autoload :Supplier, 'plenty_client/item/variation/supplier'
106
105
  autoload :Warehouse, 'plenty_client/item/variation/warehouse'
106
+
107
+ module Property
108
+ autoload :Text, 'plenty_client/item/variation_property_value'
109
+ end
107
110
  end
108
111
  end
109
112
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plenty_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dariusch Ochlast
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -219,13 +219,13 @@ files:
219
219
  - lib/plenty_client/item/variation/image.rb
220
220
  - lib/plenty_client/item/variation/market.rb
221
221
  - lib/plenty_client/item/variation/market_ident_number.rb
222
+ - lib/plenty_client/item/variation/property.rb
223
+ - lib/plenty_client/item/variation/property/text.rb
222
224
  - lib/plenty_client/item/variation/sales_price.rb
223
225
  - lib/plenty_client/item/variation/sku.rb
224
226
  - lib/plenty_client/item/variation/stock.rb
225
227
  - lib/plenty_client/item/variation/supplier.rb
226
228
  - lib/plenty_client/item/variation/warehouse.rb
227
- - lib/plenty_client/item/variation_property.rb
228
- - lib/plenty_client/item/variation_property_value.rb
229
229
  - lib/plenty_client/item_set.rb
230
230
  - lib/plenty_client/item_set/component.rb
231
231
  - lib/plenty_client/item_set/config.rb
@@ -1,36 +0,0 @@
1
- module PlentyClient
2
- module Item
3
- class VariationProperty
4
- include PlentyClient::Endpoint
5
- include PlentyClient::Request
6
-
7
- LIST_ALL_VARIATION_PROPERTIES = '/items/{itemId}/variation_properties'.freeze
8
- GET_VARIATION_PROPERTY = '/items/{itemId}/variation_properties/{variationId}'.freeze
9
- CREATE_VARIATION_PROPERTY = '/items/{itemId}/variation_properties'.freeze
10
- UPDATE_VARIATION_PROPERTY = '/items/{itemId}/variation_properties/{variationId}'.freeze
11
- DELETE_VARIATION_PROPERTY = '/items/{itemId}/variation_properties/{variationId}'.freeze
12
-
13
- class << self
14
- def list(headers = {}, &block)
15
- get(build_endpoint(LIST_ALL_VARIATION_PROPERTIES), headers, &block)
16
- end
17
-
18
- def find(item_id, variation_id, headers = {}, &block)
19
- get(build_endpoint(GET_VARIATION_PROPERTY, item: item_id, variation: variation_id), headers, &block)
20
- end
21
-
22
- def create(headers = {})
23
- post(build_endpoint(CREATE_VARIATION_PROPERTY), headers)
24
- end
25
-
26
- def update(item_id, variation_id, headers = {})
27
- put(build_endpoint(UPDATE_VARIATION_PROPERTY, item: item_id, variation: variation_id), headers)
28
- end
29
-
30
- def destroy(item_id, variation_id)
31
- delete(build_endpoint(DELETE_VARIATION_PROPERTY, item: item_id, variation: variation_id))
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,44 +0,0 @@
1
- module PlentyClient
2
- module Item
3
- class VariationPropertyValue
4
- include PlentyClient::Endpoint
5
- include PlentyClient::Request
6
-
7
- VARIATION_PROPERTY_VALUE_BASE_PATH = '/items/{itemId}/variation_properties/{variationId}'.freeze
8
-
9
- LIST_ALL_VARIATION_PROPERTY_VALUES = '/values'.freeze
10
- GET_VARIATION_PROPERTY_VALUES = '/values/{propertyId}'.freeze
11
- CREATE_VARIATION_PROPERTY_VALUES = '/values'.freeze
12
- UPDATE_VARIATION_PROPERTY_VALUES = '/values/{propertyId}'.freeze
13
- DELETE_VARIATION_PROPERTY_VALUES = '/values/{propertyId}'.freeze
14
-
15
- class << self
16
- def list(headers = {}, &block)
17
- get(build_endpoint("#{VARIATION_PROPERTY_VALUE_BASE_PATH}#{LIST_ALL_VARIATION_PROPERTY_VALUES}"),
18
- headers, &block)
19
- end
20
-
21
- def find(item_id, variation_id, property_id, headers = {}, &block)
22
- get(build_endpoint("#{VARIATION_PROPERTY_VALUE_BASE_PATH}#{GET_VARIATION_PROPERTY}",
23
- item: item_id, variation: variation_id, property: property_id),
24
- headers, &block)
25
- end
26
-
27
- def create(body = {})
28
- post(build_endpoint("#{VARIATION_PROPERTY_VALUE_BASE_PATH}#{CREATE_VARIATION_PROPERTY_VALUES}"), body)
29
- end
30
-
31
- def update(item_id, variation_id, property_id, body = {})
32
- put(build_endpoint("#{VARIATION_PROPERTY_VALUE_BASE_PATH}#{UPDATE_VARIATION_PROPERTY_VALUES}",
33
- item: item_id, variation: variation_id, property: property_id),
34
- body)
35
- end
36
-
37
- def destroy(item_id, variation_id, property_id)
38
- delete(build_endpoint("#{VARIATION_PROPERTY_VALUE_BASE_PATH}#{DELETE_VARIATION_PROPERTY_VALUES}",
39
- item: item_id, variation: variation_id, property: property_id))
40
- end
41
- end
42
- end
43
- end
44
- end