plenty_client 0.0.2 → 0.0.3

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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/README.md +9 -36
  4. data/Rakefile +3 -3
  5. data/lib/plenty_client.rb +8 -5
  6. data/lib/plenty_client/accounting.rb +2 -2
  7. data/lib/plenty_client/authentication.rb +2 -2
  8. data/lib/plenty_client/authorization.rb +2 -2
  9. data/lib/plenty_client/basket.rb +2 -2
  10. data/lib/plenty_client/basket/item.rb +2 -2
  11. data/lib/plenty_client/category.rb +6 -7
  12. data/lib/plenty_client/category/branch.rb +2 -2
  13. data/lib/plenty_client/category/template.rb +3 -3
  14. data/lib/plenty_client/comment.rb +3 -3
  15. data/lib/plenty_client/config.rb +3 -1
  16. data/lib/plenty_client/endpoint.rb +74 -68
  17. data/lib/plenty_client/item.rb +7 -2
  18. data/lib/plenty_client/item/attribute.rb +3 -3
  19. data/lib/plenty_client/item/attribute/name.rb +12 -20
  20. data/lib/plenty_client/item/attribute/value.rb +13 -18
  21. data/lib/plenty_client/item/attribute/value_name.rb +12 -12
  22. data/lib/plenty_client/item/barcode.rb +3 -3
  23. data/lib/plenty_client/item/cross_selling.rb +3 -3
  24. data/lib/plenty_client/item/image.rb +6 -6
  25. data/lib/plenty_client/item/image/availability.rb +10 -10
  26. data/lib/plenty_client/item/image/name.rb +14 -24
  27. data/lib/plenty_client/item/manufacturer.rb +4 -4
  28. data/lib/plenty_client/item/manufacturer/commission.rb +3 -3
  29. data/lib/plenty_client/item/property.rb +3 -3
  30. data/lib/plenty_client/item/property/market_reference.rb +11 -11
  31. data/lib/plenty_client/item/property/name.rb +12 -17
  32. data/lib/plenty_client/item/property_group.rb +3 -3
  33. data/lib/plenty_client/item/property_group_name.rb +8 -10
  34. data/lib/plenty_client/item/sales_price.rb +3 -4
  35. data/lib/plenty_client/item/shipping_profile.rb +6 -6
  36. data/lib/plenty_client/item/unit.rb +3 -4
  37. data/lib/plenty_client/item/unit_name.rb +12 -11
  38. data/lib/plenty_client/item/variation.rb +10 -4
  39. data/lib/plenty_client/item/variation/barcode.rb +3 -3
  40. data/lib/plenty_client/item/variation/bundle.rb +14 -16
  41. data/lib/plenty_client/item/variation/category.rb +8 -10
  42. data/lib/plenty_client/item/variation/client.rb +3 -3
  43. data/lib/plenty_client/item/variation/default_category.rb +3 -3
  44. data/lib/plenty_client/item/variation/description.rb +3 -3
  45. data/lib/plenty_client/item/variation/image.rb +5 -4
  46. data/lib/plenty_client/item/variation/market.rb +3 -3
  47. data/lib/plenty_client/item/variation/market_ident_number.rb +3 -3
  48. data/lib/plenty_client/item/variation/sales_price.rb +13 -17
  49. data/lib/plenty_client/item/variation/sku.rb +12 -15
  50. data/lib/plenty_client/item/variation/stock.rb +3 -3
  51. data/lib/plenty_client/item/variation/supplier.rb +12 -15
  52. data/lib/plenty_client/item/variation/warehouse.rb +6 -5
  53. data/lib/plenty_client/item/variation_property.rb +3 -3
  54. data/lib/plenty_client/item/variation_property_value.rb +10 -14
  55. data/lib/plenty_client/item_set.rb +4 -4
  56. data/lib/plenty_client/item_set/component.rb +15 -22
  57. data/lib/plenty_client/item_set/config.rb +3 -2
  58. data/lib/plenty_client/order.rb +5 -4
  59. data/lib/plenty_client/order/contact_wish.rb +2 -3
  60. data/lib/plenty_client/order/coupon_code.rb +5 -7
  61. data/lib/plenty_client/order/coupon_code/contact.rb +4 -6
  62. data/lib/plenty_client/order/coupon_code/validation.rb +4 -6
  63. data/lib/plenty_client/order/currency.rb +2 -3
  64. data/lib/plenty_client/order/date.rb +3 -4
  65. data/lib/plenty_client/order/item.rb +3 -3
  66. data/lib/plenty_client/order/item/date.rb +2 -2
  67. data/lib/plenty_client/order/item/property.rb +2 -2
  68. data/lib/plenty_client/order/item/serial_number.rb +3 -3
  69. data/lib/plenty_client/order/property.rb +2 -3
  70. data/lib/plenty_client/order/referrer.rb +2 -3
  71. data/lib/plenty_client/order/shipping.rb +2 -3
  72. data/lib/plenty_client/order/shipping/country.rb +2 -2
  73. data/lib/plenty_client/order/shipping/information.rb +3 -3
  74. data/lib/plenty_client/order/shipping/package.rb +4 -4
  75. data/lib/plenty_client/order/shipping/profile.rb +2 -2
  76. data/lib/plenty_client/order/shipping/service_provider.rb +2 -2
  77. data/lib/plenty_client/request.rb +121 -98
  78. data/lib/plenty_client/sales_price/account.rb +2 -3
  79. data/lib/plenty_client/sales_price/country.rb +2 -2
  80. data/lib/plenty_client/sales_price/currency.rb +2 -2
  81. data/lib/plenty_client/sales_price/customer_class.rb +2 -2
  82. data/lib/plenty_client/sales_price/name.rb +4 -4
  83. data/lib/plenty_client/sales_price/online_store.rb +2 -3
  84. data/lib/plenty_client/sales_price/referrer.rb +3 -2
  85. data/lib/plenty_client/version.rb +1 -1
  86. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7180904868c8a02d469c837d0ebc23bd45771173
4
- data.tar.gz: 210526fc22be311c647f257190508ed53c6b720f
3
+ metadata.gz: 1e689726c8a6699f7c57b32f82c9cfa6b969c43e
4
+ data.tar.gz: 3f99888156deccc95fa7d013f39eb4ebcf1deb54
5
5
  SHA512:
6
- metadata.gz: 4fa101d7f1462504fc8a7a643633f640fa9898f903e75fd86e7c5efa01d21f873e4f653002ed27b71c79853f3c47b24f88e6ad40ac5bbec00fd63ec4babe48e1
7
- data.tar.gz: 4e7b8cd5d34d56c2148f38c0c11dd316d9b2456c51ea6daa071f01b7d398def13d406abcdd78fa5894b474aabc9e261577425fc6064ae4cda526c487e320b354
6
+ metadata.gz: 92fc5e2f051a125639bbd5c1c6bec651cd22b55e71a9681426dc8d899959c157189e3ec26d2440a1d403e710edab13838e2f4148cff6265649cab0b681bfe79f
7
+ data.tar.gz: 655b49ac1d5a8859049fd3fcd20d34a707328854ffbdde49beba7c74a50feb6cb5ff42bcf88a5c9862a2796cabde853a2a29e8a1f4e9a8c7c4bff0a69089bb74
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This is the configuration used to check the rubocop source code.
2
2
  AllCops:
3
- TargetRubyVersion: 2.3
3
+ TargetRubyVersion: 2.4
4
4
  Exclude:
5
5
  - 'db/schema.rb'
6
6
  Lint/HandleExceptions:
data/README.md CHANGED
@@ -36,15 +36,16 @@ PlentyClient::Config.site_url = 'http://plenty7.plentymarkets.de/rest'
36
36
  PlentyClient::Config.api_user = 'myusername'
37
37
  PlentyClient::Config.api_password = 'mypassword'
38
38
  PlentyClient::Config.log = true || false
39
+ PlentyClient::Config.plenty_id = 111111
39
40
  ```
40
41
 
41
42
  # Calls
42
- Once you are set up you can use the client with the following methods:
43
-
44
43
  Note:
45
- - required parameters need to be passed in, otherwise you will get an error
44
+ - required parameters need to be passed in, otherwise you will receive an PlentyClient::ResponseError
46
45
  - This Client handles no validation, it is only a gateway to the API
47
46
 
47
+ Once you are set up you can use the client like so:
48
+
48
49
  ```ruby
49
50
  PlentyClient::Item.find(103)
50
51
  PlentyClient::Item::Variation.find(103, 105)
@@ -56,52 +57,23 @@ PlentyClient::Item.create(parameters)
56
57
 
57
58
  PlentyClient::Item::Variation.update(103, update_parameters)
58
59
 
59
- PlentyClient::Item::Variation.delete(103, 105)
60
-
61
- ```
62
-
63
- ### Blocks
60
+ PlentyClient::Item::Variation.destroy(103, 105)
64
61
 
65
- ```ruby
66
62
  # Use blocks to iterate in batches
67
63
  PlentyClient::Item.list do |item|
68
64
  puts item
69
65
  end
70
66
 
71
67
  # You can set optional headers after the required parameters of each request
72
- PlentyClient::Item::Variation.list(103, {'itemsPerPage' => 1, 'page' => 4}) do |item|
68
+ PlentyClient::Item::Variation.list(103, { 'itemsPerPage' => 1, 'page' => 4 }) do |item|
73
69
  puts item
74
70
  end
75
71
  ```
76
72
 
77
- ### HTTP-Methods
78
-
79
- If there is no resource available you can still make the request like so:
80
- ```ruby
81
- PlentyClient::Request.patch(path, body = {})
82
- PlentyClient::Request.put(path, body = {})
83
- PlentyClient::Request.post(path, body = {})
84
- PlentyClient::Request.delete(path, params = {})
85
- PlentyClient::Request.get(path, params = {})
86
- PlentyClient::Request.get(path, params = {}) do |body|
87
- end
88
- ```
89
-
90
73
  ### Warnings
91
74
  There is a difference in the get method with and without a block.
92
- This returns the raw body with all parameters
93
-
94
- ```ruby
95
- PlentyClient::Request.get(path, params = {})
96
-
97
- ```
98
- The get-call with the block only returns the entries
99
- ```ruby
100
- PlentyClient::Request.get(path, params = {}) do |body|
101
- puts entries
102
- end
103
-
104
- ```
75
+ The Call without the block will return the complete response.
76
+ With the block you will only receive the entries.
105
77
 
106
78
  ### Debugging
107
79
  If you are not sure which required parameters to pass in simply call
@@ -128,6 +100,7 @@ PlentyClient::Item::Variation.routes
128
100
  * [`ExportSettings`](https://developers.plentymarkets.com/rest-doc/export_settings)
129
101
  * [~~`Item`~~](https://developers.plentymarkets.com/rest-doc/item)
130
102
  * [`LegalInformation`](https://developers.plentymarkets.com/rest-doc/legal_information)
103
+ * [`Listing`](https://developers.plentymarkets.com/rest-doc/listing)
131
104
  * [`Market`](https://developers.plentymarkets.com/rest-doc/market)
132
105
  * [~~`Order`~~](https://developers.plentymarkets.com/rest-doc/order)
133
106
  * [`OrderSummary`](https://developers.plentymarkets.com/rest-doc/order_summary)
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/lib/plenty_client.rb CHANGED
@@ -2,11 +2,13 @@ require 'curl'
2
2
  require 'json'
3
3
 
4
4
  module PlentyClient
5
- autoload :Config, 'plenty_client/config'
6
- autoload :Constants, 'plenty_client/constants'
7
- autoload :Endpoint, 'plenty_client/endpoint'
8
- autoload :Request, 'plenty_client/request'
9
- autoload :Version, 'plenty_client/version'
5
+ class ResponseError < StandardError; end
6
+
7
+ autoload :Config, 'plenty_client/config'
8
+ autoload :Constants, 'plenty_client/constants'
9
+ autoload :Endpoint, 'plenty_client/endpoint'
10
+ autoload :Request, 'plenty_client/request'
11
+ autoload :Version, 'plenty_client/version'
10
12
 
11
13
  autoload :Accounting, 'plenty_client/accounting'
12
14
  autoload :Authentication, 'plenty_client/authentication'
@@ -38,6 +40,7 @@ module PlentyClient
38
40
  autoload :PropertyGroupName, 'plenty_client/item/property_group_name'
39
41
  autoload :SalesPrice, 'plenty_client/item/sales_price'
40
42
  autoload :SalesPriceShippingProfile, 'plenty_client/item/sales_price_shipping_profile'
43
+ autoload :ShippingProfile, 'plenty_client/item/shipping_profile'
41
44
  autoload :Unit, 'plenty_client/item/unit'
42
45
  autoload :UnitName, 'plenty_client/item/unit_name'
43
46
  autoload :Variation, 'plenty_client/item/variation'
@@ -1,7 +1,7 @@
1
1
  module PlentyClient
2
2
  module Accounting
3
- extend PlentyClient::Endpoint
4
- extend PlentyClient::Request
3
+ include PlentyClient::Endpoint
4
+ include PlentyClient::Request
5
5
 
6
6
  LIST_VAT_OF_LOCATION = '/vat/locations/{locationId}'.freeze
7
7
  LIST_VAT_OF_COUNTRY = '/vat/locations/{locationId}/countries/{countryId}'.freeze
@@ -1,7 +1,7 @@
1
1
  module PlentyClient
2
2
  module Authentication
3
- extend PlentyClient::Endpoint
4
- extend PlentyClient::Request
3
+ include PlentyClient::Endpoint
4
+ include PlentyClient::Request
5
5
 
6
6
  AUTH_LOGIN = '/login'.freeze
7
7
  AUTH_REFRESH = '/login/refresh'.freeze
@@ -1,7 +1,7 @@
1
1
  module PlentyClient
2
2
  module Authorization
3
- extend PlentyClient::Endpoint
4
- extend PlentyClient::Request
3
+ include PlentyClient::Endpoint
4
+ include PlentyClient::Request
5
5
 
6
6
  AUTH_USER = '/authorized_user'.freeze
7
7
  AUTH_USER_WITH_UI_CONFIG = '/user/authorized_user_with_ui_config'.freeze
@@ -1,7 +1,7 @@
1
1
  module PlentyClient
2
2
  module Basket
3
- extend PlentyClient::Endpoint
4
- extend PlentyClient::Request
3
+ include PlentyClient::Endpoint
4
+ include PlentyClient::Request
5
5
 
6
6
  FIND_BASKET = '/basket'.freeze
7
7
 
@@ -1,8 +1,8 @@
1
1
  module PlentyClient
2
2
  module Basket
3
3
  class Item
4
- extend PlentyClient::Endpoint
5
- extend PlentyClient::Request
4
+ include PlentyClient::Endpoint
5
+ include PlentyClient::Request
6
6
 
7
7
  CREATE_BASKET_ITEM = '/basket/items'.freeze
8
8
  LIST_BASKET_ITEMS = '/basket/items'.freeze
@@ -1,7 +1,7 @@
1
1
  module PlentyClient
2
2
  module Category
3
- extend PlentyClient::Endpoint
4
- extend PlentyClient::Request
3
+ include PlentyClient::Endpoint
4
+ include PlentyClient::Request
5
5
 
6
6
  FIND_CATEGORY = '/categories/{catId}'.freeze
7
7
  LIST_CATEGORIES = '/categories'.freeze
@@ -26,23 +26,22 @@ module PlentyClient
26
26
  end
27
27
 
28
28
  def update(cat_id, body = {})
29
- post(build_endpoint(UPDATE_CATEGORY,
30
- cat: cat_id), body)
29
+ post(build_endpoint(UPDATE_CATEGORY, cat: cat_id), body)
31
30
  end
32
31
 
33
32
  def update_all(body = {})
34
33
  post(build_endpoint(UPDATE_CATEGORIES), body)
35
34
  end
36
35
 
37
- def delete(cat_id, body = {})
36
+ def destroy(cat_id, body = {})
38
37
  delete(build_endpoint(DELETE_CATEGORY, cat: cat_id), body)
39
38
  end
40
39
 
41
- def delete_details(cat_id, body = {})
40
+ def destroy_details(cat_id, body = {})
42
41
  delete(build_endpoint(DELETE_CATEGORY_DETAILS, cat: cat_id), body)
43
42
  end
44
43
 
45
- def delete_clients(cat_id, body = {})
44
+ def destroy_clients(cat_id, body = {})
46
45
  delete(build_endpoint(DELETE_CATEGORY_CLIENTS, cat: cat_id), body)
47
46
  end
48
47
  end
@@ -1,8 +1,8 @@
1
1
  module PlentyClient
2
2
  module Category
3
3
  class Branch
4
- extend PlentyClient::Endpoint
5
- extend PlentyClient::Request
4
+ include PlentyClient::Endpoint
5
+ include PlentyClient::Request
6
6
 
7
7
  FIND_CATEGORY_BRANCH = '/category_branches/{catId}'.freeze
8
8
  LIST_CATEGORY_BRANCH = '/category_branches'.freeze
@@ -1,8 +1,8 @@
1
1
  module PlentyClient
2
2
  module Category
3
3
  class Template
4
- extend PlentyClient::Endpoint
5
- extend PlentyClient::Request
4
+ include PlentyClient::Endpoint
5
+ include PlentyClient::Request
6
6
 
7
7
  FIND_CATEGORY_TEMPLATE = '/categories/{catId}/templates'.freeze
8
8
  UPDATE_CATEGORY_TEMPLATE = '/categories/{catId}/templates'.freeze
@@ -19,7 +19,7 @@ module PlentyClient
19
19
  cat: cat_id), body)
20
20
  end
21
21
 
22
- def delete(cat_id, body = {})
22
+ def destroy(cat_id, body = {})
23
23
  delete(build_endpoint(DELETE_CATEGORY_TEMPLATE,
24
24
  cat: cat_id), body)
25
25
  end
@@ -1,7 +1,7 @@
1
1
  module PlentyClient
2
2
  module Comment
3
- extend PlentyClient::Endpoint
4
- extend PlentyClient::Request
3
+ include PlentyClient::Endpoint
4
+ include PlentyClient::Request
5
5
 
6
6
  FIND_COMMENT = '/comments/{commentId}'.freeze
7
7
  LIST_COMMENTS = '/comments/{referenceType}/{referenceValue}'.freeze
@@ -23,7 +23,7 @@ module PlentyClient
23
23
  post(CREATE_CATEGORY, body)
24
24
  end
25
25
 
26
- def delete(cat_id, body = {})
26
+ def destroy(cat_id, body = {})
27
27
  delete(build_endpoint(DELETE_CATEGORY, comment: cat_id), body)
28
28
  end
29
29
  end
@@ -2,13 +2,15 @@ module PlentyClient
2
2
  class Config
3
3
  class NoCredentials < StandardError; end
4
4
  class NoToken < StandardError; end
5
+ class NoPlentyId < StandardError; end
5
6
 
6
7
  class << self
7
- attr_accessor :site_url, :api_user, :api_password, :access_token, :refresh_token, :log
8
+ attr_accessor :site_url, :api_user, :api_password, :access_token, :refresh_token, :log, :expiry_date, :plenty_id
8
9
 
9
10
  def validate
10
11
  raise NoCredentials if site_url.nil? || api_user.nil? || api_password.nil?
11
12
  raise NoToken if access_token.nil? || refresh_token.nil?
13
+ raise NoPlentyId if plenty_id.blank?
12
14
  end
13
15
  end
14
16
  end
@@ -1,77 +1,83 @@
1
1
  module PlentyClient
2
2
  module Endpoint
3
- # Method that replaces the arguments in an endpoint with the given parameters.
4
- # Arguments that are passed to the build_endpoint method, but do not
5
- # live in the endpoint, are discarded.
6
- def build_endpoint(api_endpoint_template, arguments = {})
7
- # Duplicate constant to temporary endpoint string
8
- api_endpoint_result = api_endpoint_template.dup
9
- # Endpoint parameters hash that links symbols to regex
10
- endpoint_parameters = {
11
- account: /\{accountId\}/,
12
- account_ype: /\{accountType\}/,
13
- attribute: /\{attributeId\}/,
14
- attribute_value: /\{attributeValueId\}/,
15
- barcode: /\{barcodeId\}/,
16
- bundle: /\{bundleId\}/,
17
- cat: /\{catId\}/,
18
- commission: /\{commissionId\}/,
19
- component: /\{componentId\}/,
20
- comment: /\{commentId\}/,
21
- contact: /\{contactId\}/,
22
- country: /\{countryId\}/,
23
- coupon_string: /\{coupon\}/,
24
- cross_item: /\{crossItemId\}/,
25
- currency: /\{currencyIso\}/,
26
- customer_class: /\{customerClassId\}/,
27
- image: /\{imageId\}/,
28
- item: /\{itemId\}/,
29
- item_set: /\{itemSetId\}/,
30
- lang: /\{lang\}/,
31
- location: /\{locationId\}/,
32
- manufacturer: /\{manufacturerId\}/,
33
- market: /\{marketId\}/,
34
- market_ident_number: /\{marketIdentNumberId\}/,
35
- marketplace: /\{marketplaceId\}/,
36
- order: /\{orderId\}/,
37
- order_item: /\{orderItemId\}/,
38
- parent_referrer: /\{parentReferrerId\}/,
39
- plenty: /\{plentyId\}/,
40
- preset: /\{presetId\}/,
41
- price: /\{priceId\}/,
42
- property_group: /\{propertyGroupId\}/,
43
- property: /\{propertyId\}/,
44
- referrer: /\{referrerId\}/,
45
- reference_type: /\{referenceType\}/,
46
- reference_value: /\{referenceValue\}/,
47
- sales_price: /\{salesPriceId\}/,
48
- shipping_profile: /\{shippingProfileId\}/,
49
- shipping_package: /\{orderShippingPackageId\}/,
50
- shipping_service_provider: /\{shippingServiceProviderID\}/,
51
- sku: /\{skuId\}/,
52
- type: /\{typeId\}/,
53
- type_string: /\{type\}/,
54
- unit: /\{unitId\}/,
55
- value: /\{valueId\}/,
56
- variation: /\{variationId\}/,
57
- variation_supplier: /\{variationSupplierId\}/,
58
- warehouse: /\{warehouseId\}/,
59
- webstore: /\{webstoreId\}/
60
- }
61
- # Loop over the given argument symbols, retrieve the corresponding regex
62
- # and replace the argument with the corresponding value.
63
- arguments.each do |k, v|
64
- api_endpoint_result.gsub!(endpoint_parameters.fetch(k), v.to_s)
3
+ module ClassMethods
4
+ # Method that replaces the arguments in an endpoint with the given parameters.
5
+ # Arguments that are passed to the build_endpoint method, but do not
6
+ # live in the endpoint, are discarded.
7
+ def build_endpoint(api_endpoint_template, arguments = {})
8
+ # Duplicate constant to temporary endpoint string
9
+ api_endpoint_result = api_endpoint_template.dup
10
+ # Endpoint parameters hash that links symbols to regex
11
+ endpoint_parameters = {
12
+ account: /\{accountId\}/,
13
+ account_ype: /\{accountType\}/,
14
+ attribute: /\{attributeId\}/,
15
+ attribute_value: /\{attributeValueId\}/,
16
+ barcode: /\{barcodeId\}/,
17
+ bundle: /\{bundleId\}/,
18
+ cat: /\{catId\}/,
19
+ commission: /\{commissionId\}/,
20
+ component: /\{componentId\}/,
21
+ comment: /\{commentId\}/,
22
+ contact: /\{contactId\}/,
23
+ country: /\{countryId\}/,
24
+ coupon_string: /\{coupon\}/,
25
+ cross_item: /\{crossItemId\}/,
26
+ currency: /\{currencyIso\}/,
27
+ customer_class: /\{customerClassId\}/,
28
+ image: /\{imageId\}/,
29
+ item: /\{itemId\}/,
30
+ item_set: /\{itemSetId\}/,
31
+ lang: /\{lang\}/,
32
+ location: /\{locationId\}/,
33
+ manufacturer: /\{manufacturerId\}/,
34
+ market: /\{marketId\}/,
35
+ market_ident_number: /\{marketIdentNumberId\}/,
36
+ marketplace: /\{marketplaceId\}/,
37
+ order: /\{orderId\}/,
38
+ order_item: /\{orderItemId\}/,
39
+ parent_referrer: /\{parentReferrerId\}/,
40
+ plenty: /\{plentyId\}/,
41
+ preset: /\{presetId\}/,
42
+ price: /\{priceId\}/,
43
+ property_group: /\{propertyGroupId\}/,
44
+ property: /\{propertyId\}/,
45
+ referrer: /\{referrerId\}/,
46
+ reference_type: /\{referenceType\}/,
47
+ reference_value: /\{referenceValue\}/,
48
+ sales_price: /\{salesPriceId\}/,
49
+ shipping_profile: /\{shippingProfileId\}/,
50
+ shipping_package: /\{orderShippingPackageId\}/,
51
+ shipping_service_provider: /\{shippingServiceProviderID\}/,
52
+ sku: /\{skuId\}/,
53
+ type: /\{typeId\}/,
54
+ type_string: /\{type\}/,
55
+ unit: /\{unitId\}/,
56
+ value: /\{valueId\}/,
57
+ variation: /\{variationId\}/,
58
+ variation_supplier: /\{variationSupplierId\}/,
59
+ warehouse: /\{warehouseId\}/,
60
+ webstore: /\{webstoreId\}/
61
+ }
62
+ # Loop over the given argument symbols, retrieve the corresponding regex
63
+ # and replace the argument with the corresponding value.
64
+ arguments.each do |k, v|
65
+ api_endpoint_result.gsub!(endpoint_parameters.fetch(k), v.to_s)
66
+ end
67
+
68
+ api_endpoint_result
65
69
  end
66
70
 
67
- api_endpoint_result
71
+ def routes
72
+ # Prints all available routes with their values in the given module
73
+ constants.each do |const|
74
+ puts "#{const}: \t #{const_get(const)}" if const.to_s.upcase!.nil?
75
+ end
76
+ end
68
77
  end
69
78
 
70
- def routes
71
- # Prints all available routes with their values in the given module
72
- constants.each do |const|
73
- puts "#{const}: \t #{const_get(const)}" if const.to_s.upcase!.nil?
74
- end
79
+ def self.included(base)
80
+ base.extend(ClassMethods)
75
81
  end
76
82
  end
77
83
  end