plenty_client 0.0.1

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 (85) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +43 -0
  5. data/.travis.yml +5 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +154 -0
  10. data/Rakefile +6 -0
  11. data/lib/plenty_client/config.rb +15 -0
  12. data/lib/plenty_client/constants.rb +362 -0
  13. data/lib/plenty_client/endpoint.rb +73 -0
  14. data/lib/plenty_client/item/attribute/name.rb +52 -0
  15. data/lib/plenty_client/item/attribute/value.rb +52 -0
  16. data/lib/plenty_client/item/attribute/value_name.rb +52 -0
  17. data/lib/plenty_client/item/attribute.rb +36 -0
  18. data/lib/plenty_client/item/barcode.rb +56 -0
  19. data/lib/plenty_client/item/cross_selling.rb +26 -0
  20. data/lib/plenty_client/item/image/availability.rb +37 -0
  21. data/lib/plenty_client/item/image/name.rb +57 -0
  22. data/lib/plenty_client/item/image.rb +53 -0
  23. data/lib/plenty_client/item/manufacturer/commission.rb +52 -0
  24. data/lib/plenty_client/item/manufacturer.rb +36 -0
  25. data/lib/plenty_client/item/property/market_reference.rb +52 -0
  26. data/lib/plenty_client/item/property/name.rb +52 -0
  27. data/lib/plenty_client/item/property.rb +36 -0
  28. data/lib/plenty_client/item/property_group.rb +36 -0
  29. data/lib/plenty_client/item/property_group_name.rb +44 -0
  30. data/lib/plenty_client/item/sales_price.rb +37 -0
  31. data/lib/plenty_client/item/shipping_profile.rb +26 -0
  32. data/lib/plenty_client/item/unit.rb +35 -0
  33. data/lib/plenty_client/item/unit_name.rb +38 -0
  34. data/lib/plenty_client/item/variation/barcode.rb +53 -0
  35. data/lib/plenty_client/item/variation/bundle.rb +52 -0
  36. data/lib/plenty_client/item/variation/category.rb +52 -0
  37. data/lib/plenty_client/item/variation/client.rb +37 -0
  38. data/lib/plenty_client/item/variation/default_category.rb +45 -0
  39. data/lib/plenty_client/item/variation/description.rb +53 -0
  40. data/lib/plenty_client/item/variation/image.rb +49 -0
  41. data/lib/plenty_client/item/variation/market.rb +37 -0
  42. data/lib/plenty_client/item/variation/market_ident_number.rb +53 -0
  43. data/lib/plenty_client/item/variation/sales_price.rb +53 -0
  44. data/lib/plenty_client/item/variation/sku.rb +52 -0
  45. data/lib/plenty_client/item/variation/stock.rb +57 -0
  46. data/lib/plenty_client/item/variation/supplier.rb +52 -0
  47. data/lib/plenty_client/item/variation/warehouse.rb +52 -0
  48. data/lib/plenty_client/item/variation.rb +35 -0
  49. data/lib/plenty_client/item/variation_property.rb +36 -0
  50. data/lib/plenty_client/item/variation_property_value.rb +48 -0
  51. data/lib/plenty_client/item.rb +24 -0
  52. data/lib/plenty_client/item_set/component.rb +54 -0
  53. data/lib/plenty_client/item_set/config.rb +20 -0
  54. data/lib/plenty_client/item_set.rb +44 -0
  55. data/lib/plenty_client/order/contact_wish.rb +17 -0
  56. data/lib/plenty_client/order/coupon_code/contact.rb +20 -0
  57. data/lib/plenty_client/order/coupon_code/validation.rb +20 -0
  58. data/lib/plenty_client/order/coupon_code.rb +19 -0
  59. data/lib/plenty_client/order/currency.rb +32 -0
  60. data/lib/plenty_client/order/date.rb +32 -0
  61. data/lib/plenty_client/order/item/date.rb +20 -0
  62. data/lib/plenty_client/order/item/property.rb +20 -0
  63. data/lib/plenty_client/order/item/serial_number.rb +25 -0
  64. data/lib/plenty_client/order/item.rb +18 -0
  65. data/lib/plenty_client/order/property.rb +21 -0
  66. data/lib/plenty_client/order/referrer.rb +22 -0
  67. data/lib/plenty_client/order/shipping/country.rb +18 -0
  68. data/lib/plenty_client/order/shipping/information.rb +45 -0
  69. data/lib/plenty_client/order/shipping/package.rb +54 -0
  70. data/lib/plenty_client/order/shipping/profile.rb +23 -0
  71. data/lib/plenty_client/order/shipping/service_provider.rb +27 -0
  72. data/lib/plenty_client/order/shipping.rb +12 -0
  73. data/lib/plenty_client/order.rb +43 -0
  74. data/lib/plenty_client/request.rb +128 -0
  75. data/lib/plenty_client/sales_price/account.rb +30 -0
  76. data/lib/plenty_client/sales_price/country.rb +26 -0
  77. data/lib/plenty_client/sales_price/currency.rb +26 -0
  78. data/lib/plenty_client/sales_price/customer_class.rb +31 -0
  79. data/lib/plenty_client/sales_price/name.rb +36 -0
  80. data/lib/plenty_client/sales_price/online_store.rb +29 -0
  81. data/lib/plenty_client/sales_price/referrer.rb +25 -0
  82. data/lib/plenty_client/version.rb +3 -0
  83. data/lib/plenty_client.rb +108 -0
  84. data/plenty_client.gemspec +29 -0
  85. metadata +204 -0
@@ -0,0 +1,362 @@
1
+ module PlentyClient
2
+ AVAILABLE_LANGS = %w(de en bg fr it es tr nl pl pt nn ro da se cz ru sk cn vn).freeze
3
+
4
+ PAYMENT_STATUS_IDS = [
5
+ 1, # Awaiting approval
6
+ 2, # Approved
7
+ 3, # Captured
8
+ 4, # Partially captured
9
+ 5, # Cancelled
10
+ 6, # Refused
11
+ 7, # Awaiting renewal
12
+ 8, # Expired
13
+ 9, # Refunded
14
+ 10, # Partially refunded
15
+ ].freeze
16
+
17
+ AVAILABLE_CURRENCYS = [
18
+ 'AED', # United Arab Emirates dirham
19
+ 'AUD', # Australian dollar
20
+ 'BGN', # Bulgarian lev
21
+ 'BRL', # Brazilian real
22
+ 'CAD', # Canadian dollar
23
+ 'CHF', # Swiss franc
24
+ 'CNY', # Chinese Renminbi
25
+ 'CZK', # Czech koruna
26
+ 'DKK', # Danish krone
27
+ 'EUR', # Euro
28
+ 'GBP', # Pound sterling
29
+ 'HKD', # Hong Kong dollar
30
+ 'HUF', # Hungarian forint
31
+ 'IDR', # Indonesian rupiah
32
+ 'INR', # Indian rupee
33
+ 'JPY', # Japanese yen
34
+ 'MXN', # Mexican peso
35
+ 'MYR', # Malaysian ringgit
36
+ 'NOK', # Norwegian krone
37
+ 'PHP', # Philippine peso
38
+ 'PLN', # Polish zloty
39
+ 'RON', # Romanian leu
40
+ 'RUB', # Russian ruble
41
+ 'SEK', # Swedish krona
42
+ 'THB', # Thai baht
43
+ 'TRY', # Turkish lira
44
+ 'USD', # United States dollar
45
+ 'VND', # Vietnamese dong
46
+ 'ZAR', # South African rand
47
+ ].freeze
48
+
49
+ AVAILABLE_UNITS = {
50
+ 'C62' => 1, # Piece
51
+ 'KGM' => 2, # Kilogram
52
+ 'GRM' => 3, # Gram
53
+ 'MGM' => 4, # Milligram
54
+ 'LTR' => 5, # Litre
55
+ 'DPC' => 6, # 12 pieces/dozen
56
+ 'OP' => 7, # Two pack
57
+ 'BL' => 8, # Bale
58
+ 'DI' => 9, # Dispenser
59
+ 'BG' => 10, # Bag
60
+ 'ST' => 11, # Sheet
61
+ 'D64' => 12, # Block
62
+ 'PD' => 13, # Block
63
+ 'QR' => 14, # Quire
64
+ 'BX' => 15, # Box
65
+ 'CL' => 16, # Coil
66
+ 'CH' => 17, # Container
67
+ 'TN' => 18, # Tin
68
+ 'CA' => 19, # Can
69
+ 'DZN' => 20, # Dozen
70
+ 'BJ' => 21, # Bucket
71
+ 'CS' => 22, # Case
72
+ 'Z3' => 23, # Cask
73
+ 'BO' => 24, # Bottle
74
+ 'OZA' => 25, # Fluid ounce
75
+ 'JR' => 26, # Jar
76
+ 'CG' => 27, # Cardboard box
77
+ 'CT' => 28, # Carton
78
+ 'KT' => 29, # Kit
79
+ 'AA' => 30, # Ball
80
+ 'MTR' => 31, # Metre
81
+ 'MLT' => 32, # Millilitre
82
+ 'MMT' => 33, # Millimetre
83
+ 'PR' => 34, # Pair
84
+ 'PA' => 35, # Packet
85
+ 'PK' => 36, # Bundle
86
+ 'D97' => 37, # Pallet/unit load
87
+ 'MTK' => 38, # Square metre
88
+ 'CMK' => 39, # Square centimetre
89
+ 'MMK' => 40, # Square millimetre
90
+ 'SCM' => 41, # Square centimetre (non-standard)
91
+ 'SMM' => 42, # Square millimetre (non-standard)
92
+ 'RO' => 43, # Role
93
+ 'SA' => 44, # Sack
94
+ 'SET' => 45, # Set
95
+ 'RL' => 46, # Reel
96
+ 'EA' => 47, # Each
97
+ 'TU' => 48, # Tube
98
+ 'OZ' => 49, # Ounce
99
+ 'WE' => 50, # Wet ton
100
+ 'CMT' => 51, # Centimetre
101
+ 'INH' => 52 # Inch
102
+ }.freeze
103
+
104
+ AVAILABLE_COUNTRIES = {
105
+ '' => 0, # Unknown
106
+ 'DE' => 1, # Germany
107
+ 'AT' => 2, # Austria
108
+ 'BE' => 3, # Belgium
109
+ 'CH' => 4, # Switzerland
110
+ 'CY' => 5, # Cyprus
111
+ 'CZ' => 6, # Czech Republic
112
+ 'DK' => 7, # Denmark
113
+ 'ES' => 8, # Spain
114
+ 'EE' => 9, # Estonia
115
+ 'FR' => 10, # France
116
+ 'FI' => 11, # Finland
117
+ 'GB' => 12, # United Kingdom
118
+ 'GR' => 13, # Greece
119
+ 'HU' => 14, # Hungary
120
+ 'IT' => 15, # Italy
121
+ 'IE' => 16, # Ireland
122
+ 'LU' => 17, # Luxembourg
123
+ 'LV' => 18, # Latvia
124
+ 'MT' => 19, # Malta
125
+ 'NO' => 20, # Norway
126
+ 'NL' => 21, # Netherlands
127
+ 'PT' => 22, # Portugal
128
+ 'PL' => 23, # Poland
129
+ 'SE' => 24, # Sweden
130
+ 'SG' => 25, # Singapore
131
+ 'SK' => 26, # Slovakia
132
+ 'SI' => 27, # Slovenia
133
+ 'US' => 28, # USA
134
+ 'AU' => 29, # Australia
135
+ 'CA' => 30, # Canada
136
+ 'CN' => 31, # China
137
+ 'JP' => 32, # Japan
138
+ 'LT' => 33, # Lithuania
139
+ 'LI' => 34, # Liechtenstein
140
+ 'MC' => 35, # Monaco
141
+ 'MX' => 36, # Mexico
142
+ 'IC' => 37, # Canary Islands
143
+ 'IN' => 38, # India
144
+ 'BR' => 39, # Brazil
145
+ 'RU' => 40, # Russia
146
+ 'RO' => 41, # Romania
147
+ 'EA' => 42, # Ceuta
148
+ # 'EA' => 43, # Melilla
149
+ 'BG' => 44, # Bulgaria
150
+ 'XZ' => 45, # Kosovo
151
+ 'KG' => 46, # Kyrgyzstan
152
+ 'KZ' => 47, # Kazakhstan
153
+ 'BY' => 48, # Belarus
154
+ 'UZ' => 49, # Uzbekistan
155
+ 'MA' => 50, # Morocco
156
+ 'AM' => 51, # Armenia
157
+ 'AL' => 52, # Albania
158
+ 'EG' => 53, # Egypt
159
+ 'HR' => 54, # Croatia
160
+ 'MV' => 55, # Maldives
161
+ 'MY' => 56, # Malaysia
162
+ 'HK' => 57, # Hong Kong
163
+ 'YE' => 58, # Yemen
164
+ 'IL' => 59, # Israel
165
+ 'TW' => 60, # Taiwan
166
+ 'GP' => 61, # Guadeloupe
167
+ 'TH' => 62, # Thailand
168
+ 'TR' => 63, # Turkey
169
+ # 'GR' => 64, # Greek Islands
170
+ # 'ES' => 65, # Balearic Islands
171
+ 'NZ' => 66, # New Zealand
172
+ 'AF' => 67, # Afghanistan
173
+ 'AX' => 68, # Aland Islands
174
+ 'DZ' => 69, # Algeria
175
+ 'AS' => 70, # American Samoa
176
+ 'AD' => 71, # Andorra
177
+ 'AO' => 72, # Angola
178
+ 'AI' => 73, # Anguilla
179
+ 'AQ' => 74, # Antarctica
180
+ 'AG' => 75, # Antigua and Barbuda
181
+ 'AR' => 76, # Argentina
182
+ 'AW' => 77, # Aruba
183
+ 'AZ' => 78, # Azerbaijan
184
+ 'BS' => 79, # The Bahamas
185
+ 'BH' => 80, # Bahrain
186
+ 'BD' => 81, # Bangladesh
187
+ 'BB' => 82, # Barbados
188
+ 'BZ' => 83, # Belize
189
+ 'BJ' => 84, # Benin
190
+ 'BM' => 85, # Bermuda
191
+ 'BT' => 86, # Bhutan
192
+ 'BO' => 87, # Bolivia
193
+ 'BA' => 88, # Bosnia and Herzegovina
194
+ 'BW' => 89, # Botswana
195
+ 'BV' => 90, # Bouvet Island
196
+ 'IO' => 91, # British Indian Ocean Territory
197
+ 'BN' => 92, # Brunei Darussalam
198
+ 'BF' => 93, # Burkina Faso
199
+ 'BI' => 94, # Burundi
200
+ 'KH' => 95, # Cambodia
201
+ 'CM' => 96, # Cameroon
202
+ 'CV' => 97, # Cape Verde
203
+ 'KY' => 98, # Cayman Islands
204
+ 'CF' => 99, # Central African Republic
205
+ 'TD' => 100, # Chad
206
+ 'CL' => 101, # Chile
207
+ 'CX' => 102, # Christmas Island
208
+ 'CC' => 103, # Cocos Islands/Keeling Islands
209
+ 'CO' => 104, # Columbia
210
+ 'KM' => 105, # Comoros
211
+ 'CG' => 106, # Congo
212
+ 'CD' => 107, # Democratic Republic of the Congo
213
+ 'CK' => 108, # Cook Islands
214
+ 'CR' => 109, # Costa Rica
215
+ 'CI' => 110, # Ivory coast
216
+ 'CU' => 112, # Cuba
217
+ 'DJ' => 113, # Djibouti
218
+ 'DM' => 114, # Dominica
219
+ 'DO' => 115, # Dominican Republic
220
+ 'EC' => 116, # Ecuador
221
+ 'SV' => 117, # El Salvador
222
+ 'GQ' => 118, # Equatorial Guinea
223
+ 'ER' => 119, # Eritrea
224
+ 'ET' => 120, # Ethiopia
225
+ 'FK' => 121, # Falkland Islands
226
+ 'FO' => 122, # Faroe Islands
227
+ 'FJ' => 123, # Fiji
228
+ 'GF' => 124, # French Guiana
229
+ 'PF' => 125, # French Polynesia
230
+ 'TF' => 126, # French Southern and Antarctic Lands
231
+ 'GA' => 127, # Gabon
232
+ 'GM' => 128, # Gambia
233
+ 'GE' => 129, # Georgia
234
+ 'GH' => 130, # Ghana
235
+ 'GI' => 131, # Gibraltar
236
+ 'GL' => 132, # Greenland
237
+ 'GD' => 133, # Grenada
238
+ 'GU' => 134, # Guam
239
+ 'GT' => 135, # Guatemala
240
+ 'GG' => 136, # Guernsey
241
+ 'GN' => 137, # Guinea
242
+ 'GW' => 138, # Guinea-Bissau
243
+ 'GY' => 139, # Guyana
244
+ 'HT' => 140, # Haiti
245
+ 'HM' => 141, # Heard Island and McDonald Islands
246
+ 'VA' => 142, # Vatican City
247
+ 'HN' => 143, # Honduras
248
+ 'IS' => 144, # Iceland
249
+ 'ID' => 145, # Indonesia
250
+ 'IR' => 146, # Iran
251
+ 'IQ' => 147, # Iraq
252
+ 'IM' => 148, # Isle of Man
253
+ 'JM' => 149, # Jamaica
254
+ 'JE' => 150, # Jersey
255
+ 'JO' => 151, # Jordan
256
+ 'KE' => 152, # Kenya
257
+ 'KI' => 153, # Kiribati
258
+ 'KP' => 154, # Democratic People's Republic of Korea
259
+ 'KR' => 155, # Republic of Korea
260
+ 'KW' => 156, # Kuwait
261
+ 'LA' => 158, # Laos
262
+ 'LB' => 159, # Lebanon
263
+ 'LS' => 160, # Lesotho
264
+ 'LR' => 161, # Liberia
265
+ 'LY' => 162, # Libya
266
+ 'MO' => 163, # Macao
267
+ 'MK' => 164, # Macedonia
268
+ 'MG' => 165, # Madagascar
269
+ 'MW' => 166, # Malawi
270
+ 'ML' => 168, # Mali
271
+ 'MH' => 169, # Marshall Islands
272
+ 'MQ' => 170, # Martinique
273
+ 'MR' => 171, # Mauritania
274
+ 'MU' => 172, # Mauritius
275
+ 'YT' => 173, # Mayotte
276
+ 'FM' => 174, # Micronesia
277
+ 'MD' => 175, # Moldova
278
+ 'MN' => 176, # Mongolia
279
+ 'ME' => 177, # Montenegro
280
+ 'MS' => 178, # Montserrat
281
+ 'MZ' => 179, # Mozambique
282
+ 'MM' => 180, # Myanmar
283
+ 'NA' => 181, # Namibia
284
+ 'NR' => 182, # Nauru
285
+ 'NP' => 183, # Nepal
286
+ 'AN' => 184, # Netherlands Antilles
287
+ 'NC' => 185, # New Caledonia
288
+ 'NI' => 186, # Nicaragua
289
+ 'NE' => 187, # Niger
290
+ 'NG' => 188, # Nigeria
291
+ 'NU' => 189, # Niue
292
+ 'NF' => 190, # Norfolk Island
293
+ 'MP' => 191, # Northern Mariana Islands
294
+ 'OM' => 192, # Oman
295
+ 'PK' => 193, # Pakistan
296
+ 'PW' => 194, # Palau
297
+ 'PS' => 195, # Palestinian territories
298
+ 'PA' => 196, # Panama
299
+ 'PG' => 197, # Papua New Guinea
300
+ 'PY' => 198, # Paraguay
301
+ 'PE' => 199, # Peru
302
+ 'PH' => 200, # Philippines
303
+ 'PN' => 201, # Pitcairn Islands
304
+ 'PR' => 202, # Puerto Rico
305
+ 'QA' => 203, # Qatar
306
+ 'RE' => 204, # Reunion
307
+ 'RW' => 205, # Rwanda
308
+ 'SH' => 206, # Saint Helena
309
+ 'KN' => 207, # Saint Kitts and Nevis
310
+ 'LC' => 208, # Saint Lucia
311
+ 'PM' => 209, # Saint Pierre and Miquelon
312
+ 'VC' => 210, # Saint Vincent and the Grenadines
313
+ 'WS' => 211, # Samoa
314
+ 'SM' => 212, # San Marino
315
+ 'ST' => 213, # Sao Tome and Principe
316
+ 'SA' => 214, # Saudi Arabia
317
+ 'SN' => 215, # Senegal
318
+ 'RS' => 216, # Serbia
319
+ 'SC' => 217, # Seychelles
320
+ 'SL' => 218, # Sierra Leone
321
+ 'SB' => 219, # Solomon Islands
322
+ 'SO' => 220, # Somalia
323
+ 'ZA' => 221, # South Africa
324
+ 'GS' => 222, # South Georgia and the South Sandwich Islands
325
+ 'LK' => 223, # Sri Lanka
326
+ 'SD' => 224, # Sudan
327
+ 'SR' => 225, # Suriname
328
+ 'SJ' => 226, # Spitsbergen and Jan Mayen
329
+ 'SZ' => 227, # Swaziland
330
+ 'SY' => 228, # Syria
331
+ 'TJ' => 229, # Tajikistan
332
+ 'TZ' => 230, # Tanzania
333
+ 'TL' => 231, # Timor-Leste
334
+ 'TG' => 232, # Togo
335
+ 'TK' => 233, # Tokelau
336
+ 'TO' => 234, # Tonga
337
+ 'TT' => 235, # Trinidad and Tobago
338
+ 'TN' => 236, # Tunisia
339
+ 'TM' => 237, # Turkmenistan
340
+ 'TC' => 238, # Turks and Caicos Islands
341
+ 'TV' => 239, # Tuvalu
342
+ 'UG' => 240, # Uganda
343
+ 'UA' => 241, # Ukraine
344
+ 'UM' => 242, # United States Minor Outlying Islands
345
+ 'UY' => 243, # Uruguay
346
+ 'VU' => 244, # Vanuatu
347
+ 'VE' => 245, # Venezuela
348
+ 'VN' => 246, # Vietnam
349
+ 'VG' => 247, # British Virgin Islands
350
+ 'VI' => 248, # United States Virgin Islands
351
+ 'WF' => 249, # Wallis and Futuna
352
+ 'EH' => 250, # Western Sahara
353
+ 'ZM' => 252, # Zambia
354
+ 'ZW' => 253, # Zimbabwe
355
+ 'AE' => 254, # United Arab Emirates
356
+ # 'DE' => 255, # Helgoland
357
+ # 'DE' => 256, # Buesingen
358
+ # 'CUW' => 258, # Curacao
359
+ 'SXM' => 259, # Sint Maarten
360
+ 'BES' => 260, # BES Islands
361
+ }.freeze
362
+ end
@@ -0,0 +1,73 @@
1
+ module PlentyClient
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
+ contact: /\{contactId\}/,
21
+ country: /\{countryId\}/,
22
+ coupon_string: /\{coupon\}/,
23
+ cross_item: /\{crossItemId\}/,
24
+ currency: /\{currencyIso\}/,
25
+ customer_class: /\{customerClassId\}/,
26
+ image: /\{imageId\}/,
27
+ item: /\{itemId\}/,
28
+ item_set: /\{itemSetId\}/,
29
+ lang: /\{lang\}/,
30
+ manufacturer: /\{manufacturerId\}/,
31
+ market: /\{marketId\}/,
32
+ market_ident_number: /\{marketIdentNumberId\}/,
33
+ marketplace: /\{marketplaceId\}/,
34
+ order: /\{orderId\}/,
35
+ order_item: /\{orderItemId\}/,
36
+ parent_referrer: /\{parentReferrerId\}/,
37
+ plenty: /\{plentyId\}/,
38
+ preset: /\{presetId\}/,
39
+ price: /\{priceId\}/,
40
+ property_group: /\{propertyGroupId\}/,
41
+ property: /\{propertyId\}/,
42
+ referrer: /\{referrerId\}/,
43
+ sales_price: /\{salesPriceId\}/,
44
+ shipping_profile: /\{shippingProfileId\}/,
45
+ shipping_package: /\{orderShippingPackageId\}/,
46
+ shipping_service_provider: /\{shippingServiceProviderID\}/,
47
+ sku: /\{skuId\}/,
48
+ type: /\{typeId\}/,
49
+ type_string: /\{type\}/,
50
+ unit: /\{unitId\}/,
51
+ value: /\{valueId\}/,
52
+ variation: /\{variationId\}/,
53
+ variation_supplier: /\{variationSupplierId\}/,
54
+ warehouse: /\{warehouseId\}/,
55
+ webstore: /\{webstoreId\}/
56
+ }
57
+ # Loop over the given argument symbols, retrieve the corresponding regex
58
+ # and replace the argument with the corresponding value.
59
+ arguments.each do |k, v|
60
+ api_endpoint_result.gsub!(endpoint_parameters.fetch(k), v.to_s)
61
+ end
62
+
63
+ api_endpoint_result
64
+ end
65
+
66
+ def routes
67
+ # Prints all available routes with their values in the given module
68
+ constants.each do |const|
69
+ puts "#{const}: \t #{const_get(const)}" if const.to_s.upcase!.nil?
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,52 @@
1
+ module PlentyClient
2
+ module Item
3
+ module Attribute
4
+ class Name
5
+ extend PlentyClient::Endpoint
6
+ extend PlentyClient::Request
7
+
8
+ ITEM_ATTRIBUTE_PATH = '/items/attributes'.freeze
9
+
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
15
+
16
+ class << self
17
+ def create(attribute_id, headers = {})
18
+ post(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{CREATE_ITEM_ATTRIBUTES}"),
19
+ attribute: attribute_id,
20
+ headers)
21
+ end
22
+
23
+ def list(attribute_id, headers = {}, &block)
24
+ get(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{LIST_ITEM_ATTRIBUTE}"),
25
+ attribute: attribute_id,
26
+ headers, &block)
27
+ end
28
+
29
+ def find(attribute_id, lang, headers = {}, &block)
30
+ get(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{GET_ITEMS_ATTRIBUTE}",
31
+ attribute: attribute_id,
32
+ lang: lang),
33
+ headers, &block)
34
+ end
35
+
36
+ def update(attribute_id, lang, body = {})
37
+ put(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{UPDATE_ITEMS_ATTRIBUTE}",
38
+ attribute: attribute_id,
39
+ lang: lang),
40
+ body)
41
+ end
42
+
43
+ def delete(attribute_id, lang)
44
+ delete(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{DELETE_ITEMS_ATTRIBUTE}",
45
+ attribute: attribute_id,
46
+ lang: lang))
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,52 @@
1
+ module PlentyClient
2
+ module Item
3
+ module Attribute
4
+ class Value
5
+ extend PlentyClient::Endpoint
6
+ extend PlentyClient::Request
7
+
8
+ ITEM_ATTRIBUTE_PATH = '/items/attributes'.freeze
9
+
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
15
+
16
+ class << self
17
+ def create(attribute_id, body = {})
18
+ post(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{CREATE_ITEM_ATTRIBUTE_VALUES}"),
19
+ attribute: attribute_id,
20
+ body)
21
+ end
22
+
23
+ def list(attribute_id, headers = {}, &block)
24
+ get(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{LIST_ITEM_ATTRIBUTE_VALUE}"),
25
+ attribute: attribute_id,
26
+ headers, &block)
27
+ end
28
+
29
+ def find(attribute_id, value_id, headers = {}, &block)
30
+ get(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{GET_ITEMS_ATTRIBUTE_VALUE}",
31
+ attribute: attribute_id,
32
+ value: value_id),
33
+ headers, &block)
34
+ end
35
+
36
+ def update(attribute_id, value_id, body = {}, &block)
37
+ put(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{UPDATE_ITEMS_ATTRIBUTE_VALUE}",
38
+ attribute: attribute_id,
39
+ value: value_id),
40
+ body, &block)
41
+ end
42
+
43
+ def delete(attribute_id, value_id)
44
+ delete(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{DELETE_ITEMS_ATTRIBUTE_VALUE}",
45
+ attribute: attribute_id,
46
+ value: value_id))
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,52 @@
1
+ module PlentyClient
2
+ module Item
3
+ module Attribute
4
+ class ValueName
5
+ extend PlentyClient::Endpoint
6
+ extend PlentyClient::Request
7
+
8
+ ITEM_ATTRIBUTE_PATH = '/items/attribute_values'.freeze
9
+
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
15
+
16
+ class << self
17
+ def create(attribute_value_id, body = {})
18
+ post(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{CREATE_ITEM_ATTRIBUTE_VALUES}"),
19
+ attribute_value: attribute_value_id,
20
+ body)
21
+ end
22
+
23
+ def list(attribute_value_id, headers = {}, &block)
24
+ get(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{LIST_ITEM_ATTRIBUTE_VALUE}"),
25
+ attribute_value: attribute_value_id,
26
+ headers, &block)
27
+ end
28
+
29
+ def find(attribute_value_id, lang, headers = {}, &block)
30
+ get(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{GET_ITEMS_ATTRIBUTE_VALUE}",
31
+ attribute_value: attribute_value_id,
32
+ lang: lang),
33
+ headers, &block)
34
+ end
35
+
36
+ def update(attribute_value_id, lang, body = {}, &block)
37
+ put(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{UPDATE_ITEMS_ATTRIBUTE_VALUE}",
38
+ attribute_value: attribute_value_id,
39
+ lang: lang),
40
+ body, &block)
41
+ end
42
+
43
+ def delete(attribute_value_id, value_id)
44
+ delete(build_endpoint("#{ITEM_ATTRIBUTE_PATH}#{DELETE_ITEMS_ATTRIBUTE_VALUE}",
45
+ attribute_value: attribute_value_id,
46
+ lang: lang))
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,36 @@
1
+ module PlentyClient
2
+ module Item
3
+ module Attribute
4
+ extend PlentyClient::Endpoint
5
+ extend PlentyClient::Request
6
+
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
12
+
13
+ class << self
14
+ def list(headers = {}, &block)
15
+ get(build_endpoint(LIST_ATTRIBUTES), headers, &block)
16
+ end
17
+
18
+ def find(attribute_id, headers = {}, &block)
19
+ get(build_endpoint(GET_ATTRIBUTE, attribute: attribute_id), headers, &block)
20
+ end
21
+
22
+ def create(headers = {})
23
+ post(build_endpoint(CREATE_ATTRIBUTE), headers)
24
+ end
25
+
26
+ def update(attribute_id, headers = {})
27
+ post(build_endpoint(UPDATE_ATTRIBUTE, attribute: attribute_id), headers)
28
+ end
29
+
30
+ def delete(attribute_id)
31
+ delete(build_endpoint(DELETE_attribute, attribute: attribute_id))
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,56 @@
1
+ module PlentyClient
2
+ module Item
3
+ class Barcode
4
+ extend PlentyClient::Endpoint
5
+ extend PlentyClient::Request
6
+
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
16
+
17
+ class << self
18
+ def list(headers = {}, &block)
19
+ get(build_endpoint(LIST_ALL_BARCODES), headers, &block)
20
+ end
21
+
22
+ def list_by_type(type_string, headers = {}, &block)
23
+ get(build_endpoint(LIST_BARCODES_BY_TYPE, type_string: type_string), headers, &block)
24
+ end
25
+
26
+ def list_by_referrer(referrer_id, headers = {}, &block)
27
+ get(build_endpoint(LIST_BARCODES_BY_REFERRER, referrer: referrer_id), headers, &block)
28
+ end
29
+
30
+ def find(barcode_id, headers = {}, &block)
31
+ get(build_endpoint(GET_BARCODE, barcode: barcode_id), headers, &block)
32
+ end
33
+
34
+ def create(body = {})
35
+ post(build_endpoint(CREATE_BARCODE), body)
36
+ end
37
+
38
+ def update(barcode_id, body = {})
39
+ post(build_endpoint(UPDATE_BARCODE, barcode: barcode_id), body)
40
+ end
41
+
42
+ def delete(barcode_id)
43
+ delete(build_endpoint(DELETE_BARCODE, barcode: barcode_id))
44
+ end
45
+
46
+ def deactivate_referrer(barcode_id, referrer_id)
47
+ delete(build_endpoint(DEACTIVATE_REFERRER, barcode: barcode_id, referrer: referrer_id))
48
+ end
49
+
50
+ def activate_referrer(barcode_id, body = {})
51
+ post(build_endpoint(ACTIVATE_RERERRER, barcode: barcode_id), body)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end