Module: AbstractFlight

Includes:
HTTParty
Included in:
FiveonebookFlight
Defined in:
lib/flight_info/abstract_flight.rb

Instance Method Summary collapse

Instance Method Details

#query(method_name, args) ⇒ Object



7
8
9
# File 'lib/flight_info/abstract_flight.rb', line 7

def query(method_name, args)
  post(method_name, headers: body_content(args), body: build_query(args).to_json, format: :json)
end

#translateFlight(hash, translate) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/flight_info/abstract_flight.rb', line 11

def translateFlight(hash, translate)
  new_hash = Marshal.load(Marshal.dump(hash))
  hash.each do |key, _value|
    translateFlight(hash[key], translate) if hash[key].is_a? Hash
    new_hash[translate[key]] = new_hash.delete key
  end
  hash = new_hash
end