wes-data-api 5.8.1 → 6.0.0
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 +4 -4
- data/lib/wes/data/api/model/base.rb +3 -2
- data/lib/wes/data/api/model/brand.rb +10 -3
- data/lib/wes/data/api/model/brand_user.rb +10 -4
- data/lib/wes/data/api/model/challenge.rb +33 -16
- data/lib/wes/data/api/model/challenge_answer.rb +1 -1
- data/lib/wes/data/api/model/creator_user.rb +21 -12
- data/lib/wes/data/api/model/submission.rb +8 -3
- data/lib/wes/data/api/response.rb +1 -1
- data/lib/wes/data/api.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: 672ea7c8e8c570ec0592654e7108cadb251290d3
|
4
|
+
data.tar.gz: c6fcf8c72f4d727cd6149367b843d300fb85aa6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffe56aefcf0be912807a175be4ded8d0c7550ae7410eccdf7f98afec55c111c14c0df185a18c08f3a9916e930d21a567d70c9cacadfc23d85fdce4b21533f97a
|
7
|
+
data.tar.gz: 5faa6474b4c74271f5ff1edca9a6f77ad3e8f5aa74b61716a79d33b26a2c05a2f17c2424661c29555b34a9201380b31c033263e1c1acfaebbb3e6a3539f985ef
|
@@ -6,12 +6,19 @@ module Wes
|
|
6
6
|
module API
|
7
7
|
module Model
|
8
8
|
class Brand < Base
|
9
|
-
def challenges
|
10
|
-
|
9
|
+
def challenges(fetch: false)
|
10
|
+
records = fetch ? fetch_challenges : @attributes.challenges
|
11
11
|
map_objects(
|
12
|
-
|
12
|
+
records, Wes::Data::API::Model::Challenge
|
13
13
|
)
|
14
14
|
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def fetch_challenges
|
19
|
+
route = [routes.brand, id, routes.challenges].join("/")
|
20
|
+
client.get(route)
|
21
|
+
end
|
15
22
|
end
|
16
23
|
end
|
17
24
|
end
|
@@ -15,11 +15,10 @@ module Wes
|
|
15
15
|
self
|
16
16
|
end
|
17
17
|
|
18
|
-
def brands
|
19
|
-
|
18
|
+
def brands(fetch: false)
|
19
|
+
records = fetch ? fetch_brands : @attributes.brands
|
20
20
|
map_objects(
|
21
|
-
|
22
|
-
Wes::Data::API::Model::Brand
|
21
|
+
records, Wes::Data::API::Model::Brand
|
23
22
|
)
|
24
23
|
end
|
25
24
|
|
@@ -28,6 +27,13 @@ module Wes
|
|
28
27
|
def id
|
29
28
|
attributes.auth0_id
|
30
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def fetch_brands
|
34
|
+
route = [routes.brand_user, id, routes.brands].join("/")
|
35
|
+
client.get(route)
|
36
|
+
end
|
31
37
|
end
|
32
38
|
end
|
33
39
|
end
|
@@ -9,10 +9,10 @@ module Wes
|
|
9
9
|
module API
|
10
10
|
module Model
|
11
11
|
class Challenge < Base
|
12
|
-
def answers
|
12
|
+
def answers(fetch: false)
|
13
|
+
records = fetch ? client.get(answers_route) : @attributes.answers
|
13
14
|
map_objects(
|
14
|
-
|
15
|
-
Wes::Data::API::Model::ChallengeAnswer
|
15
|
+
records, Wes::Data::API::Model::ChallengeAnswer
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
@@ -24,19 +24,18 @@ module Wes
|
|
24
24
|
client.put(answers_route, answers)
|
25
25
|
end
|
26
26
|
|
27
|
-
def rewards
|
28
|
-
|
27
|
+
def rewards(fetch: false)
|
28
|
+
records = fetch ? fetch_rewards : @attributes.rewards
|
29
29
|
map_objects(
|
30
|
-
|
30
|
+
records, Wes::Data::API::Model::Reward
|
31
31
|
)
|
32
32
|
end
|
33
33
|
|
34
|
-
def users(state
|
35
|
-
|
36
|
-
|
37
|
-
)
|
34
|
+
def users(state: nil, fetch: false)
|
35
|
+
records = fetch || !state.nil? ? fetch_users(state)
|
36
|
+
: @attributes.users
|
38
37
|
map_objects(
|
39
|
-
|
38
|
+
records, Wes::Data::API::Model::CreatorUser
|
40
39
|
)
|
41
40
|
end
|
42
41
|
|
@@ -53,12 +52,11 @@ module Wes
|
|
53
52
|
update(:status => s)
|
54
53
|
end
|
55
54
|
|
56
|
-
def videos(state
|
57
|
-
|
58
|
-
|
59
|
-
)
|
55
|
+
def videos(state: nil, fetch: false)
|
56
|
+
records = fetch || !state.nil? ? fetch_videos(state)
|
57
|
+
: @attributes.videos
|
60
58
|
map_objects(
|
61
|
-
|
59
|
+
records, Wes::Data::API::Model::Video
|
62
60
|
)
|
63
61
|
end
|
64
62
|
|
@@ -67,6 +65,25 @@ module Wes
|
|
67
65
|
def answers_route
|
68
66
|
[routes.challenge, id, routes.answers].join("/")
|
69
67
|
end
|
68
|
+
|
69
|
+
def fetch_rewards
|
70
|
+
route = [routes.challenge, id, routes.rewards].join("/")
|
71
|
+
client.get(route)
|
72
|
+
end
|
73
|
+
|
74
|
+
def fetch_users(state)
|
75
|
+
route = add_state(
|
76
|
+
[routes.challenge, id, routes.creator_users].join("/"), state
|
77
|
+
)
|
78
|
+
client.get(route)
|
79
|
+
end
|
80
|
+
|
81
|
+
def fetch_videos(state)
|
82
|
+
route = add_state(
|
83
|
+
[routes.challenge, id, routes.videos].join("/"), state
|
84
|
+
)
|
85
|
+
client.get(route)
|
86
|
+
end
|
70
87
|
end
|
71
88
|
end
|
72
89
|
end
|
@@ -8,12 +8,11 @@ module Wes
|
|
8
8
|
module API
|
9
9
|
module Model
|
10
10
|
class CreatorUser < Base
|
11
|
-
def submissions(state
|
12
|
-
|
13
|
-
|
14
|
-
)
|
11
|
+
def submissions(state: nil, fetch: false)
|
12
|
+
records = fetch || !state.nil? ? fetch_submissions(state)
|
13
|
+
: @attributes.submissions
|
15
14
|
map_objects(
|
16
|
-
|
15
|
+
records, Wes::Data::API::Model::Submission
|
17
16
|
)
|
18
17
|
end
|
19
18
|
|
@@ -26,10 +25,10 @@ module Wes
|
|
26
25
|
self
|
27
26
|
end
|
28
27
|
|
29
|
-
def videos
|
30
|
-
|
28
|
+
def videos(fetch: false)
|
29
|
+
records = fetch ? fetch_videos : @attributes.videos
|
31
30
|
map_objects(
|
32
|
-
|
31
|
+
records, Wes::Data::API::Model::Video
|
33
32
|
)
|
34
33
|
end
|
35
34
|
|
@@ -48,17 +47,27 @@ module Wes
|
|
48
47
|
)
|
49
48
|
end
|
50
49
|
|
50
|
+
def fetch_submissions(state)
|
51
|
+
route = add_state(
|
52
|
+
[routes.creator_user, id, routes.submissions].join("/"), state
|
53
|
+
)
|
54
|
+
client.get(route)
|
55
|
+
end
|
56
|
+
|
57
|
+
def fetch_videos
|
58
|
+
route = [routes.creator_user, id, routes.videos].join("/")
|
59
|
+
client.get(route)
|
60
|
+
end
|
61
|
+
|
51
62
|
def id
|
52
63
|
attributes.auth0_id
|
53
64
|
end
|
54
65
|
|
55
66
|
def validate_collectives(input)
|
56
67
|
unless input.is_a?(Array)
|
57
|
-
raise
|
58
|
-
end
|
59
|
-
if input.empty?
|
60
|
-
raise StandardError, "List of collective IDs is empty"
|
68
|
+
raise(ArgumentError, "List of collective IDs must be an array")
|
61
69
|
end
|
70
|
+
raise(StandardError, "List of collective IDs empty") if input.empty?
|
62
71
|
end
|
63
72
|
end
|
64
73
|
end
|
@@ -14,15 +14,20 @@ module Wes
|
|
14
14
|
update(:state => "declined")
|
15
15
|
end
|
16
16
|
|
17
|
-
def videos
|
18
|
-
|
17
|
+
def videos(fetch: false)
|
18
|
+
records = fetch ? fetch_videos : @attributes.videos
|
19
19
|
map_objects(
|
20
|
-
|
20
|
+
records, Wes::Data::API::Model::Video
|
21
21
|
)
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
+
def fetch_videos
|
27
|
+
route = [routes.submission, id, routes.videos].join("/")
|
28
|
+
client.get(route)
|
29
|
+
end
|
30
|
+
|
26
31
|
def update(changes)
|
27
32
|
route = [routes.submission, id].join("/")
|
28
33
|
@attributes = client.put(
|
data/lib/wes/data/api.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wes-data-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|