module Contentful::Scheduler::Taskshelper
Public Class Methods
extract_element_ids(input_array)
click to toggle source
# File lib/contentful/scheduler/taskshelper.rb, line 4 def Taskshelper.extract_element_ids input_array ids = [] input_array.each {|item| (ids << (Taskshelper.get_each_field item)).flatten!} return ids.uniq end
get_each_element(key, item)
click to toggle source
# File lib/contentful/scheduler/taskshelper.rb, line 17 def Taskshelper.get_each_element key, item ids = [] if item[key].is_a?(::Array) item[key].each do |i| (!(i["sys"]["linkType"].nil?) && i["sys"]["linkType"] == "Entry") ? ids.push(i["sys"]["id"]) : nil end elsif item[key].is_a?(::Hash) (!(item[key]["sys"]["linkType"].nil?) && item[key]["sys"]["linkType"] == "Entry") ? ids.push(item[key]["sys"]["id"]) : nil end return ids end
get_each_field(item)
click to toggle source
# File lib/contentful/scheduler/taskshelper.rb, line 10 def Taskshelper.get_each_field item ids = [] keys = item["fields"].keys keys.each {|key| (ids << (Taskshelper.get_each_element key, item["fields"])).flatten!} return ids end