Skip to content

Instantly share code, notes, and snippets.

@pazaricha
Forked from royzinn/flight.rb
Last active October 13, 2016 11:51
Show Gist options
  • Save pazaricha/24430ce0bee84bc4f29054f3c97a25fa to your computer and use it in GitHub Desktop.
Save pazaricha/24430ce0bee84bc4f29054f3c97a25fa to your computer and use it in GitHub Desktop.
class FlightManager
def self.search(search_criteria)
provider = search_criteria[:provider].camelize
flights = "FlightProviders::#{provider}".constantize.search_flights(search_criteria)
"FilghtsResponseAdapter::#{provider}".constantize.normazlize(flights)
end
end
## Have one of these for each unique provider/response
module FilghtsResponseAdapter
class AlAlReponseAdapter
def self.normalize(flights_arr)
## Enter custom here to normalize data for this specific provider
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment