Getting parent relationship
Some notes:


It would be debatable whether it's good practice to have arguments which may contain either single elements or collections. 
If you convert whatever you get to an array (using Array), there is no need to repeat code.
Don't use each + &lt;&lt; (imperative), use map + compact (functional).


I'd write:

def get_parent(relationship_item_or_collection)
  Array(relationship_item_or_collection).map do |relationship|
    if relationship[:relationship_roles][:relationship_role][:to_role][:name] == type
      relationship[:party][:party_id][:id]
    end
  end.compact
end