Skip to content

Commit

Permalink
Hand mapping no more needed
Browse files Browse the repository at this point in the history
  • Loading branch information
programisti committed Jan 27, 2016
1 parent a114d58 commit 1fd3997
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions lib/message/air_shopping_rq.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,4 @@ defmodule NDCEx.Message.AirShoppingRQ do


def yield(params), do: params

defp build(params) do
element(:CoreQuery, [
element(:OriginDestinations, [ origin_destinations(params[:CoreQuery][:OriginDestinations]) ])
])
element(Preferences: config[:Preference])
element(Metadata: metadata)
end

defp origin_destinations(params) do
Enum.map(params, fn el ->
#this because el is tuple :( I need List to work with
item = elem el, 1
element(:OriginDestination, [
element(:Departure, [
element(:AirportCode, item[:Departure][:AirportCode]),
element(:Date, item[:Departure][:Date])
]),
element(:Arrival, [
element(:AirportCode, item[:Arrival][:AirportCode]),
element(:Date, item[:Arrival][:Date])
]),
element(:MarketingCarrierAirline, [
element(:AirlineID, item[:MarketingCarrierAirline][:AirlineID]),
element(:Name, item[:MarketingCarrierAirline][:Name])
])
])
end)
end
end

0 comments on commit 1fd3997

Please sign in to comment.