woody-decorators 0.9.0 → 0.10.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/creator_user.rb +49 -4
- data/lib/woody/decorators/video.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: 26b52491a6d281c7033c5b404b5614464416ab85
|
4
|
+
data.tar.gz: d10037fe1dae733a481067673b1d1fa754fcf01c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9ce779eb7148323d2914afc13a47760f098800c8840c02a2446865e48634557c377cf76ece174ed21320c3f000373f2e939cc09a826f78bcf0ce38ff8e0f258
|
7
|
+
data.tar.gz: a7f8c52723791e4e2d2785101d1ea3ce8bfee219270262ce764ca09d0ceec157f37b861e569a7c89cef5989e177463c601d94fe73abc28e6d54e312f8c394ab0
|
data/lib/woody/decorators.rb
CHANGED
@@ -3,16 +3,61 @@ require "woody/decorators/base"
|
|
3
3
|
module Woody
|
4
4
|
module Decorators
|
5
5
|
class CreatorUser < 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
|
+
|
6
23
|
def full_name
|
7
|
-
[
|
8
|
-
@model.first_name,
|
9
|
-
@model.last_name
|
10
|
-
].map(&:capitalize).join(" ")
|
24
|
+
[first_name, last_name].join(" ")
|
11
25
|
end
|
12
26
|
|
13
27
|
def id
|
14
28
|
@model.auth0_id
|
15
29
|
end
|
30
|
+
|
31
|
+
def last_name
|
32
|
+
@model.last_name.capitalize
|
33
|
+
end
|
34
|
+
|
35
|
+
def location
|
36
|
+
@model.location.capitalize
|
37
|
+
end
|
38
|
+
|
39
|
+
def portfolio_url
|
40
|
+
format("/u/%s", @model.portfolio_username)
|
41
|
+
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
|
16
61
|
end
|
17
62
|
end
|
18
63
|
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.10.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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|