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.
- checksums.yaml +5 -5
- data/lib/plenty_client/account/address.rb +37 -0
- data/lib/plenty_client/account/contact/address.rb +8 -6
- data/lib/plenty_client/account/contact/bank.rb +7 -5
- data/lib/plenty_client/account/contact/type.rb +7 -5
- data/lib/plenty_client/account/contact.rb +7 -5
- data/lib/plenty_client/account.rb +11 -9
- data/lib/plenty_client/accounting.rb +6 -4
- data/lib/plenty_client/authentication.rb +7 -5
- data/lib/plenty_client/authorization.rb +4 -2
- data/lib/plenty_client/basket/item.rb +4 -2
- data/lib/plenty_client/basket.rb +3 -1
- data/lib/plenty_client/category/branch.rb +4 -2
- data/lib/plenty_client/category/template.rb +5 -3
- data/lib/plenty_client/category.rb +12 -10
- data/lib/plenty_client/comment.rb +8 -6
- data/lib/plenty_client/config.rb +6 -0
- data/lib/plenty_client/document/category.rb +6 -4
- data/lib/plenty_client/document/order.rb +7 -5
- data/lib/plenty_client/document.rb +4 -2
- data/lib/plenty_client/endpoint.rb +1 -1
- data/lib/plenty_client/item/attribute/name.rb +8 -6
- data/lib/plenty_client/item/attribute/value.rb +8 -6
- data/lib/plenty_client/item/attribute/value_name.rb +8 -6
- data/lib/plenty_client/item/attribute.rb +7 -5
- data/lib/plenty_client/item/barcode.rb +11 -9
- data/lib/plenty_client/item/cross_selling.rb +5 -3
- data/lib/plenty_client/item/image/availability.rb +6 -4
- data/lib/plenty_client/item/image/name.rb +8 -6
- data/lib/plenty_client/item/image.rb +15 -12
- data/lib/plenty_client/item/manufacturer/commission.rb +8 -6
- data/lib/plenty_client/item/manufacturer.rb +7 -5
- data/lib/plenty_client/item/property/market_reference.rb +8 -6
- data/lib/plenty_client/item/property/name.rb +8 -6
- data/lib/plenty_client/item/property.rb +7 -5
- data/lib/plenty_client/item/property_group.rb +7 -5
- data/lib/plenty_client/item/property_group_name.rb +8 -6
- data/lib/plenty_client/item/sales_price.rb +7 -5
- data/lib/plenty_client/item/shipping_profile.rb +5 -3
- data/lib/plenty_client/item/unit.rb +7 -5
- data/lib/plenty_client/item/unit_name.rb +7 -5
- data/lib/plenty_client/item/variation/barcode.rb +3 -1
- data/lib/plenty_client/item/variation/bundle.rb +8 -6
- data/lib/plenty_client/item/variation/category.rb +14 -6
- data/lib/plenty_client/item/variation/client.rb +6 -4
- data/lib/plenty_client/item/variation/default_category.rb +7 -5
- data/lib/plenty_client/item/variation/description.rb +8 -6
- data/lib/plenty_client/item/variation/image.rb +8 -6
- data/lib/plenty_client/item/variation/market.rb +6 -4
- data/lib/plenty_client/item/variation/market_ident_number.rb +8 -6
- data/lib/plenty_client/item/variation/property/text.rb +8 -6
- data/lib/plenty_client/item/variation/property.rb +22 -17
- data/lib/plenty_client/item/variation/sales_price.rb +15 -19
- data/lib/plenty_client/item/variation/sku.rb +8 -6
- data/lib/plenty_client/item/variation/stock.rb +9 -7
- data/lib/plenty_client/item/variation/supplier.rb +8 -6
- data/lib/plenty_client/item/variation/warehouse.rb +8 -6
- data/lib/plenty_client/item/variation.rb +8 -6
- data/lib/plenty_client/item.rb +11 -4
- data/lib/plenty_client/item_set/component.rb +9 -7
- data/lib/plenty_client/item_set/config.rb +4 -2
- data/lib/plenty_client/item_set.rb +9 -7
- data/lib/plenty_client/listing/layout_template.rb +5 -3
- data/lib/plenty_client/listing/market/directory.rb +6 -4
- data/lib/plenty_client/listing/market/history.rb +7 -5
- data/lib/plenty_client/listing/market/info.rb +3 -1
- data/lib/plenty_client/listing/market/text.rb +7 -5
- data/lib/plenty_client/listing/market.rb +9 -7
- data/lib/plenty_client/listing/option_template.rb +7 -5
- data/lib/plenty_client/listing/shipping_profile.rb +4 -2
- data/lib/plenty_client/listing/stock_dependence_type.rb +4 -2
- data/lib/plenty_client/listing/type.rb +4 -2
- data/lib/plenty_client/listing.rb +7 -5
- data/lib/plenty_client/market/credentials.rb +7 -5
- data/lib/plenty_client/market/ebay/authentication.rb +4 -2
- data/lib/plenty_client/market/ebay/parts_fitment.rb +8 -6
- data/lib/plenty_client/market/ebay/shop_category.rb +3 -1
- data/lib/plenty_client/order/contact_wish.rb +4 -2
- data/lib/plenty_client/order/coupon_code/contact.rb +3 -1
- data/lib/plenty_client/order/coupon_code/validation.rb +3 -1
- data/lib/plenty_client/order/coupon_code.rb +3 -1
- data/lib/plenty_client/order/currency.rb +6 -4
- data/lib/plenty_client/order/date.rb +6 -4
- data/lib/plenty_client/order/item/serial_number.rb +4 -2
- data/lib/plenty_client/order/item.rb +3 -1
- data/lib/plenty_client/order/referrer.rb +4 -2
- data/lib/plenty_client/order/shipping/country.rb +3 -1
- data/lib/plenty_client/order/shipping/information.rb +12 -17
- data/lib/plenty_client/order/shipping/package.rb +9 -7
- data/lib/plenty_client/order/shipping/profile.rb +4 -2
- data/lib/plenty_client/order/shipping/service_provider.rb +5 -3
- data/lib/plenty_client/order/status_history.rb +23 -0
- data/lib/plenty_client/order.rb +9 -7
- data/lib/plenty_client/order_summary.rb +9 -7
- data/lib/plenty_client/payment/contact.rb +4 -2
- data/lib/plenty_client/payment/method.rb +10 -8
- data/lib/plenty_client/payment/method_name.rb +5 -3
- data/lib/plenty_client/payment/order.rb +5 -3
- data/lib/plenty_client/payment/property/type/name.rb +7 -5
- data/lib/plenty_client/payment/property/type.rb +7 -5
- data/lib/plenty_client/payment/property.rb +9 -7
- data/lib/plenty_client/payment/status.rb +3 -1
- data/lib/plenty_client/payment/transaction.rb +3 -1
- data/lib/plenty_client/payment.rb +8 -6
- data/lib/plenty_client/request.rb +54 -24
- data/lib/plenty_client/sales_price/account.rb +5 -3
- data/lib/plenty_client/sales_price/country.rb +5 -3
- data/lib/plenty_client/sales_price/currency.rb +5 -3
- data/lib/plenty_client/sales_price/customer_class.rb +6 -4
- data/lib/plenty_client/sales_price/name.rb +7 -5
- data/lib/plenty_client/sales_price/online_store.rb +5 -3
- data/lib/plenty_client/sales_price/referrer.rb +5 -3
- data/lib/plenty_client/stock.rb +5 -3
- data/lib/plenty_client/ticket.rb +6 -4
- data/lib/plenty_client/version.rb +3 -1
- data/lib/plenty_client/warehouse/management/rack.rb +6 -4
- data/lib/plenty_client/warehouse/management/shelf.rb +6 -4
- data/lib/plenty_client/warehouse/management/storage_location.rb +6 -4
- data/lib/plenty_client/warehouse/management.rb +21 -5
- data/lib/plenty_client/warehouse/stock.rb +8 -6
- data/lib/plenty_client/warehouse.rb +5 -3
- data/lib/plenty_client/webstore.rb +3 -1
- data/lib/plenty_client.rb +5 -1
- metadata +5 -3
|
@@ -9,7 +9,15 @@ module PlentyClient
|
|
|
9
9
|
return false unless %w[post put patch delete get].include?(http_method.to_s)
|
|
10
10
|
|
|
11
11
|
login_check unless PlentyClient::Config.tokens_valid?
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
params = stringify_symbol_keys(params) if params.is_a?(Hash)
|
|
14
|
+
|
|
15
|
+
attempts = PlentyClient::Config.attempt_count
|
|
16
|
+
attempts.times do
|
|
17
|
+
response = perform(http_method, path, params)
|
|
18
|
+
return response if response
|
|
19
|
+
end
|
|
20
|
+
raise PlentyClient::AttemptsExceeded, "unable to get valid response after #{attempts} attempts"
|
|
13
21
|
end
|
|
14
22
|
|
|
15
23
|
def post(path, body = {})
|
|
@@ -47,11 +55,19 @@ module PlentyClient
|
|
|
47
55
|
|
|
48
56
|
private
|
|
49
57
|
|
|
58
|
+
def stringify_symbol_keys(hash)
|
|
59
|
+
new_hash = {}
|
|
60
|
+
hash.each do |k, v|
|
|
61
|
+
k = k.to_s if k.is_a?(Symbol)
|
|
62
|
+
new_hash[k] = v
|
|
63
|
+
end
|
|
64
|
+
new_hash
|
|
65
|
+
end
|
|
66
|
+
|
|
50
67
|
def login_check
|
|
51
68
|
PlentyClient::Config.validate_credentials
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
result = parse_body(response)
|
|
69
|
+
result = perform(:post, '/login', username: PlentyClient::Config.api_user,
|
|
70
|
+
password: PlentyClient::Config.api_password)
|
|
55
71
|
PlentyClient::Config.access_token = result['accessToken']
|
|
56
72
|
PlentyClient::Config.refresh_token = result['refreshToken']
|
|
57
73
|
PlentyClient::Config.expiry_date = Time.now + result['expiresIn']
|
|
@@ -62,13 +78,15 @@ module PlentyClient
|
|
|
62
78
|
faraday = headers(faraday)
|
|
63
79
|
if PlentyClient::Config.log
|
|
64
80
|
faraday.response :logger do |logger|
|
|
65
|
-
logger.filter(/
|
|
81
|
+
logger.filter(/password=([^&]+)/, 'password=[FILTERED]')
|
|
66
82
|
end
|
|
67
83
|
end
|
|
68
84
|
end
|
|
69
85
|
conn.adapter :typhoeus
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
verb = http_method.to_s.downcase
|
|
87
|
+
params = params.to_json unless %w[get delete].include?(verb)
|
|
88
|
+
response = conn.send(verb, base_url(path), params)
|
|
89
|
+
parse_body(response)
|
|
72
90
|
end
|
|
73
91
|
|
|
74
92
|
def headers(adapter)
|
|
@@ -87,26 +105,38 @@ module PlentyClient
|
|
|
87
105
|
url
|
|
88
106
|
end
|
|
89
107
|
|
|
108
|
+
# 2017-12-04 DO: there has to be a supervisor watching over the users limits
|
|
109
|
+
# BEFORE the request actually happens
|
|
110
|
+
# response_header is after the request and useless if you have multiple instances of the Client
|
|
111
|
+
def throttle_check_short_period(response_header)
|
|
112
|
+
short_calls_left = response_header['X-Plenty-Global-Short-Period-Calls-Left']
|
|
113
|
+
short_seconds_left = response_header['X-Plenty-Global-Short-Period-Decay']
|
|
114
|
+
return if short_calls_left&.empty? || short_seconds_left&.empty?
|
|
115
|
+
sleep(short_seconds_left.to_i + 1) if short_calls_left.to_i <= 10 && short_seconds_left.to_i < 3
|
|
116
|
+
end
|
|
117
|
+
|
|
90
118
|
def parse_body(response)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
119
|
+
content_type = response.env.response_headers['Content-Type']
|
|
120
|
+
case content_type
|
|
121
|
+
when %r{(?:application|text)/json}
|
|
122
|
+
json = JSON.parse(response.body)
|
|
123
|
+
errors = error_check(json)
|
|
124
|
+
raise PlentyClient::NotFound, errors if errors.is_a?(String) && errors =~ /no query results/i
|
|
125
|
+
raise PlentyClient::ResponseError, errors if errors && !errors&.empty?
|
|
126
|
+
json
|
|
127
|
+
when %r{application/pdf}
|
|
128
|
+
response.body
|
|
129
|
+
end
|
|
130
|
+
rescue JSON::ParserError
|
|
131
|
+
raise PlentyClient::ResponseError, 'invalid response'
|
|
95
132
|
end
|
|
96
133
|
|
|
97
134
|
def error_check(response)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
rval << extract_message(res)
|
|
104
|
-
end
|
|
105
|
-
elsif response.is_a?(Hash) && response.key?('error')
|
|
106
|
-
check_for_invalid_credentials(response)
|
|
107
|
-
rval << extract_message(response)
|
|
108
|
-
end
|
|
109
|
-
rval
|
|
135
|
+
return if response.nil? || response&.empty?
|
|
136
|
+
response = response.first if response.is_a?(Array)
|
|
137
|
+
return unless response&.key?('error')
|
|
138
|
+
check_for_invalid_credentials(response)
|
|
139
|
+
extract_message(response)
|
|
110
140
|
end
|
|
111
141
|
|
|
112
142
|
def check_for_invalid_credentials(response)
|
|
@@ -120,7 +150,7 @@ module PlentyClient
|
|
|
120
150
|
rval = errors.flatten.values if response['validation_errors'].is_a?(Array)
|
|
121
151
|
rval.flatten.join(', ')
|
|
122
152
|
else
|
|
123
|
-
response
|
|
153
|
+
response.dig('error', 'message')
|
|
124
154
|
end
|
|
125
155
|
end
|
|
126
156
|
end
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module SalesPrice
|
|
3
5
|
class Account
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
LIST_REFERRER_ACCOUNTS = '/items/sales_prices/{salesPriceId}/accounts'
|
|
8
|
-
ACTIVATE_REFERRER_ACCOUNT = '/items/sales_prices/{salesPriceId}/accounts'
|
|
9
|
-
DEACTIVATE_REFERRER_ACCOUNT = '/items/sales_prices/{salesPriceId}/accounts/{accountType}/{accountId}'
|
|
9
|
+
LIST_REFERRER_ACCOUNTS = '/items/sales_prices/{salesPriceId}/accounts'
|
|
10
|
+
ACTIVATE_REFERRER_ACCOUNT = '/items/sales_prices/{salesPriceId}/accounts'
|
|
11
|
+
DEACTIVATE_REFERRER_ACCOUNT = '/items/sales_prices/{salesPriceId}/accounts/{accountType}/{accountId}'
|
|
10
12
|
|
|
11
13
|
class << self
|
|
12
14
|
def list(sales_price_id, headers = {}, &block)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module SalesPrice
|
|
3
5
|
class Country
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
LIST_SALES_PRICE_COUNTRIES = '/items/sales_prices/{salesPriceId}/countries'
|
|
8
|
-
ACTIVATE_SALES_PRICE_COUNTRY = '/items/sales_prices/{salesPriceId}/countries'
|
|
9
|
-
DEACTIVATE_SALES_PRICE_COUNTRY = '/items/sales_prices/{salesPriceId}/countries/{countryId}'
|
|
9
|
+
LIST_SALES_PRICE_COUNTRIES = '/items/sales_prices/{salesPriceId}/countries'
|
|
10
|
+
ACTIVATE_SALES_PRICE_COUNTRY = '/items/sales_prices/{salesPriceId}/countries'
|
|
11
|
+
DEACTIVATE_SALES_PRICE_COUNTRY = '/items/sales_prices/{salesPriceId}/countries/{countryId}'
|
|
10
12
|
|
|
11
13
|
class << self
|
|
12
14
|
def list(sales_price_id, headers = {}, &block)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module SalesPrice
|
|
3
5
|
class Currency
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
LIST_SALES_PRICE_CURRENCIES = '/items/sales_prices/{salesPriceId}/currencies'
|
|
8
|
-
ACTIVATE_SALES_PRICE_CURRENCY = '/items/sales_prices/{salesPriceId}/currencies'
|
|
9
|
-
DEACTIVATE_SALES_PRICE_CURRENCY = '/items/sales_prices/{salesPriceId}/currencies/{currencyIso}'
|
|
9
|
+
LIST_SALES_PRICE_CURRENCIES = '/items/sales_prices/{salesPriceId}/currencies'
|
|
10
|
+
ACTIVATE_SALES_PRICE_CURRENCY = '/items/sales_prices/{salesPriceId}/currencies'
|
|
11
|
+
DEACTIVATE_SALES_PRICE_CURRENCY = '/items/sales_prices/{salesPriceId}/currencies/{currencyIso}'
|
|
10
12
|
|
|
11
13
|
class << self
|
|
12
14
|
def list(sales_price_id, headers = {}, &block)
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module SalesPrice
|
|
3
5
|
class CustomerClass
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
SALES_PRICE_PATH = '/items/sales_prices/{salesPriceId}'
|
|
8
|
-
LIST_SALES_PRICE_CUSTOMER_CLASSES = '/customer_classes'
|
|
9
|
-
ACTIVATE_SALES_PRICE_CUSTOMER_CLASSES = '/customer_classes'
|
|
10
|
-
DEACTIVATE_SALES_PRICE_CUSTOMER_CLASSES = '/customer_classes/{customerClassId}'
|
|
9
|
+
SALES_PRICE_PATH = '/items/sales_prices/{salesPriceId}'
|
|
10
|
+
LIST_SALES_PRICE_CUSTOMER_CLASSES = '/customer_classes'
|
|
11
|
+
ACTIVATE_SALES_PRICE_CUSTOMER_CLASSES = '/customer_classes'
|
|
12
|
+
DEACTIVATE_SALES_PRICE_CUSTOMER_CLASSES = '/customer_classes/{customerClassId}'
|
|
11
13
|
|
|
12
14
|
class << self
|
|
13
15
|
def list(sales_price_id, headers = {}, &block)
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module SalesPrice
|
|
3
5
|
class Name
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
LIST_SALES_PRICE_NAMES = '/items/sales_prices/{salesPriceId}/names'
|
|
8
|
-
GET_SALES_PRICE_NAMES_BY_LANG = '/items/sales_prices/{salesPriceId}/names/{lang}'
|
|
9
|
-
CREATE_SALES_PRICE_NAME = '/items/sales_prices/{salesPriceId}/names'
|
|
10
|
-
UPDATE_SALES_PRICE_NAME = '/items/sales_prices/{salesPriceId}/names/{lang}'
|
|
11
|
-
DELETE_SALES_PRICE_NAME = '/items/sales_prices/{salesPriceId}/names/{lang}'
|
|
9
|
+
LIST_SALES_PRICE_NAMES = '/items/sales_prices/{salesPriceId}/names'
|
|
10
|
+
GET_SALES_PRICE_NAMES_BY_LANG = '/items/sales_prices/{salesPriceId}/names/{lang}'
|
|
11
|
+
CREATE_SALES_PRICE_NAME = '/items/sales_prices/{salesPriceId}/names'
|
|
12
|
+
UPDATE_SALES_PRICE_NAME = '/items/sales_prices/{salesPriceId}/names/{lang}'
|
|
13
|
+
DELETE_SALES_PRICE_NAME = '/items/sales_prices/{salesPriceId}/names/{lang}'
|
|
12
14
|
|
|
13
15
|
class << self
|
|
14
16
|
def list(sales_price_id, headers = {}, &block)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module SalesPrice
|
|
3
5
|
class OnlineStore
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
LIST_SALES_PRICE_ONLINE_STORES = '/items/sales_prices/{salesPriceId}/online_stores'
|
|
8
|
-
ACTIVATE_SALES_PRICE_ONLINE_STORE = '/items/sales_prices/{salesPriceId}/online_stores'
|
|
9
|
-
DEACTIVATE_SALES_PRICE_ONLINE_STORE = '/items/sales_prices/{salesPriceId}/online_stores/{webstoreId}'
|
|
9
|
+
LIST_SALES_PRICE_ONLINE_STORES = '/items/sales_prices/{salesPriceId}/online_stores'
|
|
10
|
+
ACTIVATE_SALES_PRICE_ONLINE_STORE = '/items/sales_prices/{salesPriceId}/online_stores'
|
|
11
|
+
DEACTIVATE_SALES_PRICE_ONLINE_STORE = '/items/sales_prices/{salesPriceId}/online_stores/{webstoreId}'
|
|
10
12
|
|
|
11
13
|
class << self
|
|
12
14
|
def list(sales_price_id, headers = {}, &block)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module SalesPrice
|
|
3
5
|
class Referrer
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
LIST_SALES_PRICE_REFERRER = '/items/sales_prices/{salesPriceId}/referrers'
|
|
8
|
-
ACTIVATE_SALES_PRICE_REFERRER = '/items/sales_prices/{salesPriceId}/referrers'
|
|
9
|
-
DEACTIVATE_SALES_PRICE_REFERRER = '/items/sales_prices/{salesPriceId}/referrers/{referrerId}'
|
|
9
|
+
LIST_SALES_PRICE_REFERRER = '/items/sales_prices/{salesPriceId}/referrers'
|
|
10
|
+
ACTIVATE_SALES_PRICE_REFERRER = '/items/sales_prices/{salesPriceId}/referrers'
|
|
11
|
+
DEACTIVATE_SALES_PRICE_REFERRER = '/items/sales_prices/{salesPriceId}/referrers/{referrerId}'
|
|
10
12
|
|
|
11
13
|
class << self
|
|
12
14
|
def list(sales_price_id, headers = {}, &block)
|
data/lib/plenty_client/stock.rb
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module Stock
|
|
3
5
|
include PlentyClient::Endpoint
|
|
4
6
|
include PlentyClient::Request
|
|
5
7
|
|
|
6
|
-
LIST_STOCK = '/stockmanagement/stock'
|
|
7
|
-
LIST_STOCK_BY_TYPE = '/stockmanagement/stock/types/{type}'
|
|
8
|
-
REDISTRIBUTE_STOCK = '/stockmanagement/stock/redistribute'
|
|
8
|
+
LIST_STOCK = '/stockmanagement/stock'
|
|
9
|
+
LIST_STOCK_BY_TYPE = '/stockmanagement/stock/types/{type}'
|
|
10
|
+
REDISTRIBUTE_STOCK = '/stockmanagement/stock/redistribute'
|
|
9
11
|
|
|
10
12
|
class << self
|
|
11
13
|
def list(headers = {}, &block)
|
data/lib/plenty_client/ticket.rb
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module Ticket
|
|
3
5
|
include PlentyClient::Endpoint
|
|
4
6
|
include PlentyClient::Request
|
|
5
7
|
|
|
6
|
-
LIST_TICKETS = '/tickets'
|
|
7
|
-
CREATE_TICKET = '/tickets'
|
|
8
|
-
ADD_MESSAGE = '/tickets/{ticketId}'
|
|
9
|
-
GET_TICKET = '/tickets/{ticketId}'
|
|
8
|
+
LIST_TICKETS = '/tickets'
|
|
9
|
+
CREATE_TICKET = '/tickets'
|
|
10
|
+
ADD_MESSAGE = '/tickets/{ticketId}'
|
|
11
|
+
GET_TICKET = '/tickets/{ticketId}'
|
|
10
12
|
|
|
11
13
|
class << self
|
|
12
14
|
def list(headers = {}, &block)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module Warehouse
|
|
3
5
|
module Management
|
|
@@ -5,11 +7,11 @@ module PlentyClient
|
|
|
5
7
|
include PlentyClient::Endpoint
|
|
6
8
|
include PlentyClient::Request
|
|
7
9
|
|
|
8
|
-
WM_WAREHOUSE_MGMT_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'
|
|
10
|
+
WM_WAREHOUSE_MGMT_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'
|
|
9
11
|
|
|
10
|
-
WM_LIST_RACKS = '/racks'
|
|
11
|
-
WM_FIND_RACKS = '/racks/{rackId}'
|
|
12
|
-
WM_CREATE_RACK = '/racks'
|
|
12
|
+
WM_LIST_RACKS = '/racks'
|
|
13
|
+
WM_FIND_RACKS = '/racks/{rackId}'
|
|
14
|
+
WM_CREATE_RACK = '/racks'
|
|
13
15
|
|
|
14
16
|
class << self
|
|
15
17
|
def list(warehouse_id, headers = {}, &block)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module Warehouse
|
|
3
5
|
module Management
|
|
@@ -5,11 +7,11 @@ module PlentyClient
|
|
|
5
7
|
include PlentyClient::Endpoint
|
|
6
8
|
include PlentyClient::Request
|
|
7
9
|
|
|
8
|
-
WM_WAREHOUSE_MGMT_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'
|
|
10
|
+
WM_WAREHOUSE_MGMT_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'
|
|
9
11
|
|
|
10
|
-
WM_LIST_SHELF = '/racks/{rackId}/shelves'
|
|
11
|
-
WM_FIND_SHELF = '/racks/{rackId}/shelves/{shelfId}'
|
|
12
|
-
WM_CREATE_SHELF = '/racks/{rackId}/shelves'
|
|
12
|
+
WM_LIST_SHELF = '/racks/{rackId}/shelves'
|
|
13
|
+
WM_FIND_SHELF = '/racks/{rackId}/shelves/{shelfId}'
|
|
14
|
+
WM_CREATE_SHELF = '/racks/{rackId}/shelves'
|
|
13
15
|
|
|
14
16
|
class << self
|
|
15
17
|
def list(warehouse_id, rack_id, headers = {}, &block)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module Warehouse
|
|
3
5
|
module Management
|
|
@@ -5,10 +7,10 @@ module PlentyClient
|
|
|
5
7
|
include PlentyClient::Endpoint
|
|
6
8
|
include PlentyClient::Request
|
|
7
9
|
|
|
8
|
-
WM_STORAGE_LOCATION_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'
|
|
9
|
-
WM_SL_LIST_STORAGE_LOCATIONS = '/racks/{rackId}/shelves/{shelfId}/storageLocations'
|
|
10
|
-
WM_SL_FIND_STORAGE_LOCATIONS = '/racks/{rackId}/shelves/{shelfId}/storageLocations/{storageLocationId}'
|
|
11
|
-
WM_SL_CREATE_STORAGE_LOCATION = '/racks/{rackId}/shelves/{shelfId}/storageLocations'
|
|
10
|
+
WM_STORAGE_LOCATION_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'
|
|
11
|
+
WM_SL_LIST_STORAGE_LOCATIONS = '/racks/{rackId}/shelves/{shelfId}/storageLocations'
|
|
12
|
+
WM_SL_FIND_STORAGE_LOCATIONS = '/racks/{rackId}/shelves/{shelfId}/storageLocations/{storageLocationId}'
|
|
13
|
+
WM_SL_CREATE_STORAGE_LOCATION = '/racks/{rackId}/shelves/{shelfId}/storageLocations'
|
|
12
14
|
|
|
13
15
|
class << self
|
|
14
16
|
def list(warehouse_id, rack_id, shelf_id, headers = {}, &block)
|
|
@@ -1,26 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module Warehouse
|
|
3
5
|
module Management
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
WM_STORAGE_LOCATION_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'
|
|
8
|
-
WM_LIST_STORAGE_LOCATIONS = '/storageLocations'
|
|
9
|
-
WM_FIND_STORAGE_LOCATIONS = '/storageLocations/{storageLocationId}'
|
|
9
|
+
WM_STORAGE_LOCATION_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'
|
|
10
|
+
WM_LIST_STORAGE_LOCATIONS = '/storageLocations'
|
|
11
|
+
WM_FIND_STORAGE_LOCATIONS = '/storageLocations/{storageLocationId}'
|
|
12
|
+
WM_LIST_RACKS = '/racks'
|
|
13
|
+
WM_FIND_RACKS = '/racks/{rackId}'
|
|
10
14
|
|
|
11
15
|
class << self
|
|
12
|
-
def
|
|
16
|
+
def list_locations(warehouse_id, headers = {}, &block)
|
|
13
17
|
get(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_LIST_STORAGE_LOCATIONS}",
|
|
14
18
|
warehouse: warehouse_id),
|
|
15
19
|
headers, &block)
|
|
16
20
|
end
|
|
17
21
|
|
|
18
|
-
def
|
|
22
|
+
def find_location(warehouse_id, storage_location_id, headers = {}, &block)
|
|
19
23
|
get(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_FIND_STORAGE_LOCATIONS}",
|
|
20
24
|
warehouse: warehouse_id,
|
|
21
25
|
storage_location: storage_location_id),
|
|
22
26
|
headers, &block)
|
|
23
27
|
end
|
|
28
|
+
|
|
29
|
+
def list_racks(warehouse_id, headers = {}, &block)
|
|
30
|
+
get(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_LIST_RACKS}",
|
|
31
|
+
warehouse: warehouse_id),
|
|
32
|
+
headers, &block)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def find_racks(warehouse_id, headers = {}, &block)
|
|
36
|
+
get(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_FIND_RACKS}",
|
|
37
|
+
warehouse: warehouse_id),
|
|
38
|
+
headers, &block)
|
|
39
|
+
end
|
|
24
40
|
end
|
|
25
41
|
end
|
|
26
42
|
end
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module Warehouse
|
|
3
5
|
class Stock
|
|
4
6
|
include PlentyClient::Endpoint
|
|
5
7
|
include PlentyClient::Request
|
|
6
8
|
|
|
7
|
-
STOCK_MANAGEMENT_BY_WAREHOUSE_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}'
|
|
9
|
+
STOCK_MANAGEMENT_BY_WAREHOUSE_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}'
|
|
8
10
|
|
|
9
|
-
LIST_STOCK = '/stock'
|
|
10
|
-
LIST_STOCK_BY_LOCATION = '/stock/storageLocations'
|
|
11
|
-
LIST_STOCK_MOVEMENTS = '/stock/movements'
|
|
12
|
-
CORRECT_STOCK = '/stock/correction'
|
|
13
|
-
BOOK_INCOMING_STOCK = '/stock/bookIncomingItems'
|
|
11
|
+
LIST_STOCK = '/stock'
|
|
12
|
+
LIST_STOCK_BY_LOCATION = '/stock/storageLocations'
|
|
13
|
+
LIST_STOCK_MOVEMENTS = '/stock/movements'
|
|
14
|
+
CORRECT_STOCK = '/stock/correction'
|
|
15
|
+
BOOK_INCOMING_STOCK = '/stock/bookIncomingItems'
|
|
14
16
|
|
|
15
17
|
class << self
|
|
16
18
|
def list(warehouse_id, headers = {}, &block)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PlentyClient
|
|
2
4
|
module Warehouse
|
|
3
5
|
include PlentyClient::Endpoint
|
|
4
6
|
include PlentyClient::Request
|
|
5
7
|
|
|
6
|
-
LIST_WAREHOUSES = '/stockmanagement/warehouses'
|
|
7
|
-
FIND_WAREHOUSE = '/stockmanagement/warehouses/{warehouseId}'
|
|
8
|
-
CREATE_WAREHOUSE = '/stockmanagement/warehouses'
|
|
8
|
+
LIST_WAREHOUSES = '/stockmanagement/warehouses'
|
|
9
|
+
FIND_WAREHOUSE = '/stockmanagement/warehouses/{warehouseId}'
|
|
10
|
+
CREATE_WAREHOUSE = '/stockmanagement/warehouses'
|
|
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 Webstore
|
|
3
5
|
include PlentyClient::Endpoint
|
|
4
6
|
include PlentyClient::Request
|
|
5
7
|
|
|
6
|
-
LIST_WEBSTORES = '/webstores'
|
|
8
|
+
LIST_WEBSTORES = '/webstores'
|
|
7
9
|
|
|
8
10
|
class << self
|
|
9
11
|
def list(headers = {}, &block)
|
data/lib/plenty_client.rb
CHANGED
|
@@ -2,6 +2,8 @@ require 'json'
|
|
|
2
2
|
|
|
3
3
|
module PlentyClient
|
|
4
4
|
class ResponseError < StandardError; end
|
|
5
|
+
class AttemptsExceeded < StandardError; end
|
|
6
|
+
class NotFound < ResponseError; end
|
|
5
7
|
|
|
6
8
|
autoload :Config, 'plenty_client/config'
|
|
7
9
|
autoload :Constants, 'plenty_client/constants'
|
|
@@ -29,6 +31,7 @@ module PlentyClient
|
|
|
29
31
|
|
|
30
32
|
module Account
|
|
31
33
|
autoload :Contact, 'plenty_client/account/contact'
|
|
34
|
+
autoload :Address, 'plenty_client/account/address'
|
|
32
35
|
|
|
33
36
|
module Contact
|
|
34
37
|
autoload :Address, 'plenty_client/account/contact/address'
|
|
@@ -105,7 +108,7 @@ module PlentyClient
|
|
|
105
108
|
autoload :Warehouse, 'plenty_client/item/variation/warehouse'
|
|
106
109
|
|
|
107
110
|
module Property
|
|
108
|
-
autoload :Text, 'plenty_client/item/
|
|
111
|
+
autoload :Text, 'plenty_client/item/variation/property/text'
|
|
109
112
|
end
|
|
110
113
|
end
|
|
111
114
|
end
|
|
@@ -149,6 +152,7 @@ module PlentyClient
|
|
|
149
152
|
autoload :Property, 'plenty_client/order/property'
|
|
150
153
|
autoload :Referrer, 'plenty_client/order/referrer'
|
|
151
154
|
autoload :Shipping, 'plenty_client/order/shipping'
|
|
155
|
+
autoload :StatusHistory, 'plenty_client/order/status_history'
|
|
152
156
|
|
|
153
157
|
module Item
|
|
154
158
|
autoload :Date, 'plenty_client/order/item/date'
|
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
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dariusch Ochlast
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-03-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -169,6 +169,7 @@ files:
|
|
|
169
169
|
- Rakefile
|
|
170
170
|
- lib/plenty_client.rb
|
|
171
171
|
- lib/plenty_client/account.rb
|
|
172
|
+
- lib/plenty_client/account/address.rb
|
|
172
173
|
- lib/plenty_client/account/contact.rb
|
|
173
174
|
- lib/plenty_client/account/contact/address.rb
|
|
174
175
|
- lib/plenty_client/account/contact/bank.rb
|
|
@@ -264,6 +265,7 @@ files:
|
|
|
264
265
|
- lib/plenty_client/order/shipping/package.rb
|
|
265
266
|
- lib/plenty_client/order/shipping/profile.rb
|
|
266
267
|
- lib/plenty_client/order/shipping/service_provider.rb
|
|
268
|
+
- lib/plenty_client/order/status_history.rb
|
|
267
269
|
- lib/plenty_client/order_summary.rb
|
|
268
270
|
- lib/plenty_client/payment.rb
|
|
269
271
|
- lib/plenty_client/payment/contact.rb
|
|
@@ -314,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
314
316
|
version: '0'
|
|
315
317
|
requirements: []
|
|
316
318
|
rubyforge_project:
|
|
317
|
-
rubygems_version: 2.
|
|
319
|
+
rubygems_version: 2.7.3
|
|
318
320
|
signing_key:
|
|
319
321
|
specification_version: 4
|
|
320
322
|
summary: This the first draft of a PlentyMarkets Rest Client for Ruby.
|