Skip to content

Instantly share code, notes, and snippets.

@smcabrera
Created December 2, 2015 17:19
Show Gist options
  • Select an option

  • Save smcabrera/b6717a008322d3c3644c to your computer and use it in GitHub Desktop.

Select an option

Save smcabrera/b6717a008322d3c3644c to your computer and use it in GitHub Desktop.
def build_leads_attributes(raw_data, proposal_request)
raw_data['properties'].map do |property|
{
source_property_id: property['id'],
checking_in_on: raw_data['search_params']['check_in'],
checking_out_on: raw_data['search_params']['check_out'],
number_of_guests: raw_data['search_params']['people'],
quoted_price: property['rate'],
currency: property['currency'],
rooms: raw_data['search_params']['rooms'],
source: raw_data['property_group_source'],
maximum_adults_per_room: raw_data['search_params']['maximum_adults_per_room'],
food_and_beverage_budget: raw_data['food_and_beverage']['budget'],
food_and_beverage_required: raw_data['food_and_beverage']['food_and_beverage_required'],
meeting_space_required: raw_data['function_space']['meeting_space'],
event_space_start_date: proposal_request.function_date,
event_space_end_date: proposal_request.function_date,
room_block_attributes: build_room_block_attributes(proposal_request, property['id']),
planner_intent: raw_data['planner_intent'],
guests_pay: proposal_request.guests_pay?,
group_confirmation_code: proposal_request.group_confirmation_code
}.merge(function_space_params raw_data).merge(document_attributes proposal_request)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment