zinc-api 0.0.5 → 0.0.6
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/lib/zinc.rb +8 -0
- data/lib/zinc/address.rb +1 -0
- data/lib/zinc/product.rb +45 -2
- data/lib/zinc/seller_selection_criteria.rb +13 -2
- data/lib/zinc/shipping.rb +1 -0
- data/zinc-api.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 254d2b2d75e160bcc03500114258a96f7cdc63f4
|
4
|
+
data.tar.gz: 9e4a3ea7d09423b3f950c77b60adbe48c98732e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed0dddfdd3c6814c39a02b6f7f3565ef08c604f23c8806f6892b636a46802dc85027e340a2b37f0f26460cd6eca80a9c6c38ebb6eeb93aca245a1b303ab611e7
|
7
|
+
data.tar.gz: 7ccbc429975a08eceda8852e8f00aa1c6219305a5fb5bff68b0900b2c5614a49a310be31d5286f4a7d77d48e754301b69930786ab5f4f27d260555dbe7bd0657
|
data/lib/zinc.rb
CHANGED
data/lib/zinc/address.rb
CHANGED
data/lib/zinc/product.rb
CHANGED
@@ -1,6 +1,33 @@
|
|
1
1
|
module Zinc
|
2
|
-
class Product <
|
3
|
-
|
2
|
+
class Product < Resource
|
3
|
+
# http://docs.zincapi.com/#product-details AND
|
4
|
+
# http://docs.zincapi.com/#product-object
|
5
|
+
attr_accessor :status,
|
6
|
+
:retailer,
|
7
|
+
:product_id,
|
8
|
+
:timestamp,
|
9
|
+
:title,
|
10
|
+
:product_details,
|
11
|
+
:feature_bullets,
|
12
|
+
:brand,
|
13
|
+
:main_image,
|
14
|
+
:images,
|
15
|
+
:variant_specifics,
|
16
|
+
:all_variants,
|
17
|
+
:categories,
|
18
|
+
:authors,
|
19
|
+
:product_description,
|
20
|
+
:epids,
|
21
|
+
:epids_map,
|
22
|
+
:package_dimensions,
|
23
|
+
:item_location, # AliExpress-only.
|
24
|
+
:original_retail_price, # Amazon-only.
|
25
|
+
:price, # Amazon-only.
|
26
|
+
:review_count, # Amazon-only.
|
27
|
+
:stars, # Amazon-only.
|
28
|
+
:question_count, # Amazon-only.
|
29
|
+
:asin, # Amazon-only.
|
30
|
+
:item_number, # Costco-only.
|
4
31
|
:quantity,
|
5
32
|
:seller_selection_criteria
|
6
33
|
|
@@ -8,5 +35,21 @@ module Zinc
|
|
8
35
|
super(hash, exclude: %w(seller_selection_criteria))
|
9
36
|
@seller_selection_criteria = SellerSelectionCriteria.new(hash['seller_selection_criteria']) if hash['seller_selection_criteria']
|
10
37
|
end
|
38
|
+
|
39
|
+
class << self
|
40
|
+
def find(id, retailer:, async: false, max_age: nil, newer_than: nil)
|
41
|
+
unless Zinc::RETAILERS.include?(retailer)
|
42
|
+
raise StandardError, "#{retailer} is not supported - the supported retailers are #{Zinc::RETAILERS.to_sentence}"
|
43
|
+
end
|
44
|
+
|
45
|
+
params = {}
|
46
|
+
params['retailer'] = retailer
|
47
|
+
params['async'] = true if async
|
48
|
+
params['max_age'] = max_age if max_age
|
49
|
+
params['newer_than'] = newer_than if newer_than
|
50
|
+
|
51
|
+
get(path: "products/#{id}?#{URI.encode_www_form(params)}")
|
52
|
+
end
|
53
|
+
end
|
11
54
|
end
|
12
55
|
end
|
@@ -1,7 +1,18 @@
|
|
1
1
|
module Zinc
|
2
2
|
class SellerSelectionCriteria < Model
|
3
|
-
|
3
|
+
# http://docs.zincapi.com/#seller-selection-criteria-object
|
4
|
+
attr_accessor :addon,
|
5
|
+
:buy_box,
|
6
|
+
:condition_in,
|
7
|
+
:condition_not_in,
|
8
|
+
:first_party_seller,
|
4
9
|
:handling_days_max,
|
5
|
-
:
|
10
|
+
:international,
|
11
|
+
:max_item_price,
|
12
|
+
:merchant_id_in,
|
13
|
+
:merchant_id_not_in,
|
14
|
+
:min_seller_num_ratings,
|
15
|
+
:min_seller_percent_positive_feedback,
|
16
|
+
:prime
|
6
17
|
end
|
7
18
|
end
|
data/lib/zinc/shipping.rb
CHANGED
data/zinc-api.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zinc-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Estreich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|