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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1c5e2ae42088842a2ff966c2dbd7d332646466a
4
- data.tar.gz: 6d0302ab48e5f7c9ffaca694fc087b8e4678ccef
3
+ metadata.gz: 26b52491a6d281c7033c5b404b5614464416ab85
4
+ data.tar.gz: d10037fe1dae733a481067673b1d1fa754fcf01c
5
5
  SHA512:
6
- metadata.gz: 46d99c4def159a8735ccde82c82a0883ecd912259a58895677314f6f2856cac44ef5d074cb6d1cd5ea1bb0ae151a79722cac7e415497284c18d183890a4ce5a3
7
- data.tar.gz: f22bfd676a924611d4c5bfd5a9cbeeaef02be68ea9f19d81244663909c506442d852ab38287efa428b8dff4e9b6134fe8f2d81e14a3a1b69a8cd7d5cba9c46ef
6
+ metadata.gz: f9ce779eb7148323d2914afc13a47760f098800c8840c02a2446865e48634557c377cf76ece174ed21320c3f000373f2e939cc09a826f78bcf0ce38ff8e0f258
7
+ data.tar.gz: a7f8c52723791e4e2d2785101d1ea3ce8bfee219270262ce764ca09d0ceec157f37b861e569a7c89cef5989e177463c601d94fe73abc28e6d54e312f8c394ab0
@@ -1,5 +1,5 @@
1
1
  module Woody
2
2
  module Decorators
3
- VERSION = "0.9.0".freeze
3
+ VERSION = "0.10.0".freeze
4
4
  end
5
5
  end
@@ -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
@@ -78,7 +78,7 @@ module Woody
78
78
  def dev_url
79
79
  format(
80
80
  "%s/%s/%s",
81
- aws_config["s3_endpoint"], aws_config["s3_bucket"], @model.url_path
81
+ app_config["s3_domain"], app_config["s3_bucket"], @model.url_path
82
82
  )
83
83
  end
84
84
 
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.9.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-20 00:00:00.000000000 Z
11
+ date: 2016-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler