vidsy-data-api 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vidsy/data/api/brand.rb +22 -0
- data/lib/vidsy/data/api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93f40e4e9c553a989d40f3c585dbd3e1cb57f72c
|
4
|
+
data.tar.gz: b379b58644a2bfdc978dc1d8da777e306d004ec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 170bc521276ffb37cf0ea1cf64ad478546ab29a520e4dae31768e78cdfefd679956fd4c7332e213a4e3b1023265e5ce457c5ce6e8929c7e020454fe44a958e7b
|
7
|
+
data.tar.gz: ec0362660160e90858633f58db0e130c7d03648857bfae9b6c679a3bc4be18afc09ba33b9a7f998e3495601cc614cf108db940f22c34c77fdb411b737fb91093
|
data/lib/vidsy/data/api/brand.rb
CHANGED
@@ -4,10 +4,32 @@ module Vidsy
|
|
4
4
|
module Data
|
5
5
|
module API
|
6
6
|
class Brand < Client
|
7
|
+
def initialize(id = nil)
|
8
|
+
@id = id
|
9
|
+
end
|
10
|
+
|
11
|
+
def challenges
|
12
|
+
raise(ArgumentError, "ID not set for Brand") if id.nil?
|
13
|
+
challenges = get "#{routes.brand}/#{id}/#{routes.challenges}"
|
14
|
+
challenges.size == 0 ? nil : challenges
|
15
|
+
end
|
16
|
+
|
7
17
|
def self.all
|
8
18
|
brands = get "#{routes.brands}"
|
9
19
|
brands.size == 0 ? nil : brands
|
10
20
|
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :id
|
25
|
+
|
26
|
+
def get(path)
|
27
|
+
self.class.superclass.method(:get).call path
|
28
|
+
end
|
29
|
+
|
30
|
+
def routes
|
31
|
+
self.class.superclass.method(:routes).call
|
32
|
+
end
|
11
33
|
end
|
12
34
|
end
|
13
35
|
end
|