plenty_client 0.0.9 → 0.1.0

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 (124) hide show
  1. checksums.yaml +5 -5
  2. data/lib/plenty_client/account/address.rb +37 -0
  3. data/lib/plenty_client/account/contact/address.rb +8 -6
  4. data/lib/plenty_client/account/contact/bank.rb +7 -5
  5. data/lib/plenty_client/account/contact/type.rb +7 -5
  6. data/lib/plenty_client/account/contact.rb +7 -5
  7. data/lib/plenty_client/account.rb +11 -9
  8. data/lib/plenty_client/accounting.rb +6 -4
  9. data/lib/plenty_client/authentication.rb +7 -5
  10. data/lib/plenty_client/authorization.rb +4 -2
  11. data/lib/plenty_client/basket/item.rb +4 -2
  12. data/lib/plenty_client/basket.rb +3 -1
  13. data/lib/plenty_client/category/branch.rb +4 -2
  14. data/lib/plenty_client/category/template.rb +5 -3
  15. data/lib/plenty_client/category.rb +12 -10
  16. data/lib/plenty_client/comment.rb +8 -6
  17. data/lib/plenty_client/config.rb +6 -0
  18. data/lib/plenty_client/document/category.rb +6 -4
  19. data/lib/plenty_client/document/order.rb +7 -5
  20. data/lib/plenty_client/document.rb +4 -2
  21. data/lib/plenty_client/endpoint.rb +1 -1
  22. data/lib/plenty_client/item/attribute/name.rb +8 -6
  23. data/lib/plenty_client/item/attribute/value.rb +8 -6
  24. data/lib/plenty_client/item/attribute/value_name.rb +8 -6
  25. data/lib/plenty_client/item/attribute.rb +7 -5
  26. data/lib/plenty_client/item/barcode.rb +11 -9
  27. data/lib/plenty_client/item/cross_selling.rb +5 -3
  28. data/lib/plenty_client/item/image/availability.rb +6 -4
  29. data/lib/plenty_client/item/image/name.rb +8 -6
  30. data/lib/plenty_client/item/image.rb +15 -12
  31. data/lib/plenty_client/item/manufacturer/commission.rb +8 -6
  32. data/lib/plenty_client/item/manufacturer.rb +7 -5
  33. data/lib/plenty_client/item/property/market_reference.rb +8 -6
  34. data/lib/plenty_client/item/property/name.rb +8 -6
  35. data/lib/plenty_client/item/property.rb +7 -5
  36. data/lib/plenty_client/item/property_group.rb +7 -5
  37. data/lib/plenty_client/item/property_group_name.rb +8 -6
  38. data/lib/plenty_client/item/sales_price.rb +7 -5
  39. data/lib/plenty_client/item/shipping_profile.rb +5 -3
  40. data/lib/plenty_client/item/unit.rb +7 -5
  41. data/lib/plenty_client/item/unit_name.rb +7 -5
  42. data/lib/plenty_client/item/variation/barcode.rb +3 -1
  43. data/lib/plenty_client/item/variation/bundle.rb +8 -6
  44. data/lib/plenty_client/item/variation/category.rb +14 -6
  45. data/lib/plenty_client/item/variation/client.rb +6 -4
  46. data/lib/plenty_client/item/variation/default_category.rb +7 -5
  47. data/lib/plenty_client/item/variation/description.rb +8 -6
  48. data/lib/plenty_client/item/variation/image.rb +8 -6
  49. data/lib/plenty_client/item/variation/market.rb +6 -4
  50. data/lib/plenty_client/item/variation/market_ident_number.rb +8 -6
  51. data/lib/plenty_client/item/variation/property/text.rb +8 -6
  52. data/lib/plenty_client/item/variation/property.rb +22 -17
  53. data/lib/plenty_client/item/variation/sales_price.rb +15 -19
  54. data/lib/plenty_client/item/variation/sku.rb +8 -6
  55. data/lib/plenty_client/item/variation/stock.rb +9 -7
  56. data/lib/plenty_client/item/variation/supplier.rb +8 -6
  57. data/lib/plenty_client/item/variation/warehouse.rb +8 -6
  58. data/lib/plenty_client/item/variation.rb +8 -6
  59. data/lib/plenty_client/item.rb +11 -4
  60. data/lib/plenty_client/item_set/component.rb +9 -7
  61. data/lib/plenty_client/item_set/config.rb +4 -2
  62. data/lib/plenty_client/item_set.rb +9 -7
  63. data/lib/plenty_client/listing/layout_template.rb +5 -3
  64. data/lib/plenty_client/listing/market/directory.rb +6 -4
  65. data/lib/plenty_client/listing/market/history.rb +7 -5
  66. data/lib/plenty_client/listing/market/info.rb +3 -1
  67. data/lib/plenty_client/listing/market/text.rb +7 -5
  68. data/lib/plenty_client/listing/market.rb +9 -7
  69. data/lib/plenty_client/listing/option_template.rb +7 -5
  70. data/lib/plenty_client/listing/shipping_profile.rb +4 -2
  71. data/lib/plenty_client/listing/stock_dependence_type.rb +4 -2
  72. data/lib/plenty_client/listing/type.rb +4 -2
  73. data/lib/plenty_client/listing.rb +7 -5
  74. data/lib/plenty_client/market/credentials.rb +7 -5
  75. data/lib/plenty_client/market/ebay/authentication.rb +4 -2
  76. data/lib/plenty_client/market/ebay/parts_fitment.rb +8 -6
  77. data/lib/plenty_client/market/ebay/shop_category.rb +3 -1
  78. data/lib/plenty_client/order/contact_wish.rb +4 -2
  79. data/lib/plenty_client/order/coupon_code/contact.rb +3 -1
  80. data/lib/plenty_client/order/coupon_code/validation.rb +3 -1
  81. data/lib/plenty_client/order/coupon_code.rb +3 -1
  82. data/lib/plenty_client/order/currency.rb +6 -4
  83. data/lib/plenty_client/order/date.rb +6 -4
  84. data/lib/plenty_client/order/item/serial_number.rb +4 -2
  85. data/lib/plenty_client/order/item.rb +3 -1
  86. data/lib/plenty_client/order/referrer.rb +4 -2
  87. data/lib/plenty_client/order/shipping/country.rb +3 -1
  88. data/lib/plenty_client/order/shipping/information.rb +12 -17
  89. data/lib/plenty_client/order/shipping/package.rb +9 -7
  90. data/lib/plenty_client/order/shipping/profile.rb +4 -2
  91. data/lib/plenty_client/order/shipping/service_provider.rb +5 -3
  92. data/lib/plenty_client/order/status_history.rb +23 -0
  93. data/lib/plenty_client/order.rb +9 -7
  94. data/lib/plenty_client/order_summary.rb +9 -7
  95. data/lib/plenty_client/payment/contact.rb +4 -2
  96. data/lib/plenty_client/payment/method.rb +10 -8
  97. data/lib/plenty_client/payment/method_name.rb +5 -3
  98. data/lib/plenty_client/payment/order.rb +5 -3
  99. data/lib/plenty_client/payment/property/type/name.rb +7 -5
  100. data/lib/plenty_client/payment/property/type.rb +7 -5
  101. data/lib/plenty_client/payment/property.rb +9 -7
  102. data/lib/plenty_client/payment/status.rb +3 -1
  103. data/lib/plenty_client/payment/transaction.rb +3 -1
  104. data/lib/plenty_client/payment.rb +8 -6
  105. data/lib/plenty_client/request.rb +54 -24
  106. data/lib/plenty_client/sales_price/account.rb +5 -3
  107. data/lib/plenty_client/sales_price/country.rb +5 -3
  108. data/lib/plenty_client/sales_price/currency.rb +5 -3
  109. data/lib/plenty_client/sales_price/customer_class.rb +6 -4
  110. data/lib/plenty_client/sales_price/name.rb +7 -5
  111. data/lib/plenty_client/sales_price/online_store.rb +5 -3
  112. data/lib/plenty_client/sales_price/referrer.rb +5 -3
  113. data/lib/plenty_client/stock.rb +5 -3
  114. data/lib/plenty_client/ticket.rb +6 -4
  115. data/lib/plenty_client/version.rb +3 -1
  116. data/lib/plenty_client/warehouse/management/rack.rb +6 -4
  117. data/lib/plenty_client/warehouse/management/shelf.rb +6 -4
  118. data/lib/plenty_client/warehouse/management/storage_location.rb +6 -4
  119. data/lib/plenty_client/warehouse/management.rb +21 -5
  120. data/lib/plenty_client/warehouse/stock.rb +8 -6
  121. data/lib/plenty_client/warehouse.rb +5 -3
  122. data/lib/plenty_client/webstore.rb +3 -1
  123. data/lib/plenty_client.rb +5 -1
  124. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 86a5e966bba8371285b7cad4133b88fa134d9052
4
- data.tar.gz: 3aab5ff85d50385bb7e177abab7f021216c06080
2
+ SHA256:
3
+ metadata.gz: b6ff37ac81ad08b66efcf7d3bf22de8bd7c044f63e9075049cfa12e48e79e67d
4
+ data.tar.gz: 32bcc7518200db454ff6723807e4f895669a6a96bbc3855376a90b2af23aa965
5
5
  SHA512:
6
- metadata.gz: 3b4cb9248775611a01e6217bf619f09fbb088f24f0e1efeff24c2da1835bddf82efc07d08793c75e6792990761d60c19cb2d091c705b525778dd5b1a176954a0
7
- data.tar.gz: 674cd9975e122d9f0add698a32cbcfaa343e91c9d34c8a3a6de6979f2b797b6a988249fb08cca49c15dd3e6ee5ff80449522e47ba72091c93ed9ad3dd31479b3
6
+ metadata.gz: a544191236f9de2a8ea7b57e50015e73ade83a0fde9225844a71308439151ffb9121dd1681fbe8fe4616f130c008f3e10057bcd2f3e348cf0c823bb6167a6297
7
+ data.tar.gz: 1b02c33c9ca78d69435186cccf3851c4e2cc02d75cd9d66a83c6a6d9685d0b68e85afbcf516e26b9f7a217a061daf24e63fa25840365f16a281414159316a583
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlentyClient
4
+ module Account
5
+ class Address
6
+ include PlentyClient::Endpoint
7
+ include PlentyClient::Request
8
+
9
+ ACCOUNT_ADDRESS_BASE_PATH = '/accounts/addresses'
10
+ SINGLE_ADDRESS_SUFFIX = '/{addressId}'
11
+
12
+ class << self
13
+ def find(address_id, headers = {})
14
+ get(url(address_id), headers)
15
+ end
16
+
17
+ def create(headers = {})
18
+ post(build_endpoint(ACCOUNT_ADDRESS_BASE_PATH), headers)
19
+ end
20
+
21
+ def update(address_id, headers = {})
22
+ put(url(address_id), headers)
23
+ end
24
+
25
+ def destroy(address_id, headers = {})
26
+ delete(url(address_id), headers)
27
+ end
28
+
29
+ private
30
+
31
+ def url(address_id)
32
+ build_endpoint(ACCOUNT_ADDRESS_BASE_PATH + SINGLE_ADDRESS_SUFFIX, address: address_id)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Account
3
5
  module Contact
@@ -5,13 +7,13 @@ module PlentyClient
5
7
  include PlentyClient::Endpoint
6
8
  include PlentyClient::Request
7
9
 
8
- CONTACT_ADDRESS_BASE_PATH = '/accounts/contacts/{contactId}'.freeze
10
+ CONTACT_ADDRESS_BASE_PATH = '/accounts/contacts/{contactId}'
9
11
 
10
- LIST_A_CONTACT_ADDRESSES = '/addresses/{addressTypeId}'.freeze
11
- CREATE_A_CONTACT_ADDRESS = '/addresses'.freeze
12
- UPDATE_A_CONTACT_ADDRESS = '/addresses/{addressId}'.freeze
13
- DELETE_A_CONTACT_ADDRESS = '/addresses/{addressId}'.freeze
14
- SET_PRIMARY_CONTACT_ADDRESS = '/addresses/{addressId}/types/{addressTypeId}/primary'.freeze
12
+ LIST_A_CONTACT_ADDRESSES = '/addresses/{addressTypeId}'
13
+ CREATE_A_CONTACT_ADDRESS = '/addresses'
14
+ UPDATE_A_CONTACT_ADDRESS = '/addresses/{addressId}'
15
+ DELETE_A_CONTACT_ADDRESS = '/addresses/{addressId}'
16
+ SET_PRIMARY_CONTACT_ADDRESS = '/addresses/{addressId}/types/{addressTypeId}/primary'
15
17
 
16
18
  class << self
17
19
  def list(contact_id, address_type = '', headers = {}, &block)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Account
3
5
  module Contact
@@ -5,11 +7,11 @@ module PlentyClient
5
7
  include PlentyClient::Endpoint
6
8
  include PlentyClient::Request
7
9
 
8
- LIST_A_CONTACT_PAYMENTS = '/accounts/contacts/{contactId}/banks'.freeze
9
- FIND_A_CONTACT_PAYMENT = '/accounts/contacts/banks/{contactBankId}'.freeze
10
- CREATE_A_CONTACT_PAYMENT = '/accounts/contacts/banks'.freeze
11
- UPDATE_A_CONTACT_PAYMENT = '/accounts/contacts/banks/{contactBankId}'.freeze
12
- DELETE_A_CONTACT_PAYMENT = '/accounts/contacts/banks/{contactBankId}'.freeze
10
+ LIST_A_CONTACT_PAYMENTS = '/accounts/contacts/{contactId}/banks'
11
+ FIND_A_CONTACT_PAYMENT = '/accounts/contacts/banks/{contactBankId}'
12
+ CREATE_A_CONTACT_PAYMENT = '/accounts/contacts/banks'
13
+ UPDATE_A_CONTACT_PAYMENT = '/accounts/contacts/banks/{contactBankId}'
14
+ DELETE_A_CONTACT_PAYMENT = '/accounts/contacts/banks/{contactBankId}'
13
15
 
14
16
  class << self
15
17
  def list(contact_id, headers = {}, &block)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Account
3
5
  module Contact
@@ -5,11 +7,11 @@ module PlentyClient
5
7
  include PlentyClient::Endpoint
6
8
  include PlentyClient::Request
7
9
 
8
- LIST_A_CONTACT_TYPES = '/accounts/contacts/types'.freeze
9
- FIND_A_CONTACT_TYPE = '/accounts/contacts/types/{typeId}'.freeze
10
- CREATE_A_CONTACT_TYPE = '/accounts/contacts/types'.freeze
11
- UPDATE_A_CONTACT_TYPE = '/accounts/contacts/types/{typeId}'.freeze
12
- DELETE_A_CONTACT_TYPE = '/accounts/contacts/types/{typeId}'.freeze
10
+ LIST_A_CONTACT_TYPES = '/accounts/contacts/types'
11
+ FIND_A_CONTACT_TYPE = '/accounts/contacts/types/{typeId}'
12
+ CREATE_A_CONTACT_TYPE = '/accounts/contacts/types'
13
+ UPDATE_A_CONTACT_TYPE = '/accounts/contacts/types/{typeId}'
14
+ DELETE_A_CONTACT_TYPE = '/accounts/contacts/types/{typeId}'
13
15
 
14
16
  class << self
15
17
  def list(headers = {}, &block)
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Account
3
5
  module Contact
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- LIST_A_CONTACTS = '/accounts/contacts'.freeze
8
- FIND_A_CONTACT = '/accounts/contacts/{contactId}'.freeze
9
- CREATE_A_CONTACT = '/accounts/contacts'.freeze
10
- UPDATE_A_CONTACT = '/accounts/contacts/{contactId}'.freeze
11
- DELETE_A_CONTACT = '/accounts/contacts/{contactId}'.freeze
9
+ LIST_A_CONTACTS = '/accounts/contacts'
10
+ FIND_A_CONTACT = '/accounts/contacts/{contactId}'
11
+ CREATE_A_CONTACT = '/accounts/contacts'
12
+ UPDATE_A_CONTACT = '/accounts/contacts/{contactId}'
13
+ DELETE_A_CONTACT = '/accounts/contacts/{contactId}'
12
14
 
13
15
  class << self
14
16
  def list(headers = {}, &block)
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Account
3
5
  include PlentyClient::Endpoint
4
6
  include PlentyClient::Request
5
7
 
6
- LIST_ACCOUNTS = '/accounts'.freeze
7
- FIND_ACCOUNT = '/accounts/{accountId}'.freeze
8
- CREATE_ACCOUNT = '/accounts'.freeze
9
- UPDATE_ACCOUNT = '/accounts/{accountId}'.freeze
10
- DELETE_ACCOUNT = '/accounts/{accountId}'.freeze
11
- LIST_ACCOUNTS_CONTACTS = '/accounts/{accountId}/contacts'.freeze
8
+ LIST_ACCOUNTS = '/accounts'
9
+ FIND_ACCOUNT = '/accounts/{accountId}'
10
+ CREATE_ACCOUNT = '/accounts'
11
+ UPDATE_ACCOUNT = '/accounts/{accountId}'
12
+ DELETE_ACCOUNT = '/accounts/{accountId}'
13
+ LIST_ACCOUNTS_CONTACTS = '/accounts/{accountId}/contacts'
12
14
 
13
- ACCOUNT_LOGIN = '/account/login'.freeze
14
- ACCOUNT_REFRESH = '/account/login/refresh'.freeze
15
- ACCOUNT_LOGOUT = '/account/logout'.freeze
15
+ ACCOUNT_LOGIN = '/account/login'
16
+ ACCOUNT_REFRESH = '/account/login/refresh'
17
+ ACCOUNT_LOGOUT = '/account/logout'
16
18
 
17
19
  class << self
18
20
  def list(headers = {}, &block)
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Accounting
3
5
  include PlentyClient::Endpoint
4
6
  include PlentyClient::Request
5
7
 
6
- LIST_VAT_OF_LOCATION = '/vat/locations/{locationId}'.freeze
7
- LIST_VAT_OF_COUNTRY = '/vat/locations/{locationId}/countries/{countryId}'.freeze
8
- LIST_VAT_CONFIGURATIONS = '/vat'.freeze
9
- LIST_VAT_STANDARD = '/vat/standard'.freeze
8
+ LIST_VAT_OF_LOCATION = '/vat/locations/{locationId}'
9
+ LIST_VAT_OF_COUNTRY = '/vat/locations/{locationId}/countries/{countryId}'
10
+ LIST_VAT_CONFIGURATIONS = '/vat'
11
+ LIST_VAT_STANDARD = '/vat/standard'
10
12
 
11
13
  class << self
12
14
  def list(headers = {}, &block)
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Authentication
3
5
  include PlentyClient::Endpoint
4
6
  include PlentyClient::Request
5
7
 
6
- AUTH_LOGIN = '/login'.freeze
7
- AUTH_REFRESH = '/login/refresh'.freeze
8
- AUTH_TOKEN = '/oauth/access_token'.freeze
9
- AUTH_LOGOUT = '/logout'.freeze
10
- AUTH_CLIENT = '/client-login'.freeze
8
+ AUTH_LOGIN = '/login'
9
+ AUTH_REFRESH = '/login/refresh'
10
+ AUTH_TOKEN = '/oauth/access_token'
11
+ AUTH_LOGOUT = '/logout'
12
+ AUTH_CLIENT = '/client-login'
11
13
 
12
14
  class << self
13
15
  def access_token(headers = {}, &block)
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Authorization
3
5
  include PlentyClient::Endpoint
4
6
  include PlentyClient::Request
5
7
 
6
- AUTH_USER = '/authorized_user'.freeze
7
- AUTH_USER_WITH_UI_CONFIG = '/user/authorized_user_with_ui_config'.freeze
8
+ AUTH_USER = '/authorized_user'
9
+ AUTH_USER_WITH_UI_CONFIG = '/user/authorized_user_with_ui_config'
8
10
 
9
11
  class << self
10
12
  def list(headers = {}, &block)
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Basket
3
5
  class Item
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- CREATE_BASKET_ITEM = '/basket/items'.freeze
8
- LIST_BASKET_ITEMS = '/basket/items'.freeze
9
+ CREATE_BASKET_ITEM = '/basket/items'
10
+ LIST_BASKET_ITEMS = '/basket/items'
9
11
 
10
12
  class << self
11
13
  def list(headers = {}, &block)
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Basket
3
5
  include PlentyClient::Endpoint
4
6
  include PlentyClient::Request
5
7
 
6
- FIND_BASKET = '/basket'.freeze
8
+ FIND_BASKET = '/basket'
7
9
 
8
10
  class << self
9
11
  def find(headers = {}, &block)
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Category
3
5
  class Branch
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- FIND_CATEGORY_BRANCH = '/category_branches/{catId}'.freeze
8
- LIST_CATEGORY_BRANCH = '/category_branches'.freeze
9
+ FIND_CATEGORY_BRANCH = '/category_branches/{catId}'
10
+ LIST_CATEGORY_BRANCH = '/category_branches'
9
11
 
10
12
  class << self
11
13
  def list(headers = {}, &block)
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Category
3
5
  class Template
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- FIND_CATEGORY_TEMPLATE = '/categories/{catId}/templates'.freeze
8
- UPDATE_CATEGORY_TEMPLATE = '/categories/{catId}/templates'.freeze
9
- DELETE_CATEGORY_TEMPLATE = '/categories/{catId}/templates'.freeze
9
+ FIND_CATEGORY_TEMPLATE = '/categories/{catId}/templates'
10
+ UPDATE_CATEGORY_TEMPLATE = '/categories/{catId}/templates'
11
+ DELETE_CATEGORY_TEMPLATE = '/categories/{catId}/templates'
10
12
 
11
13
  class << self
12
14
  def list(cat_id, headers = {}, &block)
@@ -1,16 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Category
3
5
  include PlentyClient::Endpoint
4
6
  include PlentyClient::Request
5
7
 
6
- FIND_CATEGORY = '/categories/{catId}'.freeze
7
- LIST_CATEGORIES = '/categories'.freeze
8
- CREATE_CATEGORY = '/categories'.freeze
9
- UPDATE_CATEGORY = '/categories/{catId}'.freeze
10
- UPDATE_CATEGORIES = '/categories'.freeze
11
- DELETE_CATEGORY = '/categories/{catId}'.freeze
12
- DELETE_CATEGORY_DETAILS = '/categories/{catId}/details'.freeze
13
- DELETE_CATEGORY_CLIENTS = '/categories/{catId}/clients'.freeze
8
+ FIND_CATEGORY = '/categories/{catId}'
9
+ LIST_CATEGORIES = '/categories'
10
+ CREATE_CATEGORY = '/categories'
11
+ UPDATE_CATEGORY = '/categories/{catId}'
12
+ UPDATE_CATEGORIES = '/categories'
13
+ DELETE_CATEGORY = '/categories/{catId}'
14
+ DELETE_CATEGORY_DETAILS = '/categories/{catId}/details'
15
+ DELETE_CATEGORY_CLIENTS = '/categories/{catId}/clients'
14
16
 
15
17
  class << self
16
18
  def list(headers = {}, &block)
@@ -26,11 +28,11 @@ module PlentyClient
26
28
  end
27
29
 
28
30
  def update(cat_id, body = {})
29
- post(build_endpoint(UPDATE_CATEGORY, cat: cat_id), body)
31
+ put(build_endpoint(UPDATE_CATEGORY, cat: cat_id), body)
30
32
  end
31
33
 
32
34
  def update_all(body = {})
33
- post(build_endpoint(UPDATE_CATEGORIES), body)
35
+ put(build_endpoint(UPDATE_CATEGORIES), body)
34
36
  end
35
37
 
36
38
  def destroy(cat_id, body = {})
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Comment
3
5
  include PlentyClient::Endpoint
4
6
  include PlentyClient::Request
5
7
 
6
- FIND_COMMENT = '/comments/{commentId}'.freeze
7
- LIST_COMMENTS = '/comments/{referenceType}/{referenceValue}'.freeze
8
- CREATE_COMMENT = '/comments'.freeze
9
- DELETE_COMMENT = '/comments/{commentId}'.freeze
8
+ FIND_COMMENT = '/comments/{commentId}'
9
+ LIST_COMMENTS = '/comments/{referenceType}/{referenceValue}'
10
+ CREATE_COMMENT = '/comments'
11
+ DELETE_COMMENT = '/comments/{commentId}'
10
12
 
11
13
  class << self
12
14
  def list(reference_type, reference_value, headers = {}, &block)
@@ -20,11 +22,11 @@ module PlentyClient
20
22
  end
21
23
 
22
24
  def create(body = {})
23
- post(CREATE_CATEGORY, body)
25
+ post(CREATE_COMMENT, body)
24
26
  end
25
27
 
26
28
  def destroy(cat_id, body = {})
27
- delete(build_endpoint(DELETE_CATEGORY, comment: cat_id), body)
29
+ delete(build_endpoint(DELETE_COMMENT, comment: cat_id), body)
28
30
  end
29
31
  end
30
32
  end
@@ -7,9 +7,11 @@ module PlentyClient
7
7
 
8
8
  # When expiry_date is less than this many seconds from now, it should renew API keys
9
9
  LOGIN_RENEW_BUFFER = 60
10
+ ATTEMPT_COUNT = 3
10
11
 
11
12
  class << self
12
13
  attr_accessor :site_url, :api_user, :api_password, :access_token, :refresh_token, :log, :expiry_date, :plenty_id
14
+ attr_writer :attempt_count
13
15
 
14
16
  def validate_credentials
15
17
  raise NoCredentials if site_url.nil? || api_user.nil? || api_password.nil?
@@ -19,6 +21,10 @@ module PlentyClient
19
21
  !access_token.nil? && !refresh_token.nil?
20
22
  end
21
23
 
24
+ def attempt_count
25
+ @attempt_count || ATTEMPT_COUNT
26
+ end
27
+
22
28
  def tokens_valid?
23
29
  tokens_present? &&
24
30
  expiry_date.instance_of?(Time) &&
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Document
3
5
  class Category
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- DOWNLOAD_CATEGORY_DOCUMENT = '/categories/{categoryId}/documents/downloads'.freeze
8
- LIST_CATEGORY_DOCUMENTS = '/categories/{categoryId}/documents/'.freeze
9
- UPLOAD_CATEGORY_DOCUMENT = '/categories/{categoryId}/documents'.freeze
10
- DELTE_CATEGORY_DOCUMENTS = '/categories/{categoryId}/documents/{documentId}'.freeze
9
+ DOWNLOAD_CATEGORY_DOCUMENT = '/categories/{categoryId}/documents/downloads'
10
+ LIST_CATEGORY_DOCUMENTS = '/categories/{categoryId}/documents/'
11
+ UPLOAD_CATEGORY_DOCUMENT = '/categories/{categoryId}/documents'
12
+ DELTE_CATEGORY_DOCUMENTS = '/categories/{categoryId}/documents/{documentId}'
11
13
 
12
14
  class << self
13
15
  def download(category_id, headers = {}, &block)
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Document
3
5
  class Order
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- DOWNLOAD_ORDERS_DOCUMENTS = '/orders/{orderId}/documents/downloads/{type}'.freeze
8
- DOWNLOAD_ORDER_DOCUMENTS_BY_TYPE = '/orders/documents/downloads/{type}'.freeze
9
- LIST_ORDER_DOCUMENTS = '/orders/{orderId}/documents/{type}'.freeze
10
- LIST_ORDER_DOCUMENTS_BY_TYPE = '/orders/documents/{type}'.freeze
11
- UPLOAD_ORDER_DOCUMENT = '/orders/{orderId}/documents/{type}'.freeze
9
+ DOWNLOAD_ORDERS_DOCUMENTS = '/orders/{orderId}/documents/downloads/{type}'
10
+ DOWNLOAD_ORDER_DOCUMENTS_BY_TYPE = '/orders/documents/downloads/{type}'
11
+ LIST_ORDER_DOCUMENTS = '/orders/{orderId}/documents/{type}'
12
+ LIST_ORDER_DOCUMENTS_BY_TYPE = '/orders/documents/{type}'
13
+ UPLOAD_ORDER_DOCUMENT = '/orders/{orderId}/documents/{type}'
12
14
 
13
15
  class << self
14
16
  def download(order_id, type_string, headers = {}, &block)
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Document
3
5
  include PlentyClient::Endpoint
4
6
  include PlentyClient::Request
5
7
 
6
- DOWNLOAD_DOCUMENT = '/documents/{documentId}'.freeze
8
+ DOWNLOAD_DOCUMENT = '/documents/{documentId}'
7
9
 
8
10
  class << self
9
11
  def download(document_id, headers = {}, &block)
10
- get(build_endpoint(FIND_LISTING, download: document_id), headers, &block)
12
+ get(build_endpoint(DOWNLOAD_DOCUMENT, document: document_id), headers, &block)
11
13
  end
12
14
  end
13
15
  end
@@ -52,7 +52,7 @@ module PlentyClient
52
52
  order_item: /\{orderItemId\}/,
53
53
  order_summary: /\{orderSummaryId\}/,
54
54
  payment: /\{paymentId\}/,
55
- payment_method: /\{paymenMethodId\}/,
55
+ payment_method: /\{paymentMethodId\}/,
56
56
  parent_referrer: /\{parentReferrerId\}/,
57
57
  plenty: /\{plentyId\}/,
58
58
  plugin_key: /\{pluginKey\}/,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Item
3
5
  module Attribute
@@ -5,13 +7,13 @@ module PlentyClient
5
7
  include PlentyClient::Endpoint
6
8
  include PlentyClient::Request
7
9
 
8
- ITEM_ATTRIBUTE_PATH = '/items/attributes'.freeze
10
+ ITEM_ATTRIBUTE_PATH = '/items/attributes'
9
11
 
10
- CREATE_ITEM_ATTRIBUTES = '/{attributeId}/names'.freeze
11
- LIST_ITEM_ATTRIBUTE = '/{attributeId}/names'.freeze
12
- GET_ITEMS_ATTRIBUTE = '/{attributeId}/names/{lang}'.freeze
13
- UPDATE_ITEMS_ATTRIBUTE = '/{attributeId}/names/{lang}'.freeze
14
- DELETE_ITEMS_ATTRIBUTE = '/{attributeId}/names/{lang}'.freeze
12
+ CREATE_ITEM_ATTRIBUTES = '/{attributeId}/names'
13
+ LIST_ITEM_ATTRIBUTE = '/{attributeId}/names'
14
+ GET_ITEMS_ATTRIBUTE = '/{attributeId}/names/{lang}'
15
+ UPDATE_ITEMS_ATTRIBUTE = '/{attributeId}/names/{lang}'
16
+ DELETE_ITEMS_ATTRIBUTE = '/{attributeId}/names/{lang}'
15
17
 
16
18
  class << self
17
19
  def create(attribute_id, headers = {})
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Item
3
5
  module Attribute
@@ -5,13 +7,13 @@ module PlentyClient
5
7
  include PlentyClient::Endpoint
6
8
  include PlentyClient::Request
7
9
 
8
- ITEM_ATTRIBUTE_PATH = '/items/attributes'.freeze
10
+ ITEM_ATTRIBUTE_PATH = '/items/attributes'
9
11
 
10
- CREATE_ITEM_ATTRIBUTE_VALUES = '/{attributeId}/values'.freeze
11
- LIST_ITEM_ATTRIBUTE_VALUE = '/{attributeId}/values'.freeze
12
- GET_ITEMS_ATTRIBUTE_VALUE = '/{attributeId}/values/{valueId}'.freeze
13
- UPDATE_ITEMS_ATTRIBUTE_VALUE = '/{attributeId}/values/{valueId}'.freeze
14
- DELETE_ITEMS_ATTRIBUTE_VALUE = '/{attributeId}/values/{valueId}'.freeze
12
+ CREATE_ITEM_ATTRIBUTE_VALUES = '/{attributeId}/values'
13
+ LIST_ITEM_ATTRIBUTE_VALUE = '/{attributeId}/values'
14
+ GET_ITEMS_ATTRIBUTE_VALUE = '/{attributeId}/values/{valueId}'
15
+ UPDATE_ITEMS_ATTRIBUTE_VALUE = '/{attributeId}/values/{valueId}'
16
+ DELETE_ITEMS_ATTRIBUTE_VALUE = '/{attributeId}/values/{valueId}'
15
17
 
16
18
  class << self
17
19
  def create(attribute_id, body = {})
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Item
3
5
  module Attribute
@@ -5,13 +7,13 @@ module PlentyClient
5
7
  include PlentyClient::Endpoint
6
8
  include PlentyClient::Request
7
9
 
8
- ITEM_ATTRIBUTE_PATH = '/items/attribute_values'.freeze
10
+ ITEM_ATTRIBUTE_PATH = '/items/attribute_values'
9
11
 
10
- CREATE_ITEM_ATTRIBUTE_VALUES = '/{attributeValueId}/names'.freeze
11
- LIST_ITEM_ATTRIBUTE_VALUE = '/{attributeValueId}/names'.freeze
12
- GET_ITEMS_ATTRIBUTE_VALUE = '/{attributeValueId}/names/{lang}'.freeze
13
- UPDATE_ITEMS_ATTRIBUTE_VALUE = '/{attributeValueId}/names/{lang}'.freeze
14
- DELETE_ITEMS_ATTRIBUTE_VALUE = '/{attributeValueId}/names/{lang}'.freeze
12
+ CREATE_ITEM_ATTRIBUTE_VALUES = '/{attributeValueId}/names'
13
+ LIST_ITEM_ATTRIBUTE_VALUE = '/{attributeValueId}/names'
14
+ GET_ITEMS_ATTRIBUTE_VALUE = '/{attributeValueId}/names/{lang}'
15
+ UPDATE_ITEMS_ATTRIBUTE_VALUE = '/{attributeValueId}/names/{lang}'
16
+ DELETE_ITEMS_ATTRIBUTE_VALUE = '/{attributeValueId}/names/{lang}'
15
17
 
16
18
  class << self
17
19
  def create(attribute_value_id, body = {})
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Item
3
5
  module Attribute
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- CREATE_ATTRIBUTE = '/items/attributes'.freeze
8
- LIST_ATTRIBUTES = '/items/attributes'.freeze
9
- GET_ATTRIBUTE = '/items/attributes/{attributeId}'.freeze
10
- UPDATE_ATTRIBUTE = '/items/attributes/{attributeId}'.freeze
11
- DELETE_ATTRIBUTE = '/items/attributes/{attributeId}'.freeze
9
+ CREATE_ATTRIBUTE = '/items/attributes'
10
+ LIST_ATTRIBUTES = '/items/attributes'
11
+ GET_ATTRIBUTE = '/items/attributes/{attributeId}'
12
+ UPDATE_ATTRIBUTE = '/items/attributes/{attributeId}'
13
+ DELETE_ATTRIBUTE = '/items/attributes/{attributeId}'
12
14
 
13
15
  class << self
14
16
  def list(headers = {}, &block)
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Item
3
5
  class Barcode
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- LIST_ALL_BARCODES = '/items/barcodes'.freeze
8
- CREATE_BARCODE = '/items/barcodes'.freeze
9
- GET_BARCODE = '/items/barcodes/{barcodeId}'.freeze
10
- UPDATE_BARCODE = '/items/barcodes/{barcodeId}'.freeze
11
- DELETE_BARCODE = '/items/barcodes/{barcodeId}'.freeze
12
- DEACTIVATE_REFERRER = '/items/barcodes/{barcodeId}/referrer/{referrerId}'.freeze
13
- ACTIVATE_RERERRER = '/items/barcodes/{barcodeId}/referrer'.freeze
14
- LIST_BARCODES_BY_TYPE = '/items/barcodes/type/{type}'.freeze
15
- LIST_BARCODES_BY_REFERRER = '/items/barcodes/referrer/{referrerId}'.freeze
9
+ LIST_ALL_BARCODES = '/items/barcodes'
10
+ CREATE_BARCODE = '/items/barcodes'
11
+ GET_BARCODE = '/items/barcodes/{barcodeId}'
12
+ UPDATE_BARCODE = '/items/barcodes/{barcodeId}'
13
+ DELETE_BARCODE = '/items/barcodes/{barcodeId}'
14
+ DEACTIVATE_REFERRER = '/items/barcodes/{barcodeId}/referrer/{referrerId}'
15
+ ACTIVATE_RERERRER = '/items/barcodes/{barcodeId}/referrer'
16
+ LIST_BARCODES_BY_TYPE = '/items/barcodes/type/{type}'
17
+ LIST_BARCODES_BY_REFERRER = '/items/barcodes/referrer/{referrerId}'
16
18
 
17
19
  class << self
18
20
  def list(headers = {}, &block)
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PlentyClient
2
4
  module Item
3
5
  class CrossSelling
4
6
  include PlentyClient::Endpoint
5
7
  include PlentyClient::Request
6
8
 
7
- CREATE_ITEMS_CROSS_SELLING = '/items/{itemId}/item_cross_selling'.freeze
8
- GET_ITEMS_CROSS_SELLING = '/items/{itemId}/item_cross_selling'.freeze
9
- DELETE_ITEMS_CROSS_SELLING = '/items/{itemId}/item_cross_selling/{crossItemId}'.freeze
9
+ CREATE_ITEMS_CROSS_SELLING = '/items/{itemId}/item_cross_selling'
10
+ GET_ITEMS_CROSS_SELLING = '/items/{itemId}/item_cross_selling'
11
+ DELETE_ITEMS_CROSS_SELLING = '/items/{itemId}/item_cross_selling/{crossItemId}'
10
12
 
11
13
  class << self
12
14
  def create(item_id, headers = {})