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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 539c41f5531d70d08105841ec87cf6ddce63343e80cd6052441ccfa8a3fd711a
4
- data.tar.gz: 110471f58c45e683527c54dac505fa7929b196f7ff04e458025a774ee70e901b
3
+ metadata.gz: 72799468c33f923de4d6d7431a22af070898267d4d81bd7ad8840078f9987dfc
4
+ data.tar.gz: 6dc404062766c2fe4cbb0fbd9006b16b13c0db9bc33df7ad9730e7ce1452a98a
5
5
  SHA512:
6
- metadata.gz: 819ef3679d9d80c5176294dd92ddae46d8caf45838937c3b7df890fccd2f9cd71dc0f5a7a21840e6dad76bd67356db2fd7be14eeb8abef9937e91c6304c60f47
7
- data.tar.gz: 6106ed184ad04cddc56a7dce2a32c68a3c5e386775fa1cee6ffb799a807b168255de0463230a5f7bff7a9e24d3601932864c8795984ee86933a175c1880de1a7
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
@@ -6,7 +6,7 @@ module Crema
6
6
 
7
7
  %w[
8
8
  id name code org_price final_price product_status display reviews_count
9
- created_at updated_at
9
+ url created_at updated_at
10
10
  ].each do |key|
11
11
  code = %(
12
12
  def #{key}
data/lib/crema/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Crema
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
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.0
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-29 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday