woody-decorators 1.3.0 → 1.4.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: 52f14855b14843f535ef5c6b5914056aef009bd7
4
- data.tar.gz: 51655a0a44163a7a491145c3a34781304a48f044
3
+ metadata.gz: 3325e7a7b006e18bf625ccf47d6e99fdd1f16e92
4
+ data.tar.gz: cb72c63c4b830a34d1c2c9b978d9c2e80e0de2c9
5
5
  SHA512:
6
- metadata.gz: 6dd602732233339a5769aba35f3949a4e183ca64bb6891f89eef0d50a48974a14c6914d041211b224b32ef284b2a3493d7d921bc147810ea913a49aaadbcce6d
7
- data.tar.gz: c10c03e20caabea942f0dd6b952fee6c36d6ba0d9b238e8565e7a56475b8ff920d109066b7ff5ccb30b6abeb3573b6bbe76c13c0dc4d85a9c021df3fa26fd27f
6
+ metadata.gz: 0578b195053d4e71130aa14a460c4d3cdaf051dd1514bdecbb75102b67fc186e0275623051fe93266c6167317f6fcb5f0b395976cd094a281006a9e5449f6133
7
+ data.tar.gz: 386d369ce698c24f5272638de9cad29aacad7b9369d32525d099ea5a604e4bbd455da7f8e3b06d54bbb52dcaa974e6b414d96c0853ebb73c621a6746e5170e12
@@ -1,5 +1,5 @@
1
1
  module Woody
2
2
  module Decorators
3
- VERSION = "1.3.0".freeze
3
+ VERSION = "1.4.0".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,35 @@
1
+ require "woody/decorators/base"
2
+
3
+ module Woody
4
+ module Decorators
5
+ class Collective < Base
6
+ def initialize(model, config)
7
+ @config = config
8
+ super(model)
9
+ end
10
+
11
+ def image_src(type = "png")
12
+ [s3_base, suffix(type)].join("/")
13
+ end
14
+
15
+ private
16
+
17
+ def app_config
18
+ @aws_config ||= @config.app
19
+ end
20
+
21
+ def s3_base
22
+ [
23
+ app_config["s3_domain"],
24
+ app_config["public_s3_bucket"],
25
+ "creator/collectives"
26
+ ].join("/")
27
+ end
28
+
29
+ def suffix(type)
30
+ id = @model.id
31
+ id.to_s.size == 1 ? "00#{id}.#{type}" : "0#{id}.#{type}"
32
+ end
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woody-decorators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -150,6 +150,7 @@ files:
150
150
  - lib/woody/decorators/brand_user.rb
151
151
  - lib/woody/decorators/challenge.rb
152
152
  - lib/woody/decorators/challenge_question.rb
153
+ - lib/woody/decorators/collective.rb
153
154
  - lib/woody/decorators/creator_user.rb
154
155
  - lib/woody/decorators/submission.rb
155
156
  - lib/woody/decorators/user.rb