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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3af4e9e0b215b8ddfad6bef517543de085c0cfc86bd3da5e8139f63fa3c71d4c
4
- data.tar.gz: 52f4765ebccf5b02a7c9c1410500a5e03022b789957c31c5d195150e83134ab3
3
+ metadata.gz: 1b0f167bc8a460612e4ab4b68a799ba17d16c9fb66c23d23a666302f97ae8c06
4
+ data.tar.gz: 9465cc7835bdf6e14fd562b2aa55d073ed6147806e718e7e31403328674b463f
5
5
  SHA512:
6
- metadata.gz: 3d09788c7f7cae943c864232babe39eee5d47c3c8f9857e3b4c2b6ce7fa19dca55074b0d170fb105574ea20a5a375bbc31bc35503c1dbcd76906e2ba78fc976b
7
- data.tar.gz: 36a186c3972f83f5836ca29dedd28c6deeed6e7ee4b0fe97bb0478c9dcec5dba55d51906708dacf5014cbd187bed2989ed6bd5a26a6f3ca5788cc1b4597bc187
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`| contstants available at Delivery::Builders::ImageTransformationBuilder <ul><li>FITMODE_CROP</li><li>FITMODE_CLIP</li><li>FITMODE_SCALE</li></ul>| ?fit=crop
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`| contstants 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
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 = @modular_content.values.select { |item| element['value'].include?(item['system']['codename']) }
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 = @modular_content.values.select { |item| element['modular_content'].include?(item['system']['codename']) }
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
@@ -1,3 +1,3 @@
1
1
  module Delivery
2
- VERSION = '0.12.0'.freeze
2
+ VERSION = '0.12.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delivery-sdk-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dugre