plenty_client 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/Guardfile +6 -0
- data/README.md +2 -2
- data/lib/plenty_client.rb +43 -0
- data/lib/plenty_client/account.rb +55 -0
- data/lib/plenty_client/account/contact.rb +36 -0
- data/lib/plenty_client/account/contact/address.rb +53 -0
- data/lib/plenty_client/account/contact/bank.rb +38 -0
- data/lib/plenty_client/account/contact/type.rb +38 -0
- data/lib/plenty_client/config.rb +16 -3
- data/lib/plenty_client/endpoint.rb +13 -0
- data/lib/plenty_client/payment.rb +35 -0
- data/lib/plenty_client/payment/contact.rb +21 -0
- data/lib/plenty_client/payment/method.rb +51 -0
- data/lib/plenty_client/payment/method_name.rb +29 -0
- data/lib/plenty_client/payment/order.rb +30 -0
- data/lib/plenty_client/payment/property.rb +48 -0
- data/lib/plenty_client/payment/property/type.rb +38 -0
- data/lib/plenty_client/payment/property/type/name.rb +40 -0
- data/lib/plenty_client/payment/status.rb +16 -0
- data/lib/plenty_client/payment/transaction.rb +16 -0
- data/lib/plenty_client/request.rb +17 -12
- data/lib/plenty_client/stock.rb +24 -0
- data/lib/plenty_client/version.rb +1 -1
- data/lib/plenty_client/warehouse.rb +24 -0
- data/lib/plenty_client/warehouse/management.rb +27 -0
- data/lib/plenty_client/warehouse/management/rack.rb +35 -0
- data/lib/plenty_client/warehouse/management/shelf.rb +38 -0
- data/lib/plenty_client/warehouse/management/storage_location.rb +42 -0
- data/lib/plenty_client/warehouse/stock.rb +48 -0
- data/plenty_client.gemspec +3 -0
- metadata +67 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574a5ae3c92bbeb8b3a23e4e239437d8cfd05b7d
|
4
|
+
data.tar.gz: b47ee0a43f3f5d994f7cbb6ea20409af4d460af0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 126d303536c9d39ca19ab0cee90c6a986d494616fe77a3f13107dcf0f6aeaf2766d32559d0ca04123814227c36015c6c7362636c72a0f35ca0d0d838c3ddf09f
|
7
|
+
data.tar.gz: 5fec7699e2ca87885ca2dc920a5681134ea8de0df84729f7978268c0f763af4448b8ba2e5fd876380908f5a70bb397d0d2b08be4bf8a029808b23603d20f99b9
|
data/.rubocop.yml
CHANGED
data/Guardfile
ADDED
data/README.md
CHANGED
@@ -105,9 +105,9 @@ PlentyClient::Item::Variation.routes
|
|
105
105
|
* [~~`Market`~~](https://developers.plentymarkets.com/rest-doc/market)
|
106
106
|
* [~~`Order`~~](https://developers.plentymarkets.com/rest-doc/order)
|
107
107
|
* [~~`OrderSummary`~~](https://developers.plentymarkets.com/rest-doc/order_summary)
|
108
|
-
* [
|
108
|
+
* [~~`Payment`~~](https://developers.plentymarkets.com/rest-doc/payment)
|
109
109
|
* [`Plugins`](https://developers.plentymarkets.com/rest-doc/plugins)
|
110
|
-
* [
|
110
|
+
* [~~`StockManagement`~~](https://developers.plentymarkets.com/rest-doc/stock_management)
|
111
111
|
* [~~`Ticket`~~](https://developers.plentymarkets.com/rest-doc/ticket)
|
112
112
|
* [~~`Webstore`~~](https://developers.plentymarkets.com/rest-doc/webstore)
|
113
113
|
- missing [OrderItem OrderItemDate](https://developers.plentymarkets.com/rest-doc/order_order_item_order_item_date/details#get-all-order-item-dates-for-one-order-item-by-its-order-item-id) - its just a mess
|
data/lib/plenty_client.rb
CHANGED
@@ -9,6 +9,7 @@ module PlentyClient
|
|
9
9
|
autoload :Request, 'plenty_client/request'
|
10
10
|
autoload :Version, 'plenty_client/version'
|
11
11
|
|
12
|
+
autoload :Account, 'plenty_client/account'
|
12
13
|
autoload :Accounting, 'plenty_client/accounting'
|
13
14
|
autoload :Authentication, 'plenty_client/authentication'
|
14
15
|
autoload :Authorization, 'plenty_client/authorization'
|
@@ -21,8 +22,21 @@ module PlentyClient
|
|
21
22
|
autoload :Listing, 'plenty_client/listing'
|
22
23
|
autoload :Order, 'plenty_client/order'
|
23
24
|
autoload :OrderSummary, 'plenty_client/order_summary'
|
25
|
+
autoload :Payment, 'plenty_client/payment'
|
26
|
+
autoload :Stock, 'plenty_client/stock'
|
27
|
+
autoload :Warehouse, 'plenty_client/warehouse'
|
24
28
|
autoload :Webstore, 'plenty_client/webstore'
|
25
29
|
|
30
|
+
module Account
|
31
|
+
autoload :Contact, 'plenty_client/account/contact'
|
32
|
+
|
33
|
+
module Contact
|
34
|
+
autoload :Address, 'plenty_client/account/contact/address'
|
35
|
+
autoload :Bank, 'plenty_client/account/contact/bank'
|
36
|
+
autoload :Type, 'plenty_client/account/contact/type'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
26
40
|
module Basket
|
27
41
|
autoload :Item, 'plenty_client/basket/item'
|
28
42
|
end
|
@@ -148,6 +162,24 @@ module PlentyClient
|
|
148
162
|
end
|
149
163
|
end
|
150
164
|
|
165
|
+
module Payment
|
166
|
+
autoload :Contact, 'plenty_client/payment/contact'
|
167
|
+
autoload :Method, 'plenty_client/payment/method'
|
168
|
+
autoload :MethodName, 'plenty_client/payment/method_name'
|
169
|
+
autoload :Order, 'plenty_client/payment/order'
|
170
|
+
autoload :Property, 'plenty_client/payment/property'
|
171
|
+
autoload :Status, 'plenty_client/payment/status'
|
172
|
+
autoload :Transaction, 'plenty_client/payment/transaction'
|
173
|
+
|
174
|
+
module Property
|
175
|
+
autoload :Type, 'plenty_client/payment/property/type'
|
176
|
+
|
177
|
+
module Type
|
178
|
+
autoload :Name, 'plenty_client/payment/property/type/name'
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
151
183
|
module SalesPrice
|
152
184
|
autoload :Account, 'plenty_client/sales_price/account'
|
153
185
|
autoload :Country, 'plenty_client/sales_price/country'
|
@@ -157,4 +189,15 @@ module PlentyClient
|
|
157
189
|
autoload :OnlineStore, 'plenty_client/sales_price/online_store'
|
158
190
|
autoload :Referrer, 'plenty_client/sales_price/referrer'
|
159
191
|
end
|
192
|
+
|
193
|
+
module Warehouse
|
194
|
+
autoload :Stock, 'plenty_client/warehouse/stock'
|
195
|
+
autoload :Management, 'plenty_client/warehouse/management'
|
196
|
+
|
197
|
+
module Management
|
198
|
+
autoload :Rack, 'plenty_client/warehouse/management/rack'
|
199
|
+
autoload :Shelf, 'plenty_client/warehouse/management/shelf'
|
200
|
+
autoload :StorageLocation, 'plenty_client/warehouse/management/storage_location'
|
201
|
+
end
|
202
|
+
end
|
160
203
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Account
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
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
|
12
|
+
|
13
|
+
ACCOUNT_LOGIN = '/account/login'.freeze
|
14
|
+
ACCOUNT_REFRESH = '/account/login/refresh'.freeze
|
15
|
+
ACCOUNT_LOGOUT = '/account/logout'.freeze
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def list(headers = {}, &block)
|
19
|
+
get(build_endpoint(LIST_ACCOUNTS), headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def find(account_id, headers = {}, &block)
|
23
|
+
get(build_endpoint(FIND_ACCOUNT, account: account_id), headers, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create(body = {})
|
27
|
+
post(CREATE_ACCOUNT, body)
|
28
|
+
end
|
29
|
+
|
30
|
+
def update(account_id, body = {})
|
31
|
+
put(build_endpoint(UPDATE_ACCOUNT, account: account_id), body)
|
32
|
+
end
|
33
|
+
|
34
|
+
def destroy(account_id, body = {})
|
35
|
+
delete(build_endpoint(DELETE_ACCOUNT, account: account_id), body)
|
36
|
+
end
|
37
|
+
|
38
|
+
def list_contacts(account_id, headers = {}, &block)
|
39
|
+
get(build_endpoint(LIST_ACCOUNTS_CONTACTS, account: account_id), headers, &block)
|
40
|
+
end
|
41
|
+
|
42
|
+
def login(body = {})
|
43
|
+
post(ACCOUNT_LOGIN, body)
|
44
|
+
end
|
45
|
+
|
46
|
+
def refresh_login(body = {})
|
47
|
+
post(ACCOUNT_REFRESH, body)
|
48
|
+
end
|
49
|
+
|
50
|
+
def logout(body = {})
|
51
|
+
post(ACCOUNT_LOGOUT, body)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Account
|
3
|
+
module Contact
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
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
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def list(headers = {}, &block)
|
15
|
+
get(build_endpoint(LIST_A_CONTACTS), headers, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(contact_id, headers = {}, &block)
|
19
|
+
get(build_endpoint(FIND_A_CONTACT, contact: contact_id), headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(body = {})
|
23
|
+
post(CREATE_A_CONTACT, body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def update(contact_id, body = {})
|
27
|
+
put(build_endpoint(UPDATE_A_CONTACT, contact: contact_id), body)
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy(contact_id, body = {})
|
31
|
+
delete(build_endpoint(DELETE_A_CONTACT, contact: contact_id), body)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Account
|
3
|
+
module Contact
|
4
|
+
class Address
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
CONTACT_ADDRESS_BASE_PATH = '/accounts/contacts/{contactId}'.freeze
|
9
|
+
|
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
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def list(contact_id, address_type = '', headers = {}, &block)
|
18
|
+
get(build_endpoint("#{CONTACT_ADDRESS_BASE_PATH}#{LIST_A_CONTACT_ADDRESSES}",
|
19
|
+
contact: contact_id,
|
20
|
+
address_type: address_type),
|
21
|
+
headers, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create(body = {})
|
25
|
+
post("#{CONTACT_ADDRESS_BASE_PATH}#{CREATE_A_CONTACT_ADDRESS}", body)
|
26
|
+
end
|
27
|
+
|
28
|
+
def update(contact_id, address_id, body = {})
|
29
|
+
put(build_endpoint("#{CONTACT_ADDRESS_BASE_PATH}#{UPDATE_A_CONTACT_ADDRESS}",
|
30
|
+
contact: contact_id,
|
31
|
+
address: address_id),
|
32
|
+
body)
|
33
|
+
end
|
34
|
+
|
35
|
+
def destroy(contact_id, address_id, body = {})
|
36
|
+
delete(build_endpoint("#{CONTACT_ADDRESS_BASE_PATH}#{DELETE_A_CONTACT_ADDRESS}",
|
37
|
+
contact: contact_id,
|
38
|
+
address: address_id),
|
39
|
+
body)
|
40
|
+
end
|
41
|
+
|
42
|
+
def update_primary(contact_id, address_id, address_type, body = {})
|
43
|
+
put(build_endpoint("#{CONTACT_ADDRESS_BASE_PATH}#{SET_PRIMARY_CONTACT_ADDRESS}",
|
44
|
+
contact: contact_id,
|
45
|
+
address: address_id,
|
46
|
+
address_type: address_type),
|
47
|
+
body)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Account
|
3
|
+
module Contact
|
4
|
+
class Bank
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
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
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def list(contact_id, headers = {}, &block)
|
16
|
+
get(build_endpoint(LIST_A_CONTACT_PAYMENTS, contact: contact_id), headers, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def find(contact_bank_id, headers = {}, &block)
|
20
|
+
get(build_endpoint(FIND_A_CONTACT_PAYMENT, contact_bank: contact_bank_id), headers, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def create(body = {})
|
24
|
+
post(CREATE_A_CONTACT_PAYMENT, body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def update(contact_bank_id, body = {})
|
28
|
+
put(build_endpoint(UPDATE_A_CONTACT_PAYMENT, contact_bank: contact_bank_id), body)
|
29
|
+
end
|
30
|
+
|
31
|
+
def destroy(contact_bank_id, body = {})
|
32
|
+
delete(build_endpoint(DELETE_A_CONTACT_PAYMENT, contact_bank: contact_bank_id), body)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Account
|
3
|
+
module Contact
|
4
|
+
class Type
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
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
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def list(headers = {}, &block)
|
16
|
+
get(build_endpoint(LIST_A_CONTACT_TYPES), headers, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def find(type, headers = {}, &block)
|
20
|
+
get(build_endpoint(FIND_A_CONTACT_TYPE, type: type), headers, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def create(body = {})
|
24
|
+
post(CREATE_A_CONTACT_TYPE, body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def update(type, body = {})
|
28
|
+
put(build_endpoint(UPDATE_A_CONTACT_TYPE, type: type), body)
|
29
|
+
end
|
30
|
+
|
31
|
+
def destroy(type, body = {})
|
32
|
+
delete(build_endpoint(DELETE_A_CONTACT_TYPE, type: type), body)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/plenty_client/config.rb
CHANGED
@@ -3,14 +3,27 @@ module PlentyClient
|
|
3
3
|
class NoCredentials < StandardError; end
|
4
4
|
class NoToken < StandardError; end
|
5
5
|
class NoPlentyId < StandardError; end
|
6
|
+
class InvalidCredentials < StandardError; end
|
7
|
+
|
8
|
+
# When expiry_date is less than this many seconds from now, it should renew API keys
|
9
|
+
LOGIN_RENEW_BUFFER = 60
|
6
10
|
|
7
11
|
class << self
|
8
12
|
attr_accessor :site_url, :api_user, :api_password, :access_token, :refresh_token, :log, :expiry_date, :plenty_id
|
9
13
|
|
10
|
-
def
|
14
|
+
def validate_credentials
|
11
15
|
raise NoCredentials if site_url.nil? || api_user.nil? || api_password.nil?
|
12
|
-
|
13
|
-
|
16
|
+
end
|
17
|
+
|
18
|
+
def tokens_present?
|
19
|
+
!access_token.nil? && !refresh_token.nil?
|
20
|
+
end
|
21
|
+
|
22
|
+
def tokens_valid?
|
23
|
+
tokens_present? &&
|
24
|
+
expiry_date.instance_of?(Time) &&
|
25
|
+
expiry_date > Time.now &&
|
26
|
+
(expiry_date - Time.now > LOGIN_RENEW_BUFFER)
|
14
27
|
end
|
15
28
|
end
|
16
29
|
end
|
@@ -11,6 +11,7 @@ module PlentyClient
|
|
11
11
|
endpoint_parameters = {
|
12
12
|
account: /\{accountId\}/,
|
13
13
|
address: /\{addressId\}/,
|
14
|
+
address_type: /\{addressTypeId\}/,
|
14
15
|
account_ype: /\{accountType\}/,
|
15
16
|
attribute: /\{attributeId\}/,
|
16
17
|
attribute_value: /\{attributeValueId\}/,
|
@@ -21,6 +22,7 @@ module PlentyClient
|
|
21
22
|
component: /\{componentId\}/,
|
22
23
|
comment: /\{commentId\}/,
|
23
24
|
contact: /\{contactId\}/,
|
25
|
+
contact_bank: /\{contactBankId\}/,
|
24
26
|
country: /\{countryId\}/,
|
25
27
|
coupon_string: /\{coupon\}/,
|
26
28
|
credentials: /\{credentialsId\}/,
|
@@ -44,25 +46,36 @@ module PlentyClient
|
|
44
46
|
market_listing_history: /\{marketListingHistoryId\}/,
|
45
47
|
market_text: /\{marketTextId\}/,
|
46
48
|
marketplace: /\{marketplaceId\}/,
|
49
|
+
name: /\{nameId\}/,
|
47
50
|
option_template: /\{optionTemplateId}/,
|
48
51
|
order: /\{orderId\}/,
|
49
52
|
order_item: /\{orderItemId\}/,
|
50
53
|
order_summary: /\{orderSummaryId\}/,
|
54
|
+
payment: /\{paymentId\}/,
|
55
|
+
payment_method: /\{paymenMethodId\}/,
|
51
56
|
parent_referrer: /\{parentReferrerId\}/,
|
52
57
|
plenty: /\{plentyId\}/,
|
58
|
+
plugin_key: /\{pluginKey\}/,
|
53
59
|
preset: /\{presetId\}/,
|
60
|
+
property_type: /\{propertyTypeId\}/,
|
61
|
+
property_value: /\{propertyValue\}/,
|
54
62
|
price: /\{priceId\}/,
|
55
63
|
property_group: /\{propertyGroupId\}/,
|
56
64
|
property: /\{propertyId\}/,
|
65
|
+
rack: /\{rackId\}/,
|
57
66
|
referrer: /\{referrerId\}/,
|
58
67
|
reference_type: /\{referenceType\}/,
|
59
68
|
reference_value: /\{referenceValue\}/,
|
60
69
|
sales_price: /\{salesPriceId\}/,
|
70
|
+
shelf: /\{shelfId\}/,
|
61
71
|
shipping_profile: /\{shippingProfileId\}/,
|
62
72
|
shipping_package: /\{orderShippingPackageId\}/,
|
63
73
|
shipping_service_provider: /\{shippingServiceProviderID\}/,
|
64
74
|
sku: /\{skuId\}/,
|
75
|
+
status: /\{statusId\}/,
|
76
|
+
storage_location: /\{storageLocationId\}/,
|
65
77
|
ticket: /\{ticketId\}/,
|
78
|
+
transaction_type: /\{transactionTypeId\}/,
|
66
79
|
type: /\{typeId\}/,
|
67
80
|
type_string: /\{type\}/,
|
68
81
|
unit: /\{unitId\}/,
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
6
|
+
LIST_PAYMENTS = '/payments'.freeze
|
7
|
+
FIND_PAYMENT = '/payments/{paymentId}'.freeze
|
8
|
+
CREATE_PAYMENT = '/payments'.freeze
|
9
|
+
UPDATE_PAYMENT = '/payments/{paymentId}'.freeze
|
10
|
+
PAYMENT_ENTRYDATE = '/payments/entrydate'.freeze
|
11
|
+
PAYMENT_IMPORTDATE = '/payments/importdate'.freeze
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def list(headers = {}, &block)
|
15
|
+
get(build_endpoint(LIST_PAYMENT), headers, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(payment_id, headers = {}, &block)
|
19
|
+
get(build_endpoint(FIND_PAYMENT, payment: payment_id), headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def update(payment_id, body = {})
|
23
|
+
put(build_endpoint(FIND_PAYMENT, payment: payment_id), body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def list_by_entry_date(headers = {}, &block)
|
27
|
+
get(build_endpoint(PAYMENT_ENTRYDATE), headers, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def list_by_import_date(headers = {}, &block)
|
31
|
+
get(build_endpoint(PAYMENT_IMPORTDATE), headers, &block)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
class Contact
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
CREATE_PAYMENT_CONTACT_RELATION = '/payment/{paymentId}/contact/{contactId}'.freeze
|
8
|
+
DELETE_CONTACTS_PAYMENT = '/payment/{paymentId}/contact'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def create(payment_id, contact_id, body = {})
|
12
|
+
post(build_endpoint(CREATE_PAYMENT_CONTACT_RELATION, payment: payment_id, contact: contact_id), body)
|
13
|
+
end
|
14
|
+
|
15
|
+
def destroy(payment_id, body = {})
|
16
|
+
delete(build_endpoint(DELETE_CONTACTS_PAYMENT, payment: payment_id), body)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
module Method
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
LIST_PAYMENT_METHODS = '/payments/methods'.freeze
|
8
|
+
FIND_PAYMENT_METHOD = '/payments/methods/{paymentMethodId}'.freeze
|
9
|
+
FIND_PLUGIN_PAYMENT_METHOD = '/payments/methods/{pluginKey}'.freeze
|
10
|
+
CREATE_PAYMENT_METHOD = '/payments/methods'.freeze
|
11
|
+
UPDATE_PAYMENT_METHOD = '/payments/methods'.freeze
|
12
|
+
UPDATE_PAYMENT_METHOD_WITH_ID = '/payments/methods/{pluginKey}'.freeze
|
13
|
+
LIST_PAYMENT_EBICS_ACCOUNTS = '/payments/methods/ebics'.freeze
|
14
|
+
CREATE_PAYMENT_EBICS_ACCOUNT = '/payments/methods/ebics'.freeze
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def list(headers = {}, &block)
|
18
|
+
get(build_endpoint(LIST_PAYMENT_METHODS), headers, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def find(method_id, headers = {}, &block)
|
22
|
+
get(build_endpoint(FIND_PAYMENT_METHOD, payment_method: method_id), headers, &block)
|
23
|
+
end
|
24
|
+
|
25
|
+
def find_by_plugin_key(plugin_key, headers = {}, &block)
|
26
|
+
get(build_endpoint(FIND_PLUGIN_PAYMENT_METHOD, plugin_key: plugin_key), headers, &block)
|
27
|
+
end
|
28
|
+
|
29
|
+
def create(body = {})
|
30
|
+
post(build_endpoint(CREATE_PAYMENT_METHOD), body)
|
31
|
+
end
|
32
|
+
|
33
|
+
def update(body = {})
|
34
|
+
put(build_endpoint(UPDATE_PAYMENT_METHOD), body)
|
35
|
+
end
|
36
|
+
|
37
|
+
# def update(plugin_key, body = {})
|
38
|
+
# put(build_endpoint(UPDATE_PAYMENT_METHOD_WITH_ID, plugin_key: plugin_key), body)
|
39
|
+
# end
|
40
|
+
|
41
|
+
def list_ebics_accounts(headers = {}, &block)
|
42
|
+
get(build_endpoint(LIST_PAYMENT_EBICS_ACCOUNTS), headers, &block)
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_ebics_account(body = {})
|
46
|
+
post(build_endpoint(CREATE_PAYMENT_EBICS_ACCOUNT), body)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
module MethodName
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
LIST_METHOD_NAMES = '/payments/methodNames'.freeze
|
8
|
+
LIST_METHOD_NAMES_FOR_PAYMENT_METHOD = '/payments/methodNames/{paymentMethodId}'.freeze
|
9
|
+
FIND_METHOD_NAMES_FOR_PAYMENT_METHOD_BY_LANG = '/payments/methodNames/{paymentMethodId}/{land}'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def list(headers = {}, &block)
|
13
|
+
get(build_endpoint(LIST_METHOD_NAMES), headers, &block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def list_for_payment_method(payment_method_id, headers = {}, &block)
|
17
|
+
get(build_endpoint(LIST_METHOD_NAMES, payment_method: payment_method_id), headers, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def list_for_payment_method_by_lang(payment_method_id, lang, headers = {}, &block)
|
21
|
+
get(build_endpoint(LIST_METHOD_NAMES_FOR_PAYMENT_METHOD,
|
22
|
+
payment_method: payment_method_id,
|
23
|
+
lang: lang),
|
24
|
+
headers, &block)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
class Order
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
LIST_ORDERS_PAYMENTS = '/payments/orders/{orderId}'.freeze
|
8
|
+
CREATE_PAYMENT_ORDER_RELATION = '/payment/{paymentId}/order/{orderId}'.freeze
|
9
|
+
DELETE_ORDERS_PAYMENT = '/payment/{paymentId}/order'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def list(order_id, headers = {}, &block)
|
13
|
+
get(build_endpoint(LIST_ORDERS_PAYMENTS, order: order_id), headers, &block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def create(payment_id, order_id, body = {})
|
17
|
+
post(build_endpoint(CREATE_PAYMENT_ORDER_RELATION, payment: payment_id, order: order_id), body)
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy(payment_id, body = {})
|
21
|
+
delete(build_endpoint(DELETE_ORDERS_PAYMENT, payment: payment_id), body)
|
22
|
+
end
|
23
|
+
|
24
|
+
# def update(payment_id, body = {})
|
25
|
+
# post(build_endpoint(UPDATE_PAYMENT_PROPERTY_WITH_ID, payment: payment_id), body)
|
26
|
+
# end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
module Property
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
LIST_PAYMENT_PROPERTIES = '/payments/properties'.freeze
|
8
|
+
LIST_PAYMENT_PROPERTIES_BY_PAYMENT = '/payments/{paymentId}/properties'.freeze
|
9
|
+
FIND_PLUGIN_PAYMENT_PROPERTY = '/payments/properties/{propertyId}'.freeze
|
10
|
+
CREATE_PAYMENT_PROPERTY = '/payments/properties'.freeze
|
11
|
+
UPDATE_PAYMENT_PROPERTY_WITH_ID = '/payments/properties/{propertyId}'.freeze
|
12
|
+
UPDATE_PAYMENT_PROPERTY = '/payments/properties'.freeze
|
13
|
+
LIST_P_PROPERTIES_BY_TYPE_AND_VALUE = '/payments/property/{propertyTypeId}/{propertyValue}'.freeze
|
14
|
+
class << self
|
15
|
+
def list(headers = {}, &block)
|
16
|
+
get(build_endpoint(LIST_PAYMENT_PROPERTIES), headers, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def list_by_payment_id(payment_id, headers = {}, &block)
|
20
|
+
get(build_endpoint(LIST_PAYMENT_PROPERTIES_BY_PAYMENT, payment: payment_id), headers, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def list_by_type_and_value(property_type_id, property_value, headers = {}, &block)
|
24
|
+
get(build_endpoint(LIST_P_PROPERTIES_BY_TYPE_AND_VALUE,
|
25
|
+
property_type: property_type_id,
|
26
|
+
property_value: property_value),
|
27
|
+
headers, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def find(payment_id, headers = {}, &block)
|
31
|
+
get(build_endpoint(FIND_PLUGIN_PAYMENT_PROPERTY, payment: payment_id), headers, &block)
|
32
|
+
end
|
33
|
+
|
34
|
+
def create(body = {})
|
35
|
+
post(build_endpoint(CREATE_PAYMENT_PROPERTY), body)
|
36
|
+
end
|
37
|
+
|
38
|
+
def update(body = {})
|
39
|
+
put(build_endpoint(UPDATE_PAYMENT_PROPERTY), body)
|
40
|
+
end
|
41
|
+
|
42
|
+
# def update(payment_id, body = {})
|
43
|
+
# post(build_endpoint(UPDATE_PAYMENT_PROPERTY_WITH_ID, payment: payment_id), body)
|
44
|
+
# end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
module Property
|
4
|
+
module Type
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
LIST_PAYMENT_PROPERTY_TYPES = '/payments/properties/types'.freeze
|
9
|
+
FIND_PAYMENT_PROPERTY_TYPE = '/payments/properties/types/{typeId}'.freeze
|
10
|
+
CREATE_PAYMENT_PROPERTY_TYPE = '/payments/properties/types'.freeze
|
11
|
+
UPDATE_PAYMENT_PROPERTY_TYPE_WITH_ID = '/payments/properties/types/{typeId}'.freeze
|
12
|
+
UPDATE_PAYMENT_PROPERTY_TYPE = '/payments/properties/types'.freeze
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def list(headers = {}, &block)
|
16
|
+
get(build_endpoint(LIST_PAYMENT_PROPERTY_TYPES), headers, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def find(type_id, headers = {}, &block)
|
20
|
+
get(build_endpoint(FIND_PAYMENT_PROPERTY_TYPE, type: type_id), headers, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def create(body = {})
|
24
|
+
post(build_endpoint(CREATE_PAYMENT_PROPERTY_TYPE), body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def update(body = {})
|
28
|
+
put(build_endpoint(UPDATE_PAYMENT_PROPERTY_TYPE), body)
|
29
|
+
end
|
30
|
+
|
31
|
+
# def update(type_id, body = {})
|
32
|
+
# post(build_endpoint(UPDATE_PAYMENT_PROPERTY_TYPE_WITH_ID, payment: type_id), body)
|
33
|
+
# end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
module Property
|
4
|
+
module Type
|
5
|
+
class Name
|
6
|
+
include PlentyClient::Endpoint
|
7
|
+
include PlentyClient::Request
|
8
|
+
|
9
|
+
LIST_PAYMENT_PROPERTY_TYPE_NAMES = '/payments/properties/types/names/{lang}'.freeze
|
10
|
+
FIND_PAYMENT_PROPERTY_TYPE_NAME = '/payments/properties/types/names/{nameId}'.freeze
|
11
|
+
CREATE_PAYMENT_PROPERTY_TYPE_NAME = '/payments/properties/types/names'.freeze
|
12
|
+
UPDATE_PAYMENT_PROPERTY_TYPE_NAME_WITH_ID = '/payments/properties/types/names/{nameId}'.freeze
|
13
|
+
UPDATE_PAYMENT_PROPERTY_TYPE_NAME = '/payments/properties/types/names'.freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def list(lang, headers = {}, &block)
|
17
|
+
get(build_endpoint(LIST_PAYMENT_PROPERTY_TYPE_NAMES, lang: lang), headers, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def find(name_id, headers = {}, &block)
|
21
|
+
get(build_endpoint(FIND_PAYMENT_PROPERTY_TYPE_NAME, name: name_id), headers, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create(body = {})
|
25
|
+
post(build_endpoint(CREATE_PAYMENT_PROPERTY_TYPE_NAME), body)
|
26
|
+
end
|
27
|
+
|
28
|
+
def update(body = {})
|
29
|
+
put(build_endpoint(UPDATE_PAYMENT_PROPERTY_TYPE_NAME), body)
|
30
|
+
end
|
31
|
+
|
32
|
+
# def update(type_id, body = {})
|
33
|
+
# post(build_endpoint(UPDATE_PAYMENT_PROPERTY_TYPE_NAME_WITH_ID, payment: type_id), body)
|
34
|
+
# end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
class Status
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_PAYMENT_STATUS = '/payments/status/{statusId}'.freeze
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def find(status_id, headers = {}, &block)
|
11
|
+
get(build_endpoint(FIND_PAYMENT_STATUS, status: status_id), headers, &block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Payment
|
3
|
+
class Transaction
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_PAYMENT_TRANSACTIONS = '/payments/transactions/{transactionTypeId}'.freeze
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def find(transaction_type_id, headers = {}, &block)
|
11
|
+
get(build_endpoint(FIND_PAYMENT_TRANSACTIONS, transaction_type: transaction_type_id), headers, &block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -6,11 +6,9 @@ module PlentyClient
|
|
6
6
|
module ClassMethods
|
7
7
|
def request(http_method, path, params = {})
|
8
8
|
return false if http_method.nil? || path.nil?
|
9
|
-
return false unless %w
|
9
|
+
return false unless %w[post put patch delete get].include?(http_method.to_s)
|
10
10
|
|
11
|
-
|
12
|
-
login_check
|
13
|
-
end
|
11
|
+
login_check unless PlentyClient::Config.tokens_valid?
|
14
12
|
parse_body(perform(http_method, path, params))
|
15
13
|
end
|
16
14
|
|
@@ -35,13 +33,13 @@ module PlentyClient
|
|
35
33
|
rval_array = []
|
36
34
|
if block_given?
|
37
35
|
loop do
|
38
|
-
response = request(:get, path, params.merge(page
|
39
|
-
yield response['entries']
|
40
|
-
page += 1
|
36
|
+
response = request(:get, path, params.merge('page' => page))
|
37
|
+
yield response['entries']
|
41
38
|
break if response['isLastPage'] == true
|
39
|
+
page += 1
|
42
40
|
end
|
43
41
|
else
|
44
|
-
rval_array = request(:get, path,
|
42
|
+
rval_array = request(:get, path, { 'page' => page }.merge(params))
|
45
43
|
end
|
46
44
|
return rval_array.flatten if rval_array.is_a?(Array)
|
47
45
|
rval_array
|
@@ -50,6 +48,7 @@ module PlentyClient
|
|
50
48
|
private
|
51
49
|
|
52
50
|
def login_check
|
51
|
+
PlentyClient::Config.validate_credentials
|
53
52
|
response = perform(:post, '/login', username: PlentyClient::Config.api_user,
|
54
53
|
password: PlentyClient::Config.api_password)
|
55
54
|
result = parse_body(response)
|
@@ -68,7 +67,7 @@ module PlentyClient
|
|
68
67
|
end
|
69
68
|
end
|
70
69
|
conn.adapter :typhoeus
|
71
|
-
converted_parameters = %w
|
70
|
+
converted_parameters = %w[get delete].include?(http_method.to_s.downcase) ? params : params.to_json
|
72
71
|
conn.send(http_method.to_s.downcase, base_url(path), converted_parameters)
|
73
72
|
end
|
74
73
|
|
@@ -91,25 +90,31 @@ module PlentyClient
|
|
91
90
|
def parse_body(response)
|
92
91
|
result = JSON.parse(response.body)
|
93
92
|
errors = error_check(result)
|
94
|
-
raise PlentyClient::ResponseError, [*errors].join(', ') unless errors
|
93
|
+
raise PlentyClient::ResponseError, [*errors].join(', ') unless !errors || errors&.empty?
|
95
94
|
result
|
96
95
|
end
|
97
96
|
|
98
97
|
def error_check(response)
|
99
98
|
rval = []
|
100
|
-
return rval if response
|
99
|
+
return rval if !response || response&.empty?
|
101
100
|
if response.is_a?(Array) && response.first.key?('error')
|
101
|
+
check_for_invalid_credentials(response.first)
|
102
102
|
response.each do |res|
|
103
103
|
rval << extract_message(res)
|
104
104
|
end
|
105
105
|
elsif response.is_a?(Hash) && response.key?('error')
|
106
|
+
check_for_invalid_credentials(response)
|
106
107
|
rval << extract_message(response)
|
107
108
|
end
|
108
109
|
rval
|
109
110
|
end
|
110
111
|
|
112
|
+
def check_for_invalid_credentials(response)
|
113
|
+
raise PlentyClient::Config::InvalidCredentials if response['error'] == 'invalid_credentials'
|
114
|
+
end
|
115
|
+
|
111
116
|
def extract_message(response)
|
112
|
-
if response.key?('validation_errors') && !response['validation_errors']
|
117
|
+
if response.key?('validation_errors') && response['validation_errors'] && !response['validation_errors']&.empty?
|
113
118
|
response['validation_errors'].values.flatten.join(', ')
|
114
119
|
else
|
115
120
|
response['error']['message']
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Stock
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
6
|
+
LIST_STOCK = '/stockmanagement/stock'.freeze
|
7
|
+
LIST_STOCK_BY_TYPE = '/stockmanagement/stock/types/{type}'.freeze
|
8
|
+
REDISTRIBUTE_STOCK = '/stockmanagement/stock/redistribute'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def list(headers = {}, &block)
|
12
|
+
get(build_endpoint(LIST_STOCK), headers, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def list_by_type(type_string, headers = {}, &block)
|
16
|
+
get(build_endpoint(LIST_STOCK_BY_TYPE, type_string: type_string), headers, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def redistribute(body = {})
|
20
|
+
put(build_endpoint(REDISTRIBUTE_STOCK), body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Warehouse
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
6
|
+
LIST_WAREHOUSES = '/stockmanagement/warehouses'.freeze
|
7
|
+
FIND_WAREHOUSE = '/stockmanagement/warehouses/{warehouseId}'.freeze
|
8
|
+
CREATE_WAREHOUSE = '/stockmanagement/warehouses'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def list(headers = {}, &block)
|
12
|
+
get(build_endpoint(LIST_WAREHOUSES), headers, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def find(warehouse_id, headers = {}, &block)
|
16
|
+
get(build_endpoint(FIND_WAREHOUSE, warehouse: warehouse_id), headers, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def create(body = {})
|
20
|
+
post(build_endpoint(CREATE_WAREHOUSE), body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Warehouse
|
3
|
+
module Management
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
WM_STORAGE_LOCATION_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'.freeze
|
8
|
+
WM_LIST_STORAGE_LOCATIONS = '/storageLocations'.freeze
|
9
|
+
WM_FIND_STORAGE_LOCATIONS = '/storageLocations/{storageLocationId}'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def list(warehouse_id, headers = {}, &block)
|
13
|
+
get(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_LIST_STORAGE_LOCATIONS}",
|
14
|
+
warehouse: warehouse_id),
|
15
|
+
headers, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(warehouse_id, storage_location_id, headers = {}, &block)
|
19
|
+
get(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_FIND_STORAGE_LOCATIONS}",
|
20
|
+
warehouse: warehouse_id,
|
21
|
+
storage_location: storage_location_id),
|
22
|
+
headers, &block)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Warehouse
|
3
|
+
module Management
|
4
|
+
class Rack
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
WM_WAREHOUSE_MGMT_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'.freeze
|
9
|
+
|
10
|
+
WM_LIST_RACKS = '/racks'.freeze
|
11
|
+
WM_FIND_RACKS = '/racks/{rackId}'.freeze
|
12
|
+
WM_CREATE_RACK = '/racks'.freeze
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def list(warehouse_id, headers = {}, &block)
|
16
|
+
get(build_endpoint("#{WM_WAREHOUSE_MGMT_BASE_PATH}#{WM_LIST_RACKS}",
|
17
|
+
warehouse: warehouse_id),
|
18
|
+
headers, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def find(warehouse_id, rack_id, headers = {}, &block)
|
22
|
+
get(build_endpoint("#{WM_WAREHOUSE_MGMT_BASE_PATH}#{WM_FIND_RACKS}",
|
23
|
+
warehouse: warehouse_id,
|
24
|
+
rack: rack_id),
|
25
|
+
headers, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create(warehouse_id, body = {})
|
29
|
+
post(build_endpoint("#{WM_WAREHOUSE_MGMT_BASE_PATH}#{WM_CREATE_RACK}", warehouse: warehouse_id), body)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Warehouse
|
3
|
+
module Management
|
4
|
+
class Shelf
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
WM_WAREHOUSE_MGMT_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'.freeze
|
9
|
+
|
10
|
+
WM_LIST_SHELF = '/racks/{rackId}/shelves'.freeze
|
11
|
+
WM_FIND_SHELF = '/racks/{rackId}/shelves/{shelfId}'.freeze
|
12
|
+
WM_CREATE_SHELF = '/racks/{rackId}/shelves'.freeze
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def list(warehouse_id, rack_id, headers = {}, &block)
|
16
|
+
get(build_endpoint("#{WM_WAREHOUSE_MGMT_BASE_PATH}#{WM_LIST_SHELF}",
|
17
|
+
warehouse: warehouse_id, rack: rack_id),
|
18
|
+
headers, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def find(warehouse_id, rack_id, shelf_id, headers = {}, &block)
|
22
|
+
get(build_endpoint("#{WM_WAREHOUSE_MGMT_BASE_PATH}#{WM_FIND_SHELF}",
|
23
|
+
warehouse: warehouse_id,
|
24
|
+
rack: rack_id,
|
25
|
+
shelf: shelf_id),
|
26
|
+
headers, &block)
|
27
|
+
end
|
28
|
+
|
29
|
+
def create(warehouse_id, rack_id, body = {})
|
30
|
+
post(build_endpoint("#{WM_WAREHOUSE_MGMT_BASE_PATH}#{WM_CREATE_SHELF}",
|
31
|
+
warehouse: warehouse_id, rack: rack_id),
|
32
|
+
body)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Warehouse
|
3
|
+
module Management
|
4
|
+
class StorageLocation
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
WM_STORAGE_LOCATION_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}/management'.freeze
|
9
|
+
WM_SL_LIST_STORAGE_LOCATIONS = '/racks/{rackId}/shelves/{shelfId}/storageLocations'.freeze
|
10
|
+
WM_SL_FIND_STORAGE_LOCATIONS = '/racks/{rackId}/shelves/{shelfId}/storageLocations/{storageLocationId}'.freeze
|
11
|
+
WM_SL_CREATE_STORAGE_LOCATION = '/racks/{rackId}/shelves/{shelfId}/storageLocations'.freeze
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def list(warehouse_id, rack_id, shelf_id, headers = {}, &block)
|
15
|
+
get(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_SL_LIST_STORAGE_LOCATIONS}",
|
16
|
+
warehouse: warehouse_id,
|
17
|
+
rack: rack_id,
|
18
|
+
shelf: shelf_id),
|
19
|
+
headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def find(warehouse_id, rack_id, shelf_id, storage_location_id, headers = {}, &block)
|
23
|
+
get(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_SL_FIND_STORAGE_LOCATIONS}",
|
24
|
+
warehouse: warehouse_id,
|
25
|
+
rack: rack_id,
|
26
|
+
shelf: shelf_id,
|
27
|
+
storage_location: storage_location_id),
|
28
|
+
headers, &block)
|
29
|
+
end
|
30
|
+
|
31
|
+
def create(warehouse_id, rack_id, shelf_id, body = {})
|
32
|
+
post(build_endpoint("#{WM_STORAGE_LOCATION_BASE_PATH}#{WM_SL_CREATE_STORAGE_LOCATION}",
|
33
|
+
warehouse: warehouse_id,
|
34
|
+
rack: rack_id,
|
35
|
+
shelf: shelf_id),
|
36
|
+
body)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Warehouse
|
3
|
+
class Stock
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
STOCK_MANAGEMENT_BY_WAREHOUSE_BASE_PATH = '/stockmanagement/warehouses/{warehouseId}'.freeze
|
8
|
+
|
9
|
+
LIST_STOCK = '/stock'.freeze
|
10
|
+
LIST_STOCK_BY_LOCATION = '/stock/storageLocations'.freeze
|
11
|
+
LIST_STOCK_MOVEMENTS = '/stock/movements'.freeze
|
12
|
+
CORRECT_STOCK = '/stock/correction'.freeze
|
13
|
+
BOOK_INCOMING_STOCK = '/stock/bookIncomingItems'.freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def list(warehouse_id, headers = {}, &block)
|
17
|
+
get(build_endpoint("#{STOCK_MANAGEMENT_BY_WAREHOUSE_BASE_PATH}#{LIST_STOCK}",
|
18
|
+
warehouse: warehouse_id),
|
19
|
+
headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def list_movements(warehouse_id, headers = {}, &block)
|
23
|
+
get(build_endpoint("#{STOCK_MANAGEMENT_BY_WAREHOUSE_BASE_PATH}#{LIST_STOCK_MOVEMENTS}",
|
24
|
+
warehouse: warehouse_id),
|
25
|
+
headers, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def list_by_location(warehouse_id, headers = {}, &block)
|
29
|
+
get(build_endpoint("#{STOCK_MANAGEMENT_BY_WAREHOUSE_BASE_PATH}#{LIST_STOCK_BY_LOCATION}",
|
30
|
+
warehouse: warehouse_id),
|
31
|
+
headers, &block)
|
32
|
+
end
|
33
|
+
|
34
|
+
def correction(warehouse_id, body = {})
|
35
|
+
put(build_endpoint("#{STOCK_MANAGEMENT_BY_WAREHOUSE_BASE_PATH}#{CORRECT_STOCK}",
|
36
|
+
warehouse: warehouse_id),
|
37
|
+
body)
|
38
|
+
end
|
39
|
+
|
40
|
+
def book_incoming(warehouse_id, body = {})
|
41
|
+
put(build_endpoint("#{STOCK_MANAGEMENT_BY_WAREHOUSE_BASE_PATH}#{BOOK_INCOMING_STOCK}",
|
42
|
+
warehouse: warehouse_id),
|
43
|
+
body)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/plenty_client.gemspec
CHANGED
@@ -23,6 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.13'
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
+
spec.add_development_dependency 'webmock', '~> 3.0'
|
27
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
28
|
+
spec.add_development_dependency 'pry', '~> 0.11'
|
26
29
|
|
27
30
|
spec.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.0'
|
28
31
|
spec.add_runtime_dependency 'faraday', '~> 0.9'
|
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.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dariusch Ochlast
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,48 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.7'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.7'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.11'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.11'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: json
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,10 +163,16 @@ files:
|
|
121
163
|
- ".travis.yml"
|
122
164
|
- CODE_OF_CONDUCT.md
|
123
165
|
- Gemfile
|
166
|
+
- Guardfile
|
124
167
|
- LICENSE.txt
|
125
168
|
- README.md
|
126
169
|
- Rakefile
|
127
170
|
- lib/plenty_client.rb
|
171
|
+
- lib/plenty_client/account.rb
|
172
|
+
- lib/plenty_client/account/contact.rb
|
173
|
+
- lib/plenty_client/account/contact/address.rb
|
174
|
+
- lib/plenty_client/account/contact/bank.rb
|
175
|
+
- lib/plenty_client/account/contact/type.rb
|
128
176
|
- lib/plenty_client/accounting.rb
|
129
177
|
- lib/plenty_client/authentication.rb
|
130
178
|
- lib/plenty_client/authorization.rb
|
@@ -217,6 +265,16 @@ files:
|
|
217
265
|
- lib/plenty_client/order/shipping/profile.rb
|
218
266
|
- lib/plenty_client/order/shipping/service_provider.rb
|
219
267
|
- lib/plenty_client/order_summary.rb
|
268
|
+
- lib/plenty_client/payment.rb
|
269
|
+
- lib/plenty_client/payment/contact.rb
|
270
|
+
- lib/plenty_client/payment/method.rb
|
271
|
+
- lib/plenty_client/payment/method_name.rb
|
272
|
+
- lib/plenty_client/payment/order.rb
|
273
|
+
- lib/plenty_client/payment/property.rb
|
274
|
+
- lib/plenty_client/payment/property/type.rb
|
275
|
+
- lib/plenty_client/payment/property/type/name.rb
|
276
|
+
- lib/plenty_client/payment/status.rb
|
277
|
+
- lib/plenty_client/payment/transaction.rb
|
220
278
|
- lib/plenty_client/request.rb
|
221
279
|
- lib/plenty_client/sales_price/account.rb
|
222
280
|
- lib/plenty_client/sales_price/country.rb
|
@@ -225,8 +283,15 @@ files:
|
|
225
283
|
- lib/plenty_client/sales_price/name.rb
|
226
284
|
- lib/plenty_client/sales_price/online_store.rb
|
227
285
|
- lib/plenty_client/sales_price/referrer.rb
|
286
|
+
- lib/plenty_client/stock.rb
|
228
287
|
- lib/plenty_client/ticket.rb
|
229
288
|
- lib/plenty_client/version.rb
|
289
|
+
- lib/plenty_client/warehouse.rb
|
290
|
+
- lib/plenty_client/warehouse/management.rb
|
291
|
+
- lib/plenty_client/warehouse/management/rack.rb
|
292
|
+
- lib/plenty_client/warehouse/management/shelf.rb
|
293
|
+
- lib/plenty_client/warehouse/management/storage_location.rb
|
294
|
+
- lib/plenty_client/warehouse/stock.rb
|
230
295
|
- lib/plenty_client/webstore.rb
|
231
296
|
- plenty_client.gemspec
|
232
297
|
homepage: https://github.com/Dariusch/plenty_client
|