pricesphere 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/create_watch.rb +11 -0
- data/examples/{example.rb → product_search.rb} +0 -0
- data/lib/pricesphere.rb +1 -0
- data/lib/pricesphere/version.rb +1 -1
- data/lib/pricesphere/watch.rb +29 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70e7fd68fbeb72d98ce5b8c314047a45b05baf27
|
4
|
+
data.tar.gz: ac2807d98028a756462007005a7ca66b8d25c8e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a7c6985b0f3b0d2fed3160572b96ce18d7de43c56d21817db367376eb96303b747f2bf8dfb5411b9ad40dc385e630f334692b34983d0de152e0da47b25d29c2
|
7
|
+
data.tar.gz: 9105604527d5640f5fe991ff6d91c0bb8b9ac475048f5bbe48494a7ec6ce7b6cecf2a0186bb0601033fcc5b9e4db7dc62c5c7292492849f52070ef13218c3a5e
|
File without changes
|
data/lib/pricesphere.rb
CHANGED
data/lib/pricesphere/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Pricesphere
|
2
|
+
class Watch < Base
|
3
|
+
|
4
|
+
def register(product_id, webhook_path, callback_params = {})
|
5
|
+
uri = URI.parse(Pricesphere.base_url)
|
6
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
7
|
+
if Pricesphere.base_url =~ /\Ahttps:/
|
8
|
+
http.use_ssl = true
|
9
|
+
end
|
10
|
+
|
11
|
+
request = Net::HTTP::Post.new("/api/#{@version}/watches")
|
12
|
+
request.add_field('Content-Type', 'application/json')
|
13
|
+
request.body = {
|
14
|
+
watch: {
|
15
|
+
product_id: product_id,
|
16
|
+
webhook_path: webhook_path,
|
17
|
+
webhook_attributes: callback_params.to_json
|
18
|
+
},
|
19
|
+
token: @api_key
|
20
|
+
}.to_json
|
21
|
+
|
22
|
+
response = http.request(request)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pricesphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris MacNaughton
|
@@ -66,12 +66,14 @@ files:
|
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
|
-
- examples/
|
69
|
+
- examples/create_watch.rb
|
70
|
+
- examples/product_search.rb
|
70
71
|
- lib/pricesphere.rb
|
71
72
|
- lib/pricesphere/base.rb
|
72
73
|
- lib/pricesphere/error.rb
|
73
74
|
- lib/pricesphere/product.rb
|
74
75
|
- lib/pricesphere/version.rb
|
76
|
+
- lib/pricesphere/watch.rb
|
75
77
|
- pricesphere.gemspec
|
76
78
|
homepage: ''
|
77
79
|
licenses:
|