Skip to content

Commit

Permalink
Merge pull request #29 from open-ndc/dev
Browse files Browse the repository at this point in the history
Hand mapping no more needed
  • Loading branch information
programisti committed Jan 27, 2016
2 parents bed2d10 + 1fd3997 commit b7fb1d2
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 b7fb1d2

Please sign in to comment.