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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7af71b5542d685f26f87eb66d9010e6108add514
4
- data.tar.gz: fcf1102956b138c48af9e220294701a79d780a32
3
+ metadata.gz: 254d2b2d75e160bcc03500114258a96f7cdc63f4
4
+ data.tar.gz: 9e4a3ea7d09423b3f950c77b60adbe48c98732e1
5
5
  SHA512:
6
- metadata.gz: ddbbdd2077bc9b0da2c0e3ebb32875406b18af4780cdcf6e4c38f59597d0ddd1fdb7eae94d247fd4438a609de8861ffc1d7c21a58ce7b4610af328c828bbda30
7
- data.tar.gz: 717c210be334501ec6f987e51544794f630a48806cb9e1f28a5ea563ec07fc57ed3857e8d9f2d44df596e9a212a5cbce5c367036ebb92dfd8341c2b15b95dff0
6
+ metadata.gz: ed0dddfdd3c6814c39a02b6f7f3565ef08c604f23c8806f6892b636a46802dc85027e340a2b37f0f26460cd6eca80a9c6c38ebb6eeb93aca245a1b303ab611e7
7
+ data.tar.gz: 7ccbc429975a08eceda8852e8f00aa1c6219305a5fb5bff68b0900b2c5614a49a310be31d5286f4a7d77d48e754301b69930786ab5f4f27d260555dbe7bd0657
@@ -1,6 +1,14 @@
1
1
  require 'rest-client'
2
2
 
3
3
  module Zinc
4
+ RETAILERS = %w(
5
+ aliexpress
6
+ amazon amazon_uk amazon_ca amazon_de amazon_mx amazon_de
7
+ costco
8
+ walmart
9
+ wayfair
10
+ ).freeze
11
+
4
12
  class << self
5
13
  attr_accessor :api_path, :access_token, :logger
6
14
 
@@ -1,5 +1,6 @@
1
1
  module Zinc
2
2
  class Address < Model
3
+ # http://docs.zincapi.com/#address-object
3
4
  attr_accessor :first_name,
4
5
  :last_name,
5
6
  :address_line1,
@@ -1,6 +1,33 @@
1
1
  module Zinc
2
- class Product < Model
3
- attr_accessor :product_id,
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
- attr_accessor :prime,
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
- :condition_in
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
@@ -1,5 +1,6 @@
1
1
  module Zinc
2
2
  class Shipping < Model
3
+ # http://docs.zincapi.com/#shipping-object
3
4
  attr_accessor :order_by,
4
5
  :max_days,
5
6
  :max_price
@@ -5,7 +5,7 @@
5
5
  # gem push zinc-api-{VERSION}.gem
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'zinc-api'
8
- s.version = '0.0.5'
8
+ s.version = '0.0.6'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.licenses = ['MIT']
11
11
  s.authors = ['Chris Estreich']
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.5
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-04-10 00:00:00.000000000 Z
11
+ date: 2018-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client