plenty_client 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +11 -0
- data/README.md +7 -6
- data/lib/plenty_client/accounting.rb +32 -0
- data/lib/plenty_client/authentication.rb +34 -0
- data/lib/plenty_client/authorization.rb +19 -0
- data/lib/plenty_client/basket/item.rb +21 -0
- data/lib/plenty_client/basket.rb +14 -0
- data/lib/plenty_client/category/branch.rb +22 -0
- data/lib/plenty_client/category/template.rb +29 -0
- data/lib/plenty_client/category.rb +50 -0
- data/lib/plenty_client/comment.rb +31 -0
- data/lib/plenty_client/endpoint.rb +4 -0
- data/lib/plenty_client/request.rb +2 -5
- data/lib/plenty_client/version.rb +1 -1
- data/lib/plenty_client.rb +20 -5
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7180904868c8a02d469c837d0ebc23bd45771173
|
4
|
+
data.tar.gz: 210526fc22be311c647f257190508ed53c6b720f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fa101d7f1462504fc8a7a643633f640fa9898f903e75fd86e7c5efa01d21f873e4f653002ed27b71c79853f3c47b24f88e6ad40ac5bbec00fd63ec4babe48e1
|
7
|
+
data.tar.gz: 4e7b8cd5d34d56c2148f38c0c11dd316d9b2456c51ea6daa071f01b7d398def13d406abcdd78fa5894b474aabc9e261577425fc6064ae4cda526c487e320b354
|
data/.codeclimate.yml
ADDED
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
[![Issue Count](https://codeclimate.com/github/Dariusch/plenty_client/badges/issue_count.svg)](https://codeclimate.com/github/Dariusch/plenty_client)
|
4
4
|
[![Test Coverage](https://codeclimate.com/github/Dariusch/plenty_client/badges/coverage.svg)](https://codeclimate.com/github/Dariusch/plenty_client/coverage)
|
5
5
|
[![Build Status](https://travis-ci.org/Dariusch/plenty_client.svg?branch=master)](https://travis-ci.org/Dariusch/plenty_client)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/plenty_client.svg)](https://badge.fury.io/rb/plenty_client)
|
6
7
|
|
7
8
|
This Client is a ruby wrapper around the PlentyMarkets REST API.
|
8
9
|
The complete documentation can be found [here](https://developers.plentymarkets.com/rest-doc).
|
@@ -115,13 +116,13 @@ PlentyClient::Item::Variation.routes
|
|
115
116
|
- clean up `plenty_client/request.rb`
|
116
117
|
* create classes for
|
117
118
|
* [`Account`](https://developers.plentymarkets.com/rest-doc/account)
|
118
|
-
* [
|
119
|
-
* [
|
120
|
-
* [
|
121
|
-
* [
|
122
|
-
* [
|
119
|
+
* [~~`Accounting`~~](https://developers.plentymarkets.com/rest-doc/accounting)
|
120
|
+
* [~~`Authentication`~~](https://developers.plentymarkets.com/rest-doc/authentication)
|
121
|
+
* [~~`Authorization`~~](https://developers.plentymarkets.com/rest-doc/authorization)
|
122
|
+
* [~~`Basket`~~](https://developers.plentymarkets.com/rest-doc/basket)
|
123
|
+
* [~~`Category`~~](https://developers.plentymarkets.com/rest-doc/category)
|
123
124
|
* [`Cloud`](https://developers.plentymarkets.com/rest-doc/cloud)
|
124
|
-
* [
|
125
|
+
* [~~`Comment`~~](https://developers.plentymarkets.com/rest-doc/comment)
|
125
126
|
* [`Document`](https://developers.plentymarkets.com/rest-doc/document)
|
126
127
|
* [`Export`](https://developers.plentymarkets.com/rest-doc/export)
|
127
128
|
* [`ExportSettings`](https://developers.plentymarkets.com/rest-doc/export_settings)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Accounting
|
3
|
+
extend PlentyClient::Endpoint
|
4
|
+
extend PlentyClient::Request
|
5
|
+
|
6
|
+
LIST_VAT_OF_LOCATION = '/vat/locations/{locationId}'.freeze
|
7
|
+
LIST_VAT_OF_COUNTRY = '/vat/locations/{locationId}/countries/{countryId}'.freeze
|
8
|
+
LIST_VAT_CONFIGURATIONS = '/vat'.freeze
|
9
|
+
LIST_VAT_STANDARD = '/vat/standard'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def list(headers = {}, &block)
|
13
|
+
get(build_endpoint(LIST_VAT_CONFIGURATIONS), headers, &block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def list_for_country(location_id, country_id, headers = {}, &block)
|
17
|
+
get(build_endpoint(LIST_VAT_OF_COUNTRY,
|
18
|
+
location: location_id,
|
19
|
+
country: country_id), headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def list_for_location(location_id, headers = {}, &block)
|
23
|
+
get(build_endpoint(LIST_VAT_OF_LOCATION,
|
24
|
+
location: location_id), headers, &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def standard(headers = {}, &block)
|
28
|
+
get(build_endpoint(LIST_VAT_STANDARD), headers, &block)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Authentication
|
3
|
+
extend PlentyClient::Endpoint
|
4
|
+
extend PlentyClient::Request
|
5
|
+
|
6
|
+
AUTH_LOGIN = '/login'.freeze
|
7
|
+
AUTH_REFRESH = '/login/refresh'.freeze
|
8
|
+
AUTH_TOKEN = '/oauth/access_token'.freeze
|
9
|
+
AUTH_LOGOUT = '/logout'.freeze
|
10
|
+
AUTH_CLIENT = '/client-login'.freeze
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def access_token(headers = {}, &block)
|
14
|
+
get(build_endpoint(AUTH_TOKEN), headers, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def login(body = {})
|
18
|
+
post(build_endpoint(AUTH_LOGIN), body)
|
19
|
+
end
|
20
|
+
|
21
|
+
def login_refresh(body = {})
|
22
|
+
post(build_endpoint(AUTH_REFRESH), body)
|
23
|
+
end
|
24
|
+
|
25
|
+
def logout(body = {})
|
26
|
+
post(build_endpoint(AUTH_LOGOUT), body)
|
27
|
+
end
|
28
|
+
|
29
|
+
def client_access_token(body = {})
|
30
|
+
post(build_endpoint(AUTH_CLIENT), body)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Authorization
|
3
|
+
extend PlentyClient::Endpoint
|
4
|
+
extend PlentyClient::Request
|
5
|
+
|
6
|
+
AUTH_USER = '/authorized_user'.freeze
|
7
|
+
AUTH_USER_WITH_UI_CONFIG = '/user/authorized_user_with_ui_config'.freeze
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def list(headers = {}, &block)
|
11
|
+
get(build_endpoint(AUTH_TOKEN), headers, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def list_with_ui_config(headers = {}, &block)
|
15
|
+
get(build_endpoint(AUTH_USER_WITH_UI_CONFIG), headers, &block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Basket
|
3
|
+
class Item
|
4
|
+
extend PlentyClient::Endpoint
|
5
|
+
extend PlentyClient::Request
|
6
|
+
|
7
|
+
CREATE_BASKET_ITEM = '/basket/items'.freeze
|
8
|
+
LIST_BASKET_ITEMS = '/basket/items'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def list(headers = {}, &block)
|
12
|
+
get(LIST_BASKET_ITEMS, headers, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create(body = {})
|
16
|
+
post(CREATE_BASKET_ITEM, body)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Basket
|
3
|
+
extend PlentyClient::Endpoint
|
4
|
+
extend PlentyClient::Request
|
5
|
+
|
6
|
+
FIND_BASKET = '/basket'.freeze
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def find(headers = {}, &block)
|
10
|
+
get(build_endpoint(FIND_BASKET), headers, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Category
|
3
|
+
class Branch
|
4
|
+
extend PlentyClient::Endpoint
|
5
|
+
extend PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_CATEGORY_BRANCH = '/category_branches/{catId}'.freeze
|
8
|
+
LIST_CATEGORY_BRANCH = '/category_branches'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def list(headers = {}, &block)
|
12
|
+
get(build_endpoint(LIST_CATEGORY_BRANCH), headers, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def find(cat_id, headers = {}, &block)
|
16
|
+
get(build_endpoint(FIND_CATEGORY_BRANCH,
|
17
|
+
cat: cat_id), headers, &block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Category
|
3
|
+
class Template
|
4
|
+
extend PlentyClient::Endpoint
|
5
|
+
extend PlentyClient::Request
|
6
|
+
|
7
|
+
FIND_CATEGORY_TEMPLATE = '/categories/{catId}/templates'.freeze
|
8
|
+
UPDATE_CATEGORY_TEMPLATE = '/categories/{catId}/templates'.freeze
|
9
|
+
DELETE_CATEGORY_TEMPLATE = '/categories/{catId}/templates'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def list(cat_id, headers = {}, &block)
|
13
|
+
get(build_endpoint(LIST_BASKET_ITEMS,
|
14
|
+
cat: cat_id), headers, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def update(cat_id, body = {})
|
18
|
+
put(build_endpoint(UPDATE_CATEGORY_TEMPLATE,
|
19
|
+
cat: cat_id), body)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete(cat_id, body = {})
|
23
|
+
delete(build_endpoint(DELETE_CATEGORY_TEMPLATE,
|
24
|
+
cat: cat_id), body)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Category
|
3
|
+
extend PlentyClient::Endpoint
|
4
|
+
extend PlentyClient::Request
|
5
|
+
|
6
|
+
FIND_CATEGORY = '/categories/{catId}'.freeze
|
7
|
+
LIST_CATEGORIES = '/categories'.freeze
|
8
|
+
CREATE_CATEGORY = '/categories'.freeze
|
9
|
+
UPDATE_CATEGORY = '/categories/{catId}'.freeze
|
10
|
+
UPDATE_CATEGORIES = '/categories'.freeze
|
11
|
+
DELETE_CATEGORY = '/categories/{catId}'.freeze
|
12
|
+
DELETE_CATEGORY_DETAILS = '/categories/{catId}/details'.freeze
|
13
|
+
DELETE_CATEGORY_CLIENTS = '/categories/{catId}/clients'.freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def list(headers = {}, &block)
|
17
|
+
get(build_endpoint(LIST_CATEGORIES), headers, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def find(cat_id = nil, headers = {}, &block)
|
21
|
+
get(build_endpoint(FIND_CATEGORY, cat: cat_id), headers, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create(body = {})
|
25
|
+
post(CREATE_CATEGORY, body)
|
26
|
+
end
|
27
|
+
|
28
|
+
def update(cat_id, body = {})
|
29
|
+
post(build_endpoint(UPDATE_CATEGORY,
|
30
|
+
cat: cat_id), body)
|
31
|
+
end
|
32
|
+
|
33
|
+
def update_all(body = {})
|
34
|
+
post(build_endpoint(UPDATE_CATEGORIES), body)
|
35
|
+
end
|
36
|
+
|
37
|
+
def delete(cat_id, body = {})
|
38
|
+
delete(build_endpoint(DELETE_CATEGORY, cat: cat_id), body)
|
39
|
+
end
|
40
|
+
|
41
|
+
def delete_details(cat_id, body = {})
|
42
|
+
delete(build_endpoint(DELETE_CATEGORY_DETAILS, cat: cat_id), body)
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete_clients(cat_id, body = {})
|
46
|
+
delete(build_endpoint(DELETE_CATEGORY_CLIENTS, cat: cat_id), body)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module PlentyClient
|
2
|
+
module Comment
|
3
|
+
extend PlentyClient::Endpoint
|
4
|
+
extend PlentyClient::Request
|
5
|
+
|
6
|
+
FIND_COMMENT = '/comments/{commentId}'.freeze
|
7
|
+
LIST_COMMENTS = '/comments/{referenceType}/{referenceValue}'.freeze
|
8
|
+
CREATE_COMMENT = '/comments'.freeze
|
9
|
+
DELETE_COMMENT = '/comments/{commentId}'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def list(reference_type, reference_value, headers = {}, &block)
|
13
|
+
get(build_endpoint(LIST_COMMENTS,
|
14
|
+
reference_type: reference_type,
|
15
|
+
reference_value: reference_value), headers, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(comment_id, headers = {}, &block)
|
19
|
+
get(build_endpoint(FIND_COMMENT, comment: comment_id), headers, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(body = {})
|
23
|
+
post(CREATE_CATEGORY, body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def delete(cat_id, body = {})
|
27
|
+
delete(build_endpoint(DELETE_CATEGORY, comment: cat_id), body)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -17,6 +17,7 @@ module PlentyClient
|
|
17
17
|
cat: /\{catId\}/,
|
18
18
|
commission: /\{commissionId\}/,
|
19
19
|
component: /\{componentId\}/,
|
20
|
+
comment: /\{commentId\}/,
|
20
21
|
contact: /\{contactId\}/,
|
21
22
|
country: /\{countryId\}/,
|
22
23
|
coupon_string: /\{coupon\}/,
|
@@ -27,6 +28,7 @@ module PlentyClient
|
|
27
28
|
item: /\{itemId\}/,
|
28
29
|
item_set: /\{itemSetId\}/,
|
29
30
|
lang: /\{lang\}/,
|
31
|
+
location: /\{locationId\}/,
|
30
32
|
manufacturer: /\{manufacturerId\}/,
|
31
33
|
market: /\{marketId\}/,
|
32
34
|
market_ident_number: /\{marketIdentNumberId\}/,
|
@@ -40,6 +42,8 @@ module PlentyClient
|
|
40
42
|
property_group: /\{propertyGroupId\}/,
|
41
43
|
property: /\{propertyId\}/,
|
42
44
|
referrer: /\{referrerId\}/,
|
45
|
+
reference_type: /\{referenceType\}/,
|
46
|
+
reference_value: /\{referenceValue\}/,
|
43
47
|
sales_price: /\{salesPriceId\}/,
|
44
48
|
shipping_profile: /\{shippingProfileId\}/,
|
45
49
|
shipping_package: /\{orderShippingPackageId\}/,
|
@@ -9,9 +9,7 @@ module PlentyClient
|
|
9
9
|
start_time = Time.now
|
10
10
|
response = perform(http_method, path, params)
|
11
11
|
body = parse_body(response, http_method, path, params)
|
12
|
-
if PlentyClient::Config.log
|
13
|
-
log_output(http_method, base_url(path), params, time_diff_ms(start_time, Time.now))
|
14
|
-
end
|
12
|
+
log_output(http_method, base_url(path), params, time_diff_ms(start_time, Time.now)) if PlentyClient::Config.log
|
15
13
|
body
|
16
14
|
end
|
17
15
|
|
@@ -42,8 +40,7 @@ module PlentyClient
|
|
42
40
|
break if response['isLastPage'] == true
|
43
41
|
end
|
44
42
|
else
|
45
|
-
|
46
|
-
rval_array << rval
|
43
|
+
rval_array << request(:get, path, params.merge(page: page))
|
47
44
|
end
|
48
45
|
rval_array.flatten
|
49
46
|
end
|
data/lib/plenty_client.rb
CHANGED
@@ -2,15 +2,30 @@ require 'curl'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
module PlentyClient
|
5
|
-
autoload :Version, 'plenty_client/version'
|
6
5
|
autoload :Config, 'plenty_client/config'
|
6
|
+
autoload :Constants, 'plenty_client/constants'
|
7
7
|
autoload :Endpoint, 'plenty_client/endpoint'
|
8
8
|
autoload :Request, 'plenty_client/request'
|
9
|
-
autoload :
|
9
|
+
autoload :Version, 'plenty_client/version'
|
10
10
|
|
11
|
-
autoload :
|
12
|
-
autoload :
|
13
|
-
autoload :
|
11
|
+
autoload :Accounting, 'plenty_client/accounting'
|
12
|
+
autoload :Authentication, 'plenty_client/authentication'
|
13
|
+
autoload :Authorization, 'plenty_client/authorization'
|
14
|
+
autoload :Basket, 'plenty_client/basket'
|
15
|
+
autoload :Category, 'plenty_client/category'
|
16
|
+
autoload :Comment, 'plenty_client/comment'
|
17
|
+
autoload :Item, 'plenty_client/item'
|
18
|
+
autoload :ItemSet, 'plenty_client/item_set'
|
19
|
+
autoload :Order, 'plenty_client/order'
|
20
|
+
|
21
|
+
module Basket
|
22
|
+
autoload :Item, 'plenty_client/basket/item'
|
23
|
+
end
|
24
|
+
|
25
|
+
module Category
|
26
|
+
autoload :Branch, 'plenty_client/category/branch'
|
27
|
+
autoload :Template, 'plenty_client/category/template'
|
28
|
+
end
|
14
29
|
|
15
30
|
module Item
|
16
31
|
autoload :Attribute, 'plenty_client/item/attribute'
|
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.2
|
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-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,7 @@ executables: []
|
|
94
94
|
extensions: []
|
95
95
|
extra_rdoc_files: []
|
96
96
|
files:
|
97
|
+
- ".codeclimate.yml"
|
97
98
|
- ".gitignore"
|
98
99
|
- ".rspec"
|
99
100
|
- ".rubocop.yml"
|
@@ -104,6 +105,15 @@ files:
|
|
104
105
|
- README.md
|
105
106
|
- Rakefile
|
106
107
|
- lib/plenty_client.rb
|
108
|
+
- lib/plenty_client/accounting.rb
|
109
|
+
- lib/plenty_client/authentication.rb
|
110
|
+
- lib/plenty_client/authorization.rb
|
111
|
+
- lib/plenty_client/basket.rb
|
112
|
+
- lib/plenty_client/basket/item.rb
|
113
|
+
- lib/plenty_client/category.rb
|
114
|
+
- lib/plenty_client/category/branch.rb
|
115
|
+
- lib/plenty_client/category/template.rb
|
116
|
+
- lib/plenty_client/comment.rb
|
107
117
|
- lib/plenty_client/config.rb
|
108
118
|
- lib/plenty_client/constants.rb
|
109
119
|
- lib/plenty_client/endpoint.rb
|
@@ -197,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
207
|
version: '0'
|
198
208
|
requirements: []
|
199
209
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.6.10
|
201
211
|
signing_key:
|
202
212
|
specification_version: 4
|
203
213
|
summary: This is Version 1 of the PlentyMarkets Rest Client for Ruby.
|