delivery-sdk-ruby 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/delivery/models/content_item.rb +11 -2
- data/lib/delivery/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b0f167bc8a460612e4ab4b68a799ba17d16c9fb66c23d23a666302f97ae8c06
|
4
|
+
data.tar.gz: 9465cc7835bdf6e14fd562b2aa55d073ed6147806e718e7e31403328674b463f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a2e54efd94331a7fe1264064fcb44c3b5ba01b5663cf4aa4e224026b5a1ebdea4adae7a82156a325d9c4d8f68dcd578bc3ccc61598c4b932ada63c687738585
|
7
|
+
data.tar.gz: 4e5d2fade9a324f1b2e7b63fd887a64d09508a448a7ee83951748ef76cb3ced252165cc095dce48ec4d5ba59dfb1b2acbdfa3a66c10e10fe22c49ef8adb6cbd1
|
data/README.md
CHANGED
@@ -375,11 +375,11 @@ The available methods are:
|
|
375
375
|
|`.with_width`| positive integer, or float between 0 and 1| ?w=200
|
376
376
|
|`.with_height`| positive integer, or float between 0 and 1| ?h=200
|
377
377
|
|`.with_pixel_ratio`| float greater than 0 but less than 5| ?dpr=1.5
|
378
|
-
|`.with_fit_mode`|
|
378
|
+
|`.with_fit_mode`| constants available at `Delivery::Builders::ImageTransformationBuilder` <ul><li>FITMODE_CROP</li><li>FITMODE_CLIP</li><li>FITMODE_SCALE</li></ul>| ?fit=crop
|
379
379
|
|`.with_rect`| 4 integer values representing pixels or floats representing percentages|rect=100,100,0.7,0.7
|
380
380
|
|`.with_focal_point`| 2 floats between 0 and 1 and one integer between 1 and 100| ?fp-x=0.2&fp-y=0.7&fp-z=5
|
381
381
|
|`.with_background_color`| string containing 3, 4, 6, or 8 characters | ?bg=7A0099EE
|
382
|
-
|`.with_output_format`|
|
382
|
+
|`.with_output_format`| constants available at `Delivery::Builders::ImageTransformationBuilder` <ul><li>FORMAT_GIF</li><li>FORMAT_PNG</li><li>FORMAT_PNG8</li><li>FORMAT_JPG</li><li>FORMAT_PJPG</li><li>FORMAT_WEBP</li></ul> | ?fm=webp
|
383
383
|
|`.with_quality`| integer between 1 to 100 | ?quality=50
|
384
384
|
|`.with_lossless`| 'true', 'false', 0, or 1| ?lossless=1
|
385
385
|
|`.with_auto_format_selection`| 'true', 'false', 0, or 1 | ?auto=format
|
@@ -64,7 +64,7 @@ module Delivery
|
|
64
64
|
# element with items from request's modular_content
|
65
65
|
def get_links(code_name)
|
66
66
|
element = get_element code_name
|
67
|
-
filtered =
|
67
|
+
filtered = filter_modular_content element['value']
|
68
68
|
filtered.map { |n| ContentItem.new JSON.parse(JSON.generate(n)), content_link_url_resolver, inline_content_item_resolver }
|
69
69
|
end
|
70
70
|
|
@@ -72,7 +72,7 @@ module Delivery
|
|
72
72
|
# modular_content object with items from request's modular_content
|
73
73
|
def get_inline_items(code_name)
|
74
74
|
element = get_element code_name
|
75
|
-
filtered =
|
75
|
+
filtered = filter_modular_content element['modular_content']
|
76
76
|
filtered.map { |n| ContentItem.new JSON.parse(JSON.generate(n)), content_link_url_resolver, inline_content_item_resolver }
|
77
77
|
end
|
78
78
|
|
@@ -92,5 +92,14 @@ module Delivery
|
|
92
92
|
|
93
93
|
@source['elements'][code_name]
|
94
94
|
end
|
95
|
+
|
96
|
+
def filter_modular_content(codenames)
|
97
|
+
return [] unless codenames.class == Array
|
98
|
+
|
99
|
+
codenames.each_with_object([]) do |codename, items|
|
100
|
+
item = @modular_content.values.find { |i| i['system']['codename'] == codename }
|
101
|
+
items << item if item
|
102
|
+
end
|
103
|
+
end
|
95
104
|
end
|
96
105
|
end
|
data/lib/delivery/version.rb
CHANGED