pricegrabber 0.1.0 → 0.1.1

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: 5c4c354be927afee774eeb1e6df2b4641b93d7c3
4
- data.tar.gz: bf1bb8a37bdcd40aa96aa9f11604a53ef4da8ad6
3
+ metadata.gz: 0f968667d22269c277dc219379f78725447ec948
4
+ data.tar.gz: 968e5e69eb37ac74c57bd5228350b13beab7e7b6
5
5
  SHA512:
6
- metadata.gz: b28c0b4a7c5e2b49bdd5a321a6a8a76920dbd5c1c0db29e9c45c8ac6388756d74ef6dbcac6cba3f4523e21245c5ae5bccd8c1fa4634b158746a1d74f22739a77
7
- data.tar.gz: a64d3a69ea70c449a4e969b7463f494666affdabbe37215a47a5f48a6426023eb92fd3a143453190eb80a1c6f90016dbcf040a052242c3eb786e3beefd19dfa9
6
+ metadata.gz: a08abcac34f81624bd7cda1ea88a3065c74fbd5ad91e8d92b833d2b5d70b0c501e7ba5776d4b1f87428e763c7377325369d30748c86fe3273dc6467ab72c2dce
7
+ data.tar.gz: 5dbbc5a7b27a2690339aa90b08c167f8be37ed3373804eebac5edafc59568cc1edc643e00058601e06b5cbc3fc748794a187d2967c2c647555e687222317c41f
@@ -1,15 +1,16 @@
1
1
  module PriceGrabber
2
2
  class Client
3
- def initialize(api_key:)
3
+ def initialize(api_key:, environment: :staging)
4
+ @environment = environment
4
5
  @api_key = api_key
5
6
  end
6
7
 
7
8
  def find_by_id(asin: nil, upc: nil)
8
- Request.new(asin: asin, upc: upc, version: '2.55', pid: '1107', key: @api_key)
9
+ Request.new(asin: asin, upc: upc, version: '2.55', pid: '1107', key: @api_key, environment: @environment)
9
10
  end
10
11
 
11
12
  def search(query)
12
- Request.new(q: query, upc: '1', version: '2.55', pid: '1107', key: @api_key)
13
+ Request.new(q: query, upc: '1', version: '2.55', pid: '1107', key: @api_key, environment: @environment)
13
14
  end
14
15
  end
15
16
  end
@@ -3,7 +3,10 @@ require 'httpi'
3
3
 
4
4
  module PriceGrabber
5
5
  class Request
6
- def initialize(version:, pid:, key:, asin: nil, q: nil, masterid: nil, upc: nil, driver: :net_http)
6
+ attr_reader :environment
7
+
8
+ def initialize(version:, pid:, key:, asin: nil, q: nil, masterid: nil, upc: nil, environment: :staging, driver: :net_http)
9
+ @environment = environment
7
10
  @version = version
8
11
  @pid = pid
9
12
  @key = key
@@ -18,7 +21,11 @@ module PriceGrabber
18
21
  def to_uri
19
22
  uri = ::URI::HTTP.build({})
20
23
  uri.scheme = "http"
21
- uri.host = "sws.api.pricegrabber.com"
24
+ if @environment == :production
25
+ uri.host = "sws.pricegrabber.com"
26
+ else
27
+ uri.host = "sws.api.pricegrabber.com"
28
+ end
22
29
  uri.path = "/search_xml.php"
23
30
  uri.query = [
24
31
  version,
@@ -1,3 +1,3 @@
1
1
  module Pricegrabber
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pricegrabber
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
  - Timothy Raymond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpi