shop_express 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -5
- data/lib/shop_express/base.rb +2 -0
- data/lib/shop_express/catalog_export.rb +30 -0
- data/lib/shop_express/import_residues.rb +0 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 130730098a5790e13912632ad714ab719fc8063fbb3f70daa1eda8553ea88c31
|
4
|
+
data.tar.gz: 5bfd59df810e1256ef25ca0a2425c549212259903f10ffc5aaeceb74cbec5850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c3bde3127497796fdb8f8a050049085eebd6fdbecb9a08ed684e6ef055209fd84bac0668cb8cd3b1b9abca7c67efebd1785702bd5d00ff57df2c746a51ecc7
|
7
|
+
data.tar.gz: cb2367f193e284bb7867c260d4141e49166684d2d3fb5117eb4c16c3f21f733b5c928ae9482b7175ffe4e885c3e448e071109a2642462d5182cf0b660326e96e
|
data/README.md
CHANGED
@@ -1,11 +1,24 @@
|
|
1
|
-
This is gem used for exchange data with shop-express.ua internet shop constructor
|
1
|
+
This is gem used for exchange data with https://shop-express.ua - internet shop constructor
|
2
2
|
|
3
|
-
Authorization
|
3
|
+
### Authorization
|
4
|
+
At first, you must create instance of class ShopExpress with valid params to connect
|
4
5
|
After that you just use instance shop_express for all next requests.
|
5
6
|
|
6
7
|
shop_express = ShopExpress::Client.new(url: URI.parse('http://somesite.org'), username: 'jhon', password: 'piterson')
|
7
|
-
|
8
8
|
ShopExpress::Authotization.new(shop_express).authorize
|
9
|
-
|
9
|
+
|
10
|
+
|
11
|
+
### ImportResidues
|
12
|
+
Send returns all log data without OK status.
|
13
|
+
```ruby
|
14
|
+
ShopExpress::ImportResidues.new(shop_express).call(hash)
|
15
|
+
```
|
10
16
|
|
11
|
-
|
17
|
+
### CatalogExport
|
18
|
+
Returns all products in the catalog. Possible arguments:
|
19
|
+
- limit (default 5000)
|
20
|
+
- offset (default: 0)
|
21
|
+
- display_in_show_case ("true" - only goods with quantity > 0, "false" all goods)
|
22
|
+
```ruby
|
23
|
+
ShopExpress::CatalogExport.new(shop_express).call(limit: 100, offset: 5)
|
24
|
+
```
|
data/lib/shop_express/base.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShopExpress
|
4
|
+
# get list of the products from the shop_express
|
5
|
+
class CatalogExport < ::ShopExpress::Base
|
6
|
+
URL = 'api/catalog/export'
|
7
|
+
|
8
|
+
# @param limit [Integer]
|
9
|
+
# @param offset [Integer]
|
10
|
+
# @param display_in_show_case [String] possible values (false, true)
|
11
|
+
def call(limit: 5000, offset: 0, display_in_show_case: 'false')
|
12
|
+
request_body = {
|
13
|
+
limit: limit,
|
14
|
+
offset: offset,
|
15
|
+
display_in_showcase: display_in_show_case
|
16
|
+
}
|
17
|
+
|
18
|
+
response_body = post(shop_express: shop_express, url: URL, body: request_body, add_token: true)
|
19
|
+
parse_response(response_body)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def parse_response(body)
|
25
|
+
return [] if body['status'] != STATUS_OK
|
26
|
+
|
27
|
+
body.dig('response', 'products')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shop_express
|
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
|
- Denys Krupenov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/shop_express.rb
|
36
36
|
- lib/shop_express/authorization.rb
|
37
37
|
- lib/shop_express/base.rb
|
38
|
+
- lib/shop_express/catalog_export.rb
|
38
39
|
- lib/shop_express/connection.rb
|
39
40
|
- lib/shop_express/import_residues.rb
|
40
41
|
homepage: https://github.com/dkru/shop_express
|