woody-decorators 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/woody/decorators.rb +1 -1
- data/lib/woody/decorators/brand_user.rb +13 -0
- data/lib/woody/decorators/creator_user.rb +3 -49
- data/lib/woody/decorators/user.rb +53 -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: 36b86280fbe3d84441f7c4b0e51edafb1f1d627e
|
4
|
+
data.tar.gz: 30baaa67c7e571ec1b6d30ee0e0a9a8454c812ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea384ab46dda118aadb52ac0ce16faf7da0c2efc543554675a27d93fc08e2761d085e285d82f4d771ec1d6e64853536cbc89408785a9ab43c349d8a717938bc7
|
7
|
+
data.tar.gz: ed4776ddb72f58bc58d7838922aa986298448f9f76e5c68bbc52fa027c419215e32936011d54ca13fb2b29ef36cf5cee3b88e3ba85df3252a03c09be11ecb606
|
data/lib/woody/decorators.rb
CHANGED
@@ -1,36 +1,9 @@
|
|
1
|
-
require "woody/decorators/
|
1
|
+
require "woody/decorators/user"
|
2
2
|
|
3
3
|
module Woody
|
4
4
|
module Decorators
|
5
|
-
class CreatorUser <
|
6
|
-
|
7
|
-
@config = OpenStruct.new(config)
|
8
|
-
super(model)
|
9
|
-
end
|
10
|
-
|
11
|
-
def avatar
|
12
|
-
@model.onboarded ? user_avatar : default_avatar
|
13
|
-
end
|
14
|
-
|
15
|
-
def exist?
|
16
|
-
!@model.nil?
|
17
|
-
end
|
18
|
-
|
19
|
-
def first_name
|
20
|
-
@model.first_name.capitalize
|
21
|
-
end
|
22
|
-
|
23
|
-
def full_name
|
24
|
-
[first_name, last_name].join(" ")
|
25
|
-
end
|
26
|
-
|
27
|
-
def id
|
28
|
-
@model.auth0_id
|
29
|
-
end
|
30
|
-
|
31
|
-
def last_name
|
32
|
-
@model.last_name.capitalize
|
33
|
-
end
|
5
|
+
class CreatorUser < User
|
6
|
+
DEFAULT_AVATARS = 5
|
34
7
|
|
35
8
|
def location
|
36
9
|
@model.location.capitalize
|
@@ -39,25 +12,6 @@ module Woody
|
|
39
12
|
def portfolio_url
|
40
13
|
format("/u/%s", @model.portfolio_username)
|
41
14
|
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
DEFAULT_AVATARS = 5
|
46
|
-
|
47
|
-
def default_avatar
|
48
|
-
r = rand(1..DEFAULT_AVATARS)
|
49
|
-
format(
|
50
|
-
"%s/%s/%s/00%d.png",
|
51
|
-
@config.s3_domain, @config.s3_bucket, @config.s3_avatar_path, r
|
52
|
-
)
|
53
|
-
end
|
54
|
-
|
55
|
-
def user_avatar
|
56
|
-
format(
|
57
|
-
"%s/%s/%s/%s.png",
|
58
|
-
@config.s3_domain, @config.s3_bucket, @config.s3_avatar_path, id
|
59
|
-
)
|
60
|
-
end
|
61
15
|
end
|
62
16
|
end
|
63
17
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "woody/decorators/base"
|
2
|
+
|
3
|
+
module Woody
|
4
|
+
module Decorators
|
5
|
+
class User < Base
|
6
|
+
def initialize(model, config)
|
7
|
+
@config = OpenStruct.new(config)
|
8
|
+
super(model)
|
9
|
+
end
|
10
|
+
|
11
|
+
def avatar
|
12
|
+
@model.onboarded ? user_avatar : default_avatar
|
13
|
+
end
|
14
|
+
|
15
|
+
def exist?
|
16
|
+
!@model.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def first_name
|
20
|
+
@model.first_name.capitalize
|
21
|
+
end
|
22
|
+
|
23
|
+
def full_name
|
24
|
+
[first_name, last_name].join(" ")
|
25
|
+
end
|
26
|
+
|
27
|
+
def id
|
28
|
+
@model.auth0_id
|
29
|
+
end
|
30
|
+
|
31
|
+
def last_name
|
32
|
+
@model.last_name.capitalize
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def default_avatar
|
38
|
+
r = rand(1..DEFAULT_AVATARS)
|
39
|
+
format(
|
40
|
+
"%s/%s/%s/00%d.png",
|
41
|
+
@config.s3_domain, @config.s3_bucket, @config.s3_avatar_path, r
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def user_avatar
|
46
|
+
format(
|
47
|
+
"%s/%s/%s/%s.png",
|
48
|
+
@config.s3_domain, @config.s3_bucket, @config.s3_avatar_path, id
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
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: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -147,10 +147,12 @@ files:
|
|
147
147
|
- lib/woody/decorators.rb
|
148
148
|
- lib/woody/decorators/base.rb
|
149
149
|
- lib/woody/decorators/brand.rb
|
150
|
+
- lib/woody/decorators/brand_user.rb
|
150
151
|
- lib/woody/decorators/challenge.rb
|
151
152
|
- lib/woody/decorators/challenge_question.rb
|
152
153
|
- lib/woody/decorators/creator_user.rb
|
153
154
|
- lib/woody/decorators/submission.rb
|
155
|
+
- lib/woody/decorators/user.rb
|
154
156
|
- lib/woody/decorators/video.rb
|
155
157
|
- lib/woody/decorators/video_transcoding_state.rb
|
156
158
|
- woody-decorators.gemspec
|