rhino_project_core 0.22.0.beta.14 → 0.22.0.beta.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff53eef49641886195816fcaba9722ceb79ea20dabd8e7dbd95d7b434c669786
4
- data.tar.gz: 4f4cc96ccc36f2fe10cdac07af7a07a1a877981a0dcb42b3af6b52f0cf5a79a8
3
+ metadata.gz: e4e60a13c3423ec6272e6827ef6aa0ef486bfa1f35b5aedb69c2a0e14dc7c71a
4
+ data.tar.gz: 5f720fce7978d5cb8e797eba9fc9625c9ed381fa7195ba8e093a6d0f4e8367f6
5
5
  SHA512:
6
- metadata.gz: d3faed0bcd6862714b54895ee1cfa7213da816ea66ddf1162aa572a56aec0fe08f67147fb4a16fc5a5773da93f10878e1d3fdbe5074bf9030d1a1a81dc52566d
7
- data.tar.gz: 40f6e8e7088fd5cd2f1705ad0d8c3db4267b9b47255d7395f631320d7770aefeb1fd8417459f09ff9ca0321d96be7213b84c6083346e5e74fec671071dd670fb
6
+ metadata.gz: b15fd92cd3e2d699f227326181f0ae26fe5aa6e9ef3970ef3194a71f72d3a2bf33f0c728a73d313285a5d0a2251ec425126eed43270ff23108896c4dae951bbd
7
+ data.tar.gz: a77279c76fcb085ac9293b6781c11711149a9417aa413ef7b440c937df37aec36e0a959f6be0e57c6513575a913606b3ae71f1ce8cfd9fae677903be6247954a
@@ -11,6 +11,8 @@ module Rhino
11
11
  included do
12
12
  attribute :url
13
13
  attribute :url_attachment
14
+ attribute :previews, :json, default: {}
15
+ attribute :representations, :json, default: {}
14
16
  attribute :variants, :json, default: {}
15
17
 
16
18
  rhino_policy :active_storage_attachment
@@ -23,20 +25,35 @@ module Rhino
23
25
  url(attachment, disposition: :attachment)
24
26
  end
25
27
 
26
- def variants
27
- # Not everything may be processed into a variant based on mime type
28
- return unless variable?
28
+ def representations
29
+ return unless representable?
29
30
 
30
31
  record.attachment_reflections[self.name]&.named_variants&.keys&.index_with do |v|
31
- variant = variant(v)
32
+ representation = representation(v)
32
33
 
33
34
  {
34
- url: url(variant),
35
- url_attachment: url_attachment(variant)
35
+ url: url(representation),
36
+ url_attachment: url_attachment(representation)
36
37
  }
37
38
  end
38
39
  end
39
40
 
41
+ # FIXME: Cache for performance
42
+ def previews
43
+ # Not everything may be processed into a preview based on mime type
44
+ return unless previewable?
45
+
46
+ representations
47
+ end
48
+
49
+ # FIXME: Cache for performance
50
+ def variants
51
+ # Not everything may be processed into a variant based on mime type
52
+ return unless variable?
53
+
54
+ representations
55
+ end
56
+
40
57
  def display_name
41
58
  filename.to_s
42
59
  end
@@ -44,7 +61,7 @@ module Rhino
44
61
 
45
62
  class_methods do
46
63
  def readable_properties
47
- super + [ "variants", "signed_id"]
64
+ super + [ "previews", "representations", "variants", "signed_id"]
48
65
  end
49
66
  end
50
67
 
data/lib/rhino/version.rb CHANGED
@@ -10,7 +10,7 @@ module Rhino
10
10
  MAJOR = 0
11
11
  MINOR = 22
12
12
  TINY = 0
13
- PRE = "beta.14"
13
+ PRE = "beta.16"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhino_project_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0.beta.14
4
+ version: 0.22.0.beta.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Rosevear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-06 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails