plenty_client 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/lib/plenty_client.rb +35 -1
- data/lib/plenty_client/document.rb +14 -0
- data/lib/plenty_client/document/category.rb +31 -0
- data/lib/plenty_client/document/order.rb +36 -0
- data/lib/plenty_client/endpoint.rb +13 -0
- data/lib/plenty_client/listing.rb +34 -0
- data/lib/plenty_client/listing/layout_template.rb +26 -0
- data/lib/plenty_client/listing/market.rb +46 -0
- data/lib/plenty_client/listing/market/directory.rb +33 -0
- data/lib/plenty_client/listing/market/history.rb +39 -0
- data/lib/plenty_client/listing/market/info.rb +18 -0
- data/lib/plenty_client/listing/market/text.rb +38 -0
- data/lib/plenty_client/listing/option_template.rb +36 -0
- data/lib/plenty_client/listing/shipping_profile.rb +21 -0
- data/lib/plenty_client/listing/stock_dependence_type.rb +21 -0
- data/lib/plenty_client/listing/type.rb +21 -0
- data/lib/plenty_client/market.rb +6 -0
- data/lib/plenty_client/market/credentials.rb +36 -0
- data/lib/plenty_client/market/ebay/authentication.rb +23 -0
- data/lib/plenty_client/market/ebay/parts_fitment.rb +43 -0
- data/lib/plenty_client/market/ebay/shop_category.rb +18 -0
- data/lib/plenty_client/order_summary.rb +44 -0
- data/lib/plenty_client/request.rb +26 -50
- data/lib/plenty_client/ticket.rb +29 -0
- data/lib/plenty_client/version.rb +1 -1
- data/lib/plenty_client/webstore.rb +14 -0
- data/plenty_client.gemspec +5 -4
- metadata +50 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1caf9e5a2169c042dff94eab3a14658035ab192b
|
4
|
+
data.tar.gz: f22c7f21862b4c0f87a0bdf36e89686070e3e3d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29fde2a0313b0789700bcc14d5404a87757bee08c0f0f1a2b76c647e780c130a8a6dcd810f7d19849e6a437545ab769b0e3f7cf2e3a8802bbe699b9f563cf28c
|
7
|
+
data.tar.gz: 603f9175393c467d28105cdabb1c60b0849a895f68820ccc700fec8ba5359efda1efca6cd8e1e6ce7298752e4cbd79293fdab5f9efe304b35f35128e218ae02c
|
data/README.md
CHANGED
@@ -11,7 +11,8 @@ The complete documentation can be found [here](https://developers.plentymarkets.
|
|
11
11
|
## Installation
|
12
12
|
|
13
13
|
Add this line to your application's Gemfile:
|
14
|
-
|
14
|
+
|
15
|
+
```ruby
|
15
16
|
gem 'plenty_client'
|
16
17
|
```
|
17
18
|
|
@@ -95,20 +96,20 @@ PlentyClient::Item::Variation.routes
|
|
95
96
|
* [~~`Category`~~](https://developers.plentymarkets.com/rest-doc/category)
|
96
97
|
* [`Cloud`](https://developers.plentymarkets.com/rest-doc/cloud)
|
97
98
|
* [~~`Comment`~~](https://developers.plentymarkets.com/rest-doc/comment)
|
98
|
-
* [
|
99
|
+
* [~~`Document`~~](https://developers.plentymarkets.com/rest-doc/document)
|
99
100
|
* [`Export`](https://developers.plentymarkets.com/rest-doc/export)
|
100
101
|
* [`ExportSettings`](https://developers.plentymarkets.com/rest-doc/export_settings)
|
101
102
|
* [~~`Item`~~](https://developers.plentymarkets.com/rest-doc/item)
|
102
103
|
* [`LegalInformation`](https://developers.plentymarkets.com/rest-doc/legal_information)
|
103
|
-
* [
|
104
|
-
* [
|
104
|
+
* [~~`Listing`~~](https://developers.plentymarkets.com/rest-doc/listing)
|
105
|
+
* [~~`Market`~~](https://developers.plentymarkets.com/rest-doc/market)
|
105
106
|
* [~~`Order`~~](https://developers.plentymarkets.com/rest-doc/order)
|
106
|
-
* [
|
107
|
+
* [~~`OrderSummary`~~](https://developers.plentymarkets.com/rest-doc/order_summary)
|
107
108
|
* [`Payment`](https://developers.plentymarkets.com/rest-doc/payment)
|
108
109
|
* [`Plugins`](https://developers.plentymarkets.com/rest-doc/plugins)
|
109
110
|
* [`StockManagement`](https://developers.plentymarkets.com/rest-doc/stock_management)
|
110
|
-
* [
|
111
|
-
* [
|
111
|
+
* [~~`Ticket`~~](https://developers.plentymarkets.com/rest-doc/ticket)
|
112
|
+
* [~~`Webstore`~~](https://developers.plentymarkets.com/rest-doc/webstore)
|
112
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
|
113
114
|
- missing [OrderProperty](https://developers.plentymarkets.com/rest-doc/order#rest-orderproperty) - its just a mess
|
114
115
|
- missing [OrderItem OrderItemProperty ](https://developers.plentymarkets.com/rest-doc/order_order_item_order_item_property/details#get-all-order-item-propertys-for-one-order-item-by-its-order-item-id) - its just a mess
|
data/lib/plenty_client.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'curl'
|
2
1
|
require 'json'
|
3
2
|
|
4
3
|
module PlentyClient
|
@@ -16,9 +15,13 @@ module PlentyClient
|
|
16
15
|
autoload :Basket, 'plenty_client/basket'
|
17
16
|
autoload :Category, 'plenty_client/category'
|
18
17
|
autoload :Comment, 'plenty_client/comment'
|
18
|
+
autoload :Document, 'plenty_client/document'
|
19
19
|
autoload :Item, 'plenty_client/item'
|
20
20
|
autoload :ItemSet, 'plenty_client/item_set'
|
21
|
+
autoload :Listing, 'plenty_client/listing'
|
21
22
|
autoload :Order, 'plenty_client/order'
|
23
|
+
autoload :OrderSummary, 'plenty_client/order_summary'
|
24
|
+
autoload :Webstore, 'plenty_client/webstore'
|
22
25
|
|
23
26
|
module Basket
|
24
27
|
autoload :Item, 'plenty_client/basket/item'
|
@@ -29,6 +32,11 @@ module PlentyClient
|
|
29
32
|
autoload :Template, 'plenty_client/category/template'
|
30
33
|
end
|
31
34
|
|
35
|
+
module Document
|
36
|
+
autoload :Category, 'plenty_client/document/category'
|
37
|
+
autoload :Order, 'plenty_client/document/order'
|
38
|
+
end
|
39
|
+
|
32
40
|
module Item
|
33
41
|
autoload :Attribute, 'plenty_client/item/attribute'
|
34
42
|
autoload :Barcode, 'plenty_client/item/barcode'
|
@@ -90,6 +98,32 @@ module PlentyClient
|
|
90
98
|
autoload :Config, 'plenty_client/item_set/config'
|
91
99
|
end
|
92
100
|
|
101
|
+
module Listing
|
102
|
+
autoload :LayoutTemplate, 'plenty_client/listing/layout_template'
|
103
|
+
autoload :Market, 'plenty_client/listing/market'
|
104
|
+
autoload :OptionTemplate, 'plenty_client/listing/option_template'
|
105
|
+
autoload :ShippingProfile, 'plenty_client/listing/shipping_profile'
|
106
|
+
autoload :StockDependenceType, 'plenty_client/listing/stock_dependencetype'
|
107
|
+
autoload :Type, 'plenty_client/listing/type'
|
108
|
+
|
109
|
+
module Market
|
110
|
+
autoload :Directory, 'plenty_client/listing/market/directory'
|
111
|
+
autoload :Info, 'plenty_client/listing/market/info'
|
112
|
+
autoload :History, 'plenty_client/listing/market/history'
|
113
|
+
autoload :Text, 'plenty_client/listing/market/text'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
module Market
|
118
|
+
autoload :Credentials, 'plenty_client/market/credentials'
|
119
|
+
|
120
|
+
module Ebay
|
121
|
+
autoload :Authentication, 'plenty_client/market/ebay/authentication'
|
122
|
+
autoload :PartsFitment, 'plenty_client/market/ebay/parts_fitment'
|
123
|
+
autoload :ShopCategory, 'plenty_client/market/ebay/shop_category'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
93
127
|
module Order
|
94
128
|
autoload :CouponCode, 'plenty_client/order/coupon_code'
|
95
129
|
autoload :Currency, 'plenty_client/order/currency'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Document
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
6
|
+
DOWNLOAD_DOCUMENT = '/documents/{documentId}'.freeze
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def download(document_id, headers = {}, &block)
|
10
|
+
get(build_endpoint(FIND_LISTING, download: document_id), headers, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Document
|
3
|
+
class Category
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
DOWNLOAD_CATEGORY_DOCUMENT = '/categories/{categoryId}/documents/downloads'.freeze
|
8
|
+
LIST_CATEGORY_DOCUMENTS = '/categories/{categoryId}/documents/'.freeze
|
9
|
+
UPLOAD_CATEGORY_DOCUMENT = '/categories/{categoryId}/documents'.freeze
|
10
|
+
DELTE_CATEGORY_DOCUMENTS = '/categories/{categoryId}/documents/{documentId}'.freeze
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def download(category_id, headers = {}, &block)
|
14
|
+
get(build_endpoint(DOWNLOAD_CATEGORY_DOCUMENT, category: category_id), headers, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def list(category_id, headers = {}, &block)
|
18
|
+
get(build_endpoint(LIST_CATEGORY_DOCUMENTS, category: category_id), headers, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def upload(category_id, body = {})
|
22
|
+
post(build_endpoint(CREATE_CATEGORY_DOCUMENTS, category: category_id), body)
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy(category_id, body = {})
|
26
|
+
delete(build_endpoint(DELTE_LISTINGS_category, category: category_id), body)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Document
|
3
|
+
class Order
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
DOWNLOAD_ORDERS_DOCUMENTS = '/orders/{orderId}/documents/downloads/{type}'.freeze
|
8
|
+
DOWNLOAD_ORDER_DOCUMENTS_BY_TYPE = '/orders/documents/downloads/{type}'.freeze
|
9
|
+
LIST_ORDER_DOCUMENTS = '/orders/{orderId}/documents/{type}'.freeze
|
10
|
+
LIST_ORDER_DOCUMENTS_BY_TYPE = '/orders/documents/{type}'.freeze
|
11
|
+
UPLOAD_ORDER_DOCUMENT = '/orders/{orderId}/documents/{type}'.freeze
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def download(order_id, type_string, headers = {}, &block)
|
15
|
+
get(build_endpoint(DOWNLOAD_ORDERS_DOCUMENTS, order: order_id, type_string: type_string), headers, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def download_by_type(type_string, headers = {}, &block)
|
19
|
+
get(build_endpoint(DOWNLOAD_ORDER_DOCUMENTS_BY_TYPE, type_string: type_string), headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def list(order_id, type_sting = nil, headers = {}, &block)
|
23
|
+
get(build_endpoint(LIST_ORDER_DOCUMENTS, order: order_id, type_sting: type_sting), headers, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
def list_by_type(order_id, type_sting = nil, headers = {}, &block)
|
27
|
+
get(build_endpoint(LIST_ORDER_DOCUMENTS_BY_TYPE, order: order_id, type_sting: type_sting), headers, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def upload(order_id, type_string, body = {})
|
31
|
+
post(build_endpoint(UPLOAD_ORDER_DOCUMENT, order: order_id, type_string: type_string), body)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -10,6 +10,7 @@ module PlentyClient
|
|
10
10
|
# Endpoint parameters hash that links symbols to regex
|
11
11
|
endpoint_parameters = {
|
12
12
|
account: /\{accountId\}/,
|
13
|
+
address: /\{addressId\}/,
|
13
14
|
account_ype: /\{accountType\}/,
|
14
15
|
attribute: /\{attributeId\}/,
|
15
16
|
attribute_value: /\{attributeValueId\}/,
|
@@ -22,20 +23,31 @@ module PlentyClient
|
|
22
23
|
contact: /\{contactId\}/,
|
23
24
|
country: /\{countryId\}/,
|
24
25
|
coupon_string: /\{coupon\}/,
|
26
|
+
credentials: /\{credentialsId\}/,
|
25
27
|
cross_item: /\{crossItemId\}/,
|
26
28
|
currency: /\{currencyIso\}/,
|
27
29
|
customer_class: /\{customerClassId\}/,
|
30
|
+
directory: /\{directoryId\}/,
|
31
|
+
document: /\{documentId\}/,
|
32
|
+
fitment: /\{fitmentId\}/,
|
28
33
|
image: /\{imageId\}/,
|
29
34
|
item: /\{itemId\}/,
|
30
35
|
item_set: /\{itemSetId\}/,
|
31
36
|
lang: /\{lang\}/,
|
37
|
+
layout_template: /\{layoutTemplateId}/,
|
32
38
|
location: /\{locationId\}/,
|
39
|
+
listing: /\{listingId\}/,
|
33
40
|
manufacturer: /\{manufacturerId\}/,
|
34
41
|
market: /\{marketId\}/,
|
35
42
|
market_ident_number: /\{marketIdentNumberId\}/,
|
43
|
+
market_listing: /\{marketListingId\}/,
|
44
|
+
market_listing_history: /\{marketListingHistoryId\}/,
|
45
|
+
market_text: /\{marketTextId\}/,
|
36
46
|
marketplace: /\{marketplaceId\}/,
|
47
|
+
option_template: /\{optionTemplateId}/,
|
37
48
|
order: /\{orderId\}/,
|
38
49
|
order_item: /\{orderItemId\}/,
|
50
|
+
order_summary: /\{orderSummaryId\}/,
|
39
51
|
parent_referrer: /\{parentReferrerId\}/,
|
40
52
|
plenty: /\{plentyId\}/,
|
41
53
|
preset: /\{presetId\}/,
|
@@ -50,6 +62,7 @@ module PlentyClient
|
|
50
62
|
shipping_package: /\{orderShippingPackageId\}/,
|
51
63
|
shipping_service_provider: /\{shippingServiceProviderID\}/,
|
52
64
|
sku: /\{skuId\}/,
|
65
|
+
ticket: /\{ticketId\}/,
|
53
66
|
type: /\{typeId\}/,
|
54
67
|
type_string: /\{type\}/,
|
55
68
|
unit: /\{unitId\}/,
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
6
|
+
FIND_LISTING = '/listings/{listingId}'.freeze
|
7
|
+
LIST_LISTINGS = '/listings'.freeze
|
8
|
+
CREATE_LISTING = '/listings'.freeze
|
9
|
+
UPDATE_LISTING = '/listings/{listingId}'.freeze
|
10
|
+
DELETE_LISTING = '/listings/{listingId}'.freeze
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def list(headers = {}, &block)
|
14
|
+
get(build_endpoint(LIST_LISTINGS), headers, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def find(listing_id = nil, headers = {}, &block)
|
18
|
+
get(build_endpoint(FIND_LISTING, listing: listing_id), headers, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def create(body = {})
|
22
|
+
post(CREATE_LISTING, body)
|
23
|
+
end
|
24
|
+
|
25
|
+
def update(listing_id, body = {})
|
26
|
+
post(build_endpoint(UPDATE_LISTING, listing: listing_id), body)
|
27
|
+
end
|
28
|
+
|
29
|
+
def destroy(listing_id, body = {})
|
30
|
+
delete(build_endpoint(DELETE_LISTING, listing: listing_id), body)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
class LayoutTemplate
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_LISTINGS_LAYOUT_TEMPLATE = '/listings/layout_templates/{layoutTemplateId}'.freeze
|
8
|
+
CREATE_LISTINGS_LAYOUT_TEMPLATE = '/listings/layout_templates'.freeze
|
9
|
+
DELTE_LISTINGS_LAYOUT_TEMPLATE = '/listings/layout_templates/{layoutTemplateId}'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def find(layout_template_id, headers = {}, &block)
|
13
|
+
get(build_endpoint(FIND_LISTINGS_LAYOUT_TEMPLATE, layout_template: layout_template_id), headers, &block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def create(body = {})
|
17
|
+
post(build_endpoint(CREATE_LISTINGS_LAYOUT_TEMPLATE), body)
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy(layout_template_id, body = {})
|
21
|
+
delete(build_endpoint(DELTE_LISTINGS_LAYOUT_TEMPLATE, layout_template: layout_template_id), body)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
module Market
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_LISTING_MARKET = '/listings/markets/{marketListingId}'.freeze
|
8
|
+
LIST_LISTING_MARKETS = '/listings/markets'.freeze
|
9
|
+
CREATE_LISTING_MARKET = '/listings/markets'.freeze
|
10
|
+
UPDATE_LISTING_MARKET = '/listings/markets/{marketListingId}'.freeze
|
11
|
+
DELETE_LISTING_MARKET = '/listings/markets/{marketListingId}'.freeze
|
12
|
+
START_LISTING_MARKET = '/listings/markets/start/{marketListingId}'.freeze
|
13
|
+
VERIFY_LISTING_MARKET = '/listings/markets/verify/{marketListingId}'.freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def find(market_listing_id, headers = {}, &block)
|
17
|
+
get(build_endpoint(FIND_LISTING_MARKET, market_listing: market_listing_id), headers, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def list(headers = {}, &block)
|
21
|
+
get(build_endpoint(LIST_LISTING_MARKETS), headers, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create(body = {})
|
25
|
+
post(build_endpoint(CREATE_LISTING_MARKET), body)
|
26
|
+
end
|
27
|
+
|
28
|
+
def update(market_listing_id, body = {})
|
29
|
+
put(build_endpoint(UPDATE_LISTING_MARKET, market_listing: market_listing_id), body)
|
30
|
+
end
|
31
|
+
|
32
|
+
def destroy(market_listing_id, body = {})
|
33
|
+
delete(build_endpoint(DELETE_LISTING_MARKET, market_listing: market_listing_id), body)
|
34
|
+
end
|
35
|
+
|
36
|
+
def start(market_listing_id, body = {})
|
37
|
+
post(build_endpoint(START_LISTING_MARKET, market_listing: market_listing_id), body)
|
38
|
+
end
|
39
|
+
|
40
|
+
def verify(market_listing_id, body = {})
|
41
|
+
post(build_endpoint(VERIFY_LISTING_MARKET, market_listing: market_listing_id), body)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
module Market
|
4
|
+
class Directory
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
FIND_LISTING_MARKET = '/listings/markets/directories/{directoryId}'.freeze
|
9
|
+
CREATE_LISTING_MARKET = '/listings/markets/directories'.freeze
|
10
|
+
UPDATE_LISTING_MARKET = '/listings/markets/directories/{directoryId}'.freeze
|
11
|
+
DELETE_LISTING_MARKET = '/listings/markets/directories/{directoryId}'.freeze
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def find(market_listing_id, headers = {}, &block)
|
15
|
+
get(build_endpoint(FIND_LISTING_MARKET, market_listing: market_listing_id), headers, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create(body = {})
|
19
|
+
post(build_endpoint(CREATE_LISTING_MARKET), body)
|
20
|
+
end
|
21
|
+
|
22
|
+
def update(market_listing_id, body = {})
|
23
|
+
put(build_endpoint(UPDATE_LISTING_MARKET, market_listing: market_listing_id), body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def destroy(market_listing_id, body = {})
|
27
|
+
delete(build_endpoint(DELETE_LISTING_MARKET, market_listing: market_listing_id), body)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
module Market
|
4
|
+
class History
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
FIND_LISTING_MARKET_HISTORY = '/listings/markets/histories/{marketListingHistoryId}'.freeze
|
9
|
+
LIST_LISTING_MARKET_HISTORIES = '/listings/markets/histories'.freeze
|
10
|
+
END_LISTING_MARKET_HISTORY = '/listings/markets/histories/end/{marketListingHistoryId}'.freeze
|
11
|
+
RELIST_LISTING_MARKET_HISTORY = '/listings/markets/histories/relist/{marketListingHistoryId}'.freeze
|
12
|
+
UPDATE_LISTING_MARKET_HISTORY = '/listings/markets/histories/update/{marketListingHistoryId}'.freeze
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def find(market_listing_history_id, headers = {}, &block)
|
16
|
+
get(build_endpoint(FIND_LISTING_MARKET_HISTORY, market_listing_history: market_listing_history_id),
|
17
|
+
headers, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def list(headers = {}, &block)
|
21
|
+
get(build_endpoint(LIST_LISTING_MARKET_HISTORIES), headers, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def end(market_listing_history_id, body = {})
|
25
|
+
delete(build_endpoint(END_LISTING_MARKET_HISTORY, market_listing_history: market_listing_history_id), body)
|
26
|
+
end
|
27
|
+
|
28
|
+
def relist(market_listing_history_id, body = {})
|
29
|
+
post(build_endpoint(RELIST_LISTING_MARKET_HISTORY, market_listing_history: market_listing_history_id), body)
|
30
|
+
end
|
31
|
+
|
32
|
+
def update(market_listing_history_id, body = {})
|
33
|
+
put(build_endpoint(UPDATE_LISTING_MARKET_HISTORY, market_listing_history: market_listing_history_id), body)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
module Market
|
4
|
+
class Info
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
LIST_LISTINGS_MARKET_INFO = '/listings/markets/info'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def list(headers = {}, &block)
|
12
|
+
get(build_endpoint(LIST_LISTINGS_MARKET_INFO), headers, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
module Market
|
4
|
+
class Text
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
FIND_LISTING_MARKET_TEXT = '/listings/markets/texts/{marketTextId}'.freeze
|
9
|
+
LIST_LISTING_MARKET_TEXTS = '/listings/markets/texts'.freeze
|
10
|
+
CREATE_LISTING_MARKET_TEXT = '/listings/markets/texts'.freeze
|
11
|
+
UPDATE_LISTING_MARKET_TEXT = '/listings/markets/texts/{marketTextId}'.freeze
|
12
|
+
DELETE_LISTING_MARKET_TEXT = '/listings/markets/texts/{marketTextId}'.freeze
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def find(market_text_id, headers = {}, &block)
|
16
|
+
get(build_endpoint(FIND_LISTING_MARKET_TEXT, market_text: market_text_id), headers, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def list(headers = {}, &block)
|
20
|
+
get(build_endpoint(LIST_LISTING_MARKET_TEXTS), headers, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def create(body = {})
|
24
|
+
post(build_endpoint(CREATE_LISTING_MARKET_TEXT), body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def update(market_text_id, body = {})
|
28
|
+
put(build_endpoint(UPDATE_LISTING_MARKET_TEXT, market_text: market_text_id), body)
|
29
|
+
end
|
30
|
+
|
31
|
+
def destroy(market_text_id, body = {})
|
32
|
+
delete(build_endpoint(DELETE_LISTING_MARKET_TEXT, market_text: market_text_id), body)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
class OptionTemplate
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
PREVIEW_LISTINGS_OPTION_TEMPLATE = '/listings/option_templates/preview'.freeze
|
8
|
+
FIND_LISTINGS_OPTION_TEMPLATE = '/listings/option_templates/{optionTemplateId}'.freeze
|
9
|
+
CREATE_LISTINGS_OPTION_TEMPLATE = '/listings/option_templates'.freeze
|
10
|
+
UPDATE_LISTINGS_OPTION_TEMPLATE = '/listings/option_templates/{optionTemplateId}'.freeze
|
11
|
+
DELTE_LISTINGS_OPTION_TEMPLATE = '/listings/option_templates/{optionTemplateId}'.freeze
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def preview(headers = {}, &block)
|
15
|
+
get(build_endpoint(PREVIEW_LISTINGS_OPTION_TEMPLATE), headers, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(option_template_id, headers = {}, &block)
|
19
|
+
get(build_endpoint(FIND_LISTINGS_OPTION_TEMPLATE, option_template: option_template_id), headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(body = {})
|
23
|
+
post(build_endpoint(CREATE_LISTINGS_OPTION_TEMPLATE), body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def update(option_template_id, body = {})
|
27
|
+
put(build_endpoint(UPDATE_LISTINGS_OPTION_TEMPLATE, option_template: option_template_id), body)
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy(option_template_id, body = {})
|
31
|
+
delete(build_endpoint(DELTE_LISTINGS_OPTION_TEMPLATE, option_template: option_template_id), body)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
class ShippingProfile
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_LISTINGS_SHIPPING_PROFILE = '/listings/shipping_profiles/{shippingProfileId}'.freeze
|
8
|
+
LIST_LISTINGS_SHIPPING_PROFILES = '/listings/shipping_profiles'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def find(shipping_profile_id, headers = {}, &block)
|
12
|
+
get(build_endpoint(FIND_LISTINGS_SHIPPING_PROFILE, shipping_profile: shipping_profile_id), headers, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def list(headers = {}, &block)
|
16
|
+
get(build_endpoint(LIST_LISTINGS_SHIPPING_PROFILES), headers, &block)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
class StockDependenceType
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_LISTINGS_STOCK_DEPENCENCE_TYPE = '/listings/types/{typeId}'.freeze
|
8
|
+
LIST_LISTINGS_STOCK_DEPENCENCE_TYPES = '/listings/types'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def find(type_id, headers = {}, &block)
|
12
|
+
GET(BUILD_ENDPOINT(FIND_LISTINGS_STOCK_DEPENCENCE_TYPE, type: type_id), headers, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def list(headers = {}, &block)
|
16
|
+
GET(BUILD_ENDPOINT(LIST_LISTINGS_STOCK_DEPENCENCE_TYPES), headers, &block)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Listing
|
3
|
+
class Type
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_LISTINGS_TYPE = '/listings/types/{typeId}'.freeze
|
8
|
+
LIST_LISTINGS_TYPES = '/listings/types'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def find(type_id, headers = {}, &block)
|
12
|
+
get(build_endpoint(FIND_LISTINGS_TYPE, type: type_id), headers, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def list(headers = {}, &block)
|
16
|
+
get(build_endpoint(LIST_LISTINGS_TYPES), headers, &block)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Market
|
3
|
+
module Credentials
|
4
|
+
include PlentyClient::Endpoint
|
5
|
+
include PlentyClient::Request
|
6
|
+
|
7
|
+
LIST_MARKET_CREDENTIALS = '/markets/credentials'.freeze
|
8
|
+
FIND_MARKET_CREDENTIALS = '/markets/credentials/{credentialsId}'.freeze
|
9
|
+
CREATE_MARKET_CREDENTIALS = '/markets/credentials'.freeze
|
10
|
+
UPDATE_MARKET_CREDENTIALS = '/markets/credentials/{credentialsId}'.freeze
|
11
|
+
DELETE_MARKET_CREDENTIALS = '/markets/credentials/{credentialsId}'.freeze
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def list(headers = {}, &block)
|
15
|
+
get(build_endpoint(LIST_MARKET_CREDENTIALS), headers, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(credentials_id, headers = {}, &block)
|
19
|
+
get(build_endpoint(FIND_MARKET_CREDENTIALS, credentials: credentials_id), headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(body = {})
|
23
|
+
post(build_endpoint(CREATE_MARKET_CREDENTIALS), body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def update(credentials_id, body = {})
|
27
|
+
put(build_endpoint(UPDATE_MARKET_CREDENTIALS, credentials: credentials_id), body)
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy(credentials_id, body = {})
|
31
|
+
delete(build_endpoint(DELETE_MARKET_CREDENTIALS, credentials: credentials_id), body)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Market
|
3
|
+
module Ebay
|
4
|
+
class Authentication
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
FIND_MARKET_EBAY_AUTH_URL = '/markets/ebay/auth/login'.freeze
|
9
|
+
REFRESH_MARKET_EBAY_AUTH_TOKEN = '/markets/ebay/auth/refresh-token'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def find_login_url(headers = {}, &block)
|
13
|
+
get(build_endpoint(FIND_MARKET_EBAY_AUTH_URL), headers, &block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def refrest_token(body = {})
|
17
|
+
put(build_endpoint(REFRESH_MARKET_EBAY_AUTH_TOKEN), body)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Market
|
3
|
+
module Ebay
|
4
|
+
class PartsFitment
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
LIST_MARKET_EBAY_PARTS_FITMENTS = '/markets/ebay/parts-fitments'.freeze
|
9
|
+
FIND_MARKET_EBAY_PARTS_FITMENT = '/markets/ebay/parts-fitments/{fitmentId}'.freeze
|
10
|
+
CREATE_MARKET_EBAY_PARTS_FITMENT = '/markets/ebay/parts-fitments'.freeze
|
11
|
+
UPDATE_MARKET_EBAY_PARTS_FITMENT = '/markets/ebay/parts-fitments/{fitmentId}'.freeze
|
12
|
+
DELETE_MARKET_EBAY_PARTS_FITMENT = '/markets/ebay/parts-fitments/{fitmentId}'.freeze
|
13
|
+
SEARCH_MARKET_EBAY_PARTS_FITMENTS = '/markets/ebay/parts-fitments/search'.freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def list(headers = {}, &block)
|
17
|
+
get(build_endpoint(LIST_MARKET_EBAY_PARTS_FITMENTS), headers, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def search(headers = {}, &block)
|
21
|
+
get(build_endpoint(SEARCH_MARKET_EBAY_PARTS_FITMENTS), headers, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def find(fitment_id, headers = {}, &block)
|
25
|
+
get(build_endpoint(FIND_MARKET_EBAY_PARTS_FITMENT, fitment: fitment_id), headers, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create(body = {})
|
29
|
+
post(build_endpoint(CREATE_MARKET_EBAY_PARTS_FITMENT), body)
|
30
|
+
end
|
31
|
+
|
32
|
+
def update(fitment_id, body = {})
|
33
|
+
put(build_endpoint(UPDATE_MARKET_EBAY_PARTS_FITMENT, fitment: fitment_id), body)
|
34
|
+
end
|
35
|
+
|
36
|
+
def destroy(fitment_id, body = {})
|
37
|
+
delete(build_endpoint(DELETE_MARKET_EBAY_PARTS_FITMENT, fitment: fitment_id), body)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Market
|
3
|
+
module Ebay
|
4
|
+
class ShopCategory
|
5
|
+
include PlentyClient::Endpoint
|
6
|
+
include PlentyClient::Request
|
7
|
+
|
8
|
+
LIST_MARKET_EBAY_SHOP_CATEGORIES = '/markets/ebay/shop_categories'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def list(headers = {}, &block)
|
12
|
+
get(build_endpoint(LIST_MARKET_EBAY_SHOP_CATEGORIES), headers, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module OrderSummary
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
6
|
+
LIST_ORDER_SUMMARYS = '/order_summaries'.freeze
|
7
|
+
CREATE_ORDER_SUMMARY = '/order_summaries'.freeze
|
8
|
+
FIND_ORDER_SUMMARY = '/order_summaries/{orderSummaryId}'.freeze
|
9
|
+
FIND_ORDER_SUMMARY_BY_CONTACT = '/order_summaries/contacts/{contactId}'.freeze
|
10
|
+
FIND_ORDER_SUMMARY_BY_ADDRESS = '/order_summaries/orders/{addressId}'.freeze
|
11
|
+
UPDATE_ORDER_SUMMARY = '/order_summaries/{orderSummaryId}'.freeze
|
12
|
+
DELETE_ORDER_SUMMARY = '/order_summaries/{orderSummaryId}'.freeze
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def create(body = {})
|
16
|
+
post(build_endpoint(CREATE_ORDER_SUMMARY), body)
|
17
|
+
end
|
18
|
+
|
19
|
+
def list(headers = {}, &block)
|
20
|
+
get(build_endpoint(LIST_ORDER_SUMMARYS), headers, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def find(order_summary_id, headers = {}, &block)
|
24
|
+
get(build_endpoint(FIND_ORDER_SUMMARY, order_summary: order_summary_id), headers, &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def find_by_contact(contact_id, headers = {}, &block)
|
28
|
+
get(build_endpoint(FIND_ORDER_SUMMARY_BY_CONTACT, contact: contact_id), headers, &block)
|
29
|
+
end
|
30
|
+
|
31
|
+
def find_by_address(address_id, headers = {}, &block)
|
32
|
+
get(build_endpoint(LIST_ORDER_SUMMARYS_PACKAGE_NUMBERS, address: address_id), headers, &block)
|
33
|
+
end
|
34
|
+
|
35
|
+
def update(order_summary_id, body = {})
|
36
|
+
put(build_endpoint(UPDATE_ORDER_SUMMARY, order_summary: order_summary_id), body)
|
37
|
+
end
|
38
|
+
|
39
|
+
def destroy(order_summary_id, body = {})
|
40
|
+
delete(build_endpoint(DELETE_ORDER_SUMMARY, order_summary: order_summary_id), body)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,19 +1,17 @@
|
|
1
|
-
require '
|
1
|
+
require 'typhoeus'
|
2
|
+
require 'typhoeus/adapters/faraday'
|
3
|
+
|
2
4
|
module PlentyClient
|
3
5
|
module Request
|
4
6
|
module ClassMethods
|
5
7
|
def request(http_method, path, params = {})
|
6
8
|
return false if http_method.nil? || path.nil?
|
7
|
-
return false unless %w
|
9
|
+
return false unless %w(post put patch delete get).include?(http_method.to_s)
|
8
10
|
|
9
|
-
if PlentyClient::Config.access_token.nil? ||
|
11
|
+
if PlentyClient::Config.access_token.nil? || (PlentyClient::Config.expiry_date - Time.now).negative?
|
10
12
|
login_check
|
11
13
|
end
|
12
|
-
|
13
|
-
response = perform(http_method, path, params)
|
14
|
-
body = parse_body(response, http_method, path, params)
|
15
|
-
log_output(http_method, base_url(path), params, time_diff_ms(start_time, Time.now)) if PlentyClient::Config.log
|
16
|
-
body
|
14
|
+
parse_body(perform(http_method, path, params))
|
17
15
|
end
|
18
16
|
|
19
17
|
def post(path, body = {})
|
@@ -32,7 +30,7 @@ module PlentyClient
|
|
32
30
|
request(:delete, path, body)
|
33
31
|
end
|
34
32
|
|
35
|
-
def get(path, params = {}
|
33
|
+
def get(path, params = {})
|
36
34
|
page = 1
|
37
35
|
rval_array = []
|
38
36
|
if block_given?
|
@@ -52,46 +50,35 @@ module PlentyClient
|
|
52
50
|
private
|
53
51
|
|
54
52
|
def login_check
|
55
|
-
|
56
|
-
|
57
|
-
result = parse_body(response
|
53
|
+
response = perform(:post, '/login', username: PlentyClient::Config.api_user,
|
54
|
+
password: PlentyClient::Config.api_password)
|
55
|
+
result = parse_body(response)
|
58
56
|
PlentyClient::Config.access_token = result['accessToken']
|
59
57
|
PlentyClient::Config.refresh_token = result['refreshToken']
|
60
58
|
PlentyClient::Config.expiry_date = Time.now + result['expiresIn']
|
61
59
|
end
|
62
60
|
|
63
61
|
def perform(http_method, path, params = {})
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
Curl.post(base_url(path), params.to_json) do |curl|
|
71
|
-
curl_options(curl)
|
72
|
-
end
|
73
|
-
when 'put'
|
74
|
-
Curl.put(base_url(path), params.to_json) do |curl|
|
75
|
-
curl_options(curl)
|
76
|
-
end
|
77
|
-
when 'delete'
|
78
|
-
Curl.delete(base_url(path), params) do |curl|
|
79
|
-
curl_options(curl)
|
80
|
-
end
|
81
|
-
when 'patch'
|
82
|
-
Curl.patch(base_url(path), params.to_json) do |curl|
|
83
|
-
curl_options(curl)
|
62
|
+
conn = Faraday.new(url: PlentyClient::Config.site_url) do |faraday|
|
63
|
+
faraday = headers(faraday)
|
64
|
+
if PlentyClient::Config.log
|
65
|
+
faraday.response :logger do |logger|
|
66
|
+
logger.filter(/(password=)(\w+)/, '\1[FILTERED]')
|
67
|
+
end
|
84
68
|
end
|
85
69
|
end
|
70
|
+
conn.adapter :typhoeus
|
71
|
+
converted_parameters = %w(get delete).include?(http_method.to_s.downcase) ? params : params.to_json
|
72
|
+
conn.send(http_method.to_s.downcase, base_url(path), converted_parameters)
|
86
73
|
end
|
87
74
|
|
88
|
-
def
|
89
|
-
|
75
|
+
def headers(adapter)
|
76
|
+
adapter.headers['Content-type'] = 'application/json'
|
90
77
|
unless PlentyClient::Config.access_token.nil?
|
91
|
-
|
78
|
+
adapter.headers['Authorization'] = "Bearer #{PlentyClient::Config.access_token}"
|
92
79
|
end
|
93
|
-
|
94
|
-
|
80
|
+
adapter.headers['Accept'] = 'application/x.plentymarkets.v1+json'
|
81
|
+
adapter
|
95
82
|
end
|
96
83
|
|
97
84
|
def base_url(path)
|
@@ -101,24 +88,13 @@ module PlentyClient
|
|
101
88
|
url
|
102
89
|
end
|
103
90
|
|
104
|
-
def parse_body(response
|
91
|
+
def parse_body(response)
|
105
92
|
result = JSON.parse(response.body)
|
106
93
|
errors = error_check(result)
|
107
|
-
unless errors.blank?
|
108
|
-
raise PlentyClient::ResponseError, [*errors].join(', ')
|
109
|
-
log_output(http_method, path, params, '')
|
110
|
-
end
|
94
|
+
raise PlentyClient::ResponseError, [*errors].join(', ') unless errors.blank?
|
111
95
|
result
|
112
96
|
end
|
113
97
|
|
114
|
-
def log_output(http_method, path, params, duration)
|
115
|
-
puts [Time.now, "#{duration} ms", http_method.upcase, path, params].join(' # ')
|
116
|
-
end
|
117
|
-
|
118
|
-
def time_diff_ms(start, finish)
|
119
|
-
((finish - start) * 1000.0).round(2)
|
120
|
-
end
|
121
|
-
|
122
98
|
def error_check(response)
|
123
99
|
rval = []
|
124
100
|
return rval if response.blank?
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Ticket
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
6
|
+
LIST_TICKETS = '/tickets'.freeze
|
7
|
+
CREATE_TICKET = '/tickets'.freeze
|
8
|
+
ADD_MESSAGE = '/tickets/{ticketId}'.freeze
|
9
|
+
GET_TICKET = '/tickets/{ticketId}'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def list(headers = {}, &block)
|
13
|
+
get(build_endpoint(LIST_TICKETS), headers, &block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def create(body = {})
|
17
|
+
post(build_endpoint(CREATE_TICKET), body)
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_message(ticket_id, body = {})
|
21
|
+
post(build_endpoint(ADD_MESSAGE, ticket: ticket_id), body)
|
22
|
+
end
|
23
|
+
|
24
|
+
def update(ticket_id, body = {})
|
25
|
+
put(build_endpoint(UPDATE_TICKET, ticket: ticket_id), body)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Webstore
|
3
|
+
include PlentyClient::Endpoint
|
4
|
+
include PlentyClient::Request
|
5
|
+
|
6
|
+
LIST_WEBSTORES = '/webstores'.freeze
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def list(headers = {}, &block)
|
10
|
+
get(build_endpoint(LIST_WEBSTORES), headers, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/plenty_client.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Dariusch Ochlast']
|
9
9
|
spec.email = ['dariusch.ochlast@gmail.com']
|
10
10
|
|
11
|
-
spec.summary = 'This
|
12
|
-
spec.description = 'This
|
11
|
+
spec.summary = 'This the first draft of a PlentyMarkets Rest Client for Ruby.'
|
12
|
+
spec.description = 'This is a simple client for the PlentyMarkets REST API providing classes to interact with it.'
|
13
13
|
spec.homepage = 'https://github.com/Dariusch/plenty_client'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
26
|
|
27
|
-
spec.
|
28
|
-
spec.
|
27
|
+
spec.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.0'
|
28
|
+
spec.add_runtime_dependency 'faraday', '~> 0.9'
|
29
|
+
spec.add_runtime_dependency 'typhoeus', '~> 1.3', '>= 1.3.0'
|
29
30
|
end
|
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.4
|
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-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,21 +73,41 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 1.8.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: faraday
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.9
|
81
|
+
version: '0.9'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.9
|
89
|
-
|
90
|
-
|
88
|
+
version: '0.9'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: typhoeus
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.3'
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.3.0
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '1.3'
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.3.0
|
109
|
+
description: This is a simple client for the PlentyMarkets REST API providing classes
|
110
|
+
to interact with it.
|
91
111
|
email:
|
92
112
|
- dariusch.ochlast@gmail.com
|
93
113
|
executables: []
|
@@ -116,6 +136,9 @@ files:
|
|
116
136
|
- lib/plenty_client/comment.rb
|
117
137
|
- lib/plenty_client/config.rb
|
118
138
|
- lib/plenty_client/constants.rb
|
139
|
+
- lib/plenty_client/document.rb
|
140
|
+
- lib/plenty_client/document/category.rb
|
141
|
+
- lib/plenty_client/document/order.rb
|
119
142
|
- lib/plenty_client/endpoint.rb
|
120
143
|
- lib/plenty_client/item.rb
|
121
144
|
- lib/plenty_client/item/attribute.rb
|
@@ -158,6 +181,22 @@ files:
|
|
158
181
|
- lib/plenty_client/item_set.rb
|
159
182
|
- lib/plenty_client/item_set/component.rb
|
160
183
|
- lib/plenty_client/item_set/config.rb
|
184
|
+
- lib/plenty_client/listing.rb
|
185
|
+
- lib/plenty_client/listing/layout_template.rb
|
186
|
+
- lib/plenty_client/listing/market.rb
|
187
|
+
- lib/plenty_client/listing/market/directory.rb
|
188
|
+
- lib/plenty_client/listing/market/history.rb
|
189
|
+
- lib/plenty_client/listing/market/info.rb
|
190
|
+
- lib/plenty_client/listing/market/text.rb
|
191
|
+
- lib/plenty_client/listing/option_template.rb
|
192
|
+
- lib/plenty_client/listing/shipping_profile.rb
|
193
|
+
- lib/plenty_client/listing/stock_dependence_type.rb
|
194
|
+
- lib/plenty_client/listing/type.rb
|
195
|
+
- lib/plenty_client/market.rb
|
196
|
+
- lib/plenty_client/market/credentials.rb
|
197
|
+
- lib/plenty_client/market/ebay/authentication.rb
|
198
|
+
- lib/plenty_client/market/ebay/parts_fitment.rb
|
199
|
+
- lib/plenty_client/market/ebay/shop_category.rb
|
161
200
|
- lib/plenty_client/order.rb
|
162
201
|
- lib/plenty_client/order/contact_wish.rb
|
163
202
|
- lib/plenty_client/order/coupon_code.rb
|
@@ -177,6 +216,7 @@ files:
|
|
177
216
|
- lib/plenty_client/order/shipping/package.rb
|
178
217
|
- lib/plenty_client/order/shipping/profile.rb
|
179
218
|
- lib/plenty_client/order/shipping/service_provider.rb
|
219
|
+
- lib/plenty_client/order_summary.rb
|
180
220
|
- lib/plenty_client/request.rb
|
181
221
|
- lib/plenty_client/sales_price/account.rb
|
182
222
|
- lib/plenty_client/sales_price/country.rb
|
@@ -185,7 +225,9 @@ files:
|
|
185
225
|
- lib/plenty_client/sales_price/name.rb
|
186
226
|
- lib/plenty_client/sales_price/online_store.rb
|
187
227
|
- lib/plenty_client/sales_price/referrer.rb
|
228
|
+
- lib/plenty_client/ticket.rb
|
188
229
|
- lib/plenty_client/version.rb
|
230
|
+
- lib/plenty_client/webstore.rb
|
189
231
|
- plenty_client.gemspec
|
190
232
|
homepage: https://github.com/Dariusch/plenty_client
|
191
233
|
licenses:
|
@@ -210,5 +252,5 @@ rubyforge_project:
|
|
210
252
|
rubygems_version: 2.6.10
|
211
253
|
signing_key:
|
212
254
|
specification_version: 4
|
213
|
-
summary: This
|
255
|
+
summary: This the first draft of a PlentyMarkets Rest Client for Ruby.
|
214
256
|
test_files: []
|