woody-decorators 1.4.1 → 2.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/woody/decorators/brand_user.rb +1 -5
- data/lib/woody/decorators/challenge.rb +3 -5
- data/lib/woody/decorators/challenge_question.rb +3 -3
- data/lib/woody/decorators/creator_user.rb +8 -2
- data/lib/woody/decorators/user.rb +17 -8
- data/lib/woody/decorators/video.rb +3 -1
- data/lib/woody/decorators.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: 96f41a3deba0d2e3b2b596713003fbfdca6f13d5
|
|
4
|
+
data.tar.gz: 5bc6fd4b221b075a661a86cddef0b05875b87fea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b5d1bc5d6eb74bc24c7dd679534c3a2b6e3599bf7ad0e341708e7a27652938f2038fce7d143b23a720b3f3d67bde6153eb506a6298daefba8f646a3aa68aae9
|
|
7
|
+
data.tar.gz: 3fb7ca4ffa4143704b38836fdb08fba48e29a4c32522b655be025e83a01a7b1030cd9cd6508f3c8b31123969ba861157cca7d83c4db52aaf3120cdcd6702a354
|
|
@@ -12,7 +12,7 @@ module Woody
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def concept_questions
|
|
15
|
-
questions.fetch("concept"
|
|
15
|
+
questions.fetch("concept") { {} }
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def draft?
|
|
@@ -25,7 +25,7 @@ module Woody
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def essentials_questions
|
|
28
|
-
questions.fetch("essentials"
|
|
28
|
+
questions.fetch("essentials") { {} }
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def exist?
|
|
@@ -57,9 +57,7 @@ module Woody
|
|
|
57
57
|
def questions
|
|
58
58
|
@questions ||= Wes::Data::API::Challenge.questions.map do |question|
|
|
59
59
|
ChallengeQuestion.new(question, @model.answers)
|
|
60
|
-
end.group_by
|
|
61
|
-
question.section
|
|
62
|
-
end
|
|
60
|
+
end.group_by(&:section)
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
def brand
|
|
@@ -4,8 +4,8 @@ module Woody
|
|
|
4
4
|
module Decorators
|
|
5
5
|
class ChallengeQuestion < Base
|
|
6
6
|
def initialize(model, answers)
|
|
7
|
-
super(model)
|
|
8
7
|
@answers = answers
|
|
8
|
+
super(model)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def answer
|
|
@@ -13,8 +13,8 @@ module Woody
|
|
|
13
13
|
answer_item ? answer_item.answer : ""
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def
|
|
17
|
-
answer_for_question(@model.id)
|
|
16
|
+
def answered?
|
|
17
|
+
answer_for_question(@model.id).nil? ? false : true
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def text_type?
|
|
@@ -3,8 +3,8 @@ require "woody/decorators/user"
|
|
|
3
3
|
module Woody
|
|
4
4
|
module Decorators
|
|
5
5
|
class CreatorUser < User
|
|
6
|
-
def
|
|
7
|
-
|
|
6
|
+
def avatar
|
|
7
|
+
super("creator")
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def location
|
|
@@ -14,6 +14,12 @@ module Woody
|
|
|
14
14
|
def portfolio_url
|
|
15
15
|
format("/u/%s", @model.portfolio_username)
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
protected
|
|
19
|
+
|
|
20
|
+
def default_avatars
|
|
21
|
+
5
|
|
22
|
+
end
|
|
17
23
|
end
|
|
18
24
|
end
|
|
19
25
|
end
|
|
@@ -8,8 +8,10 @@ module Woody
|
|
|
8
8
|
super(model)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
def avatar
|
|
12
|
-
|
|
11
|
+
def avatar(platform)
|
|
12
|
+
invalid_platform(platform) unless %w(creator brands).include?(platform)
|
|
13
|
+
return user_avatar(platform) if platform == "brands"
|
|
14
|
+
@model.onboarded ? user_avatar(platform) : default_avatar(platform)
|
|
13
15
|
end
|
|
14
16
|
|
|
15
17
|
def exist?
|
|
@@ -34,18 +36,25 @@ module Woody
|
|
|
34
36
|
|
|
35
37
|
private
|
|
36
38
|
|
|
37
|
-
def default_avatar
|
|
39
|
+
def default_avatar(platform)
|
|
38
40
|
r = rand(1..default_avatars)
|
|
39
41
|
format(
|
|
40
|
-
"%s/%s/%s/00%d.png",
|
|
41
|
-
@config.s3_domain, @config.public_s3_bucket,
|
|
42
|
+
"%s/%s/%s/avatars/00%d.png",
|
|
43
|
+
@config.s3_domain, @config.public_s3_bucket, platform, r
|
|
42
44
|
)
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
def
|
|
47
|
+
def invalid_platform(platform)
|
|
48
|
+
raise(
|
|
49
|
+
ArgumentError,
|
|
50
|
+
"'#{platform}' is not a supported platform"
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def user_avatar(platform)
|
|
46
55
|
format(
|
|
47
|
-
"%s/%s/%s/%s.png",
|
|
48
|
-
@config.s3_domain, @config.public_s3_bucket,
|
|
56
|
+
"%s/%s/%s/avatars/%s.png",
|
|
57
|
+
@config.s3_domain, @config.public_s3_bucket, platform, id
|
|
49
58
|
)
|
|
50
59
|
end
|
|
51
60
|
end
|
data/lib/woody/decorators.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: woody-decorators
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.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-06-
|
|
11
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|