pricegrabber 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/pricegrabber/client.rb +4 -3
- data/lib/pricegrabber/request.rb +9 -2
- data/lib/pricegrabber/version.rb +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: 0f968667d22269c277dc219379f78725447ec948
|
4
|
+
data.tar.gz: 968e5e69eb37ac74c57bd5228350b13beab7e7b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a08abcac34f81624bd7cda1ea88a3065c74fbd5ad91e8d92b833d2b5d70b0c501e7ba5776d4b1f87428e763c7377325369d30748c86fe3273dc6467ab72c2dce
|
7
|
+
data.tar.gz: 5dbbc5a7b27a2690339aa90b08c167f8be37ed3373804eebac5edafc59568cc1edc643e00058601e06b5cbc3fc748794a187d2967c2c647555e687222317c41f
|
data/lib/pricegrabber/client.rb
CHANGED
@@ -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
|
data/lib/pricegrabber/request.rb
CHANGED
@@ -3,7 +3,10 @@ require 'httpi'
|
|
3
3
|
|
4
4
|
module PriceGrabber
|
5
5
|
class Request
|
6
|
-
|
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
|
-
|
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,
|
data/lib/pricegrabber/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpi
|