crema-api-ruby-client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crema/client.rb +13 -3
- data/lib/crema/product.rb +1 -1
- data/lib/crema/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72799468c33f923de4d6d7431a22af070898267d4d81bd7ad8840078f9987dfc
|
4
|
+
data.tar.gz: 6dc404062766c2fe4cbb0fbd9006b16b13c0db9bc33df7ad9730e7ce1452a98a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab0e78aad426d281ac0fdf929e0343fc786d7ea0f8717a72ce9985e0fade571d2222626a20091cbd4abc82137a90f07bfa6cfdaeffd56b37fcb8f48b89b349a4
|
7
|
+
data.tar.gz: 49a978549935147ed0c185ac723422d111dfa1094e23a87d5fd63772b17c6448d4d2156d5e8a10cfc86d3dbc8d5ce211ff78543cde8652f0cca666e8234acac9
|
data/lib/crema/client.rb
CHANGED
@@ -1,16 +1,26 @@
|
|
1
1
|
module Crema
|
2
2
|
class Client < Base
|
3
|
-
def fetch_products(brand_id, page: 1, limit: 30, status: 'selling')
|
3
|
+
def fetch_products(brand_id: nil, page: 1, limit: 30, status: 'selling')
|
4
4
|
response = connection.get(
|
5
5
|
'/v1/products',
|
6
|
-
access_token: Crema.config.access_token,
|
7
6
|
brand_id: brand_id,
|
8
7
|
page: page,
|
9
8
|
limit: limit,
|
10
|
-
status: status
|
9
|
+
status: status,
|
10
|
+
access_token: Crema.config.access_token
|
11
11
|
)
|
12
12
|
return nil unless response.success?
|
13
13
|
JSON.parse(response.body).map { |i| Product.new(i) }
|
14
14
|
end
|
15
|
+
|
16
|
+
def fetch_product(product_id, brand_id: nil)
|
17
|
+
response = connection.get(
|
18
|
+
"/v1/products/#{product_id}",
|
19
|
+
brand_id: brand_id,
|
20
|
+
access_token: Crema.config.access_token
|
21
|
+
)
|
22
|
+
return nil unless response.success?
|
23
|
+
Product.new(JSON.parse(response.body))
|
24
|
+
end
|
15
25
|
end
|
16
26
|
end
|
data/lib/crema/product.rb
CHANGED
data/lib/crema/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crema-api-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashal aka JOKER
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|