promoqui-api-sdk 1.7.6 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pqsdk.rb +1 -0
- data/lib/pqsdk/brand.rb +38 -0
- data/lib/pqsdk/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce270a95c42e5445ff87e9d0efe52218ccf1df8c
|
4
|
+
data.tar.gz: d3842f9ceb30f554cda9438f52c36c1c86162125
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07201749320f0add199368b6416945d60e7b9b1ccbf9c72664f32151f64e8f0b6d54a3b5bf330e6872f40202bc5c0d5caaf430cd3741aec24c255fe8fb8dbb9e
|
7
|
+
data.tar.gz: ede1ba8d8b89f63284451e740a2c228f8d19489a07267478e68a6bed4376c289a2b7c1056a586d86439e7dfd5850009ef11a09ed68d132721f7ee931568034ee
|
data/lib/pqsdk.rb
CHANGED
data/lib/pqsdk/brand.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module PQSDK
|
2
|
+
class Brand
|
3
|
+
attr_accessor :id, :name, :slug
|
4
|
+
|
5
|
+
def self.list
|
6
|
+
res = RestLayer.get('v1/brands', {}, { 'Authorization' => "Bearer #{Token.access_token}" })
|
7
|
+
if res[0] == 200
|
8
|
+
res[1].map{|brand| Brand.from_json(brand)}
|
9
|
+
elsif res[0] == 404
|
10
|
+
nil
|
11
|
+
else
|
12
|
+
raise Exception.new("Unexpected HTTP status code #{res[0]}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.find(name)
|
17
|
+
res = RestLayer.get('v1/brands/search', { q: name }, { 'Authorization' => "Bearer #{Token.access_token}" })
|
18
|
+
if res[0] == 200
|
19
|
+
Brand.from_json res[1]
|
20
|
+
elsif res[0] == 404
|
21
|
+
nil
|
22
|
+
else
|
23
|
+
raise Exception.new("Unexpected HTTP status code #{res[0]}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def self.from_json(json)
|
29
|
+
result = Brand.new
|
30
|
+
|
31
|
+
json.each do |key, val|
|
32
|
+
result.send("#{key}=", val)
|
33
|
+
end
|
34
|
+
|
35
|
+
result
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/pqsdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promoqui-api-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Boffa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -31,6 +31,7 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- lib/pqsdk.rb
|
34
|
+
- lib/pqsdk/brand.rb
|
34
35
|
- lib/pqsdk/city.rb
|
35
36
|
- lib/pqsdk/leaflet.rb
|
36
37
|
- lib/pqsdk/offer.rb
|
@@ -60,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
61
|
version: '0'
|
61
62
|
requirements: []
|
62
63
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.4.
|
64
|
+
rubygems_version: 2.4.3
|
64
65
|
signing_key:
|
65
66
|
specification_version: 4
|
66
67
|
summary: A wrapper around PromoQui HTTP Crawler API
|