From 519ce8853be5179352b72e98b80c75de2761b2ed Mon Sep 17 00:00:00 2001 From: Judy Ngai Date: Tue, 29 Mar 2016 10:28:51 -0400 Subject: [PATCH] grammar change and changed spec accordingly --- app/models/agents/google_flights_agent.rb | 10 +++++----- spec/models/agents/google_flights_spec.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/agents/google_flights_agent.rb b/app/models/agents/google_flights_agent.rb index bd5b016b..350b6e18 100644 --- a/app/models/agents/google_flights_agent.rb +++ b/app/models/agents/google_flights_agent.rb @@ -16,7 +16,7 @@ module Agents All the default options must exist. For `infantInSeatCount`, `infantInLapCount`, `seniorCount`, and `childCount`, leave them to the default value of `0` if its not necessary. - Make sure `date` and `returned_date` is in this type of date format `YYYY-MO-DAY`. + Make sure `date` and `return_date` is in this type of date format `YYYY-MM-DAY`. You can choose one way ticket only by setting `roundtrip` to `false`. @@ -58,7 +58,7 @@ module Agents 'infantInSeatCount' => 0, 'infantInLapCount'=> 0, 'seniorCount'=> 0, - 'returned_date' => '2016-04-18', + 'return_date' => '2016-04-18', 'roundtrip' => true, 'solutions'=> 3 } @@ -74,7 +74,7 @@ module Agents form_configurable :infantInLapCount form_configurable :seniorCount form_configurable :roundtrip, type: :boolean - form_configurable :returned_date, type: :string + form_configurable :return_date, type: :string form_configurable :solutions def validate_options @@ -88,7 +88,7 @@ module Agents errors.add(:base, "Infant In Lap Count") unless options['infantInLapCount'].present? errors.add(:base, "Senior Count must exist") unless options['seniorCount'].present? errors.add(:base, "Solutions must exist") unless options['solutions'].present? - errors.add(:base, "Returned Date must exist") if options["returned_date"].blank? && boolify(options['roundtrip']) + errors.add(:base, "Returned Date must exist") if options["return_date"].blank? && boolify(options['roundtrip']) end def working? @@ -101,7 +101,7 @@ module Agents def post_params if round_trip? - post_params = {:request=>{:passengers=>{:kind=>"qpxexpress#passengerCounts", :adultCount=> interpolated["adultCount"], :childCount=> interpolated["childCount"], :infantInLapCount=>interpolated["infantInLapCount"], :infantInSeatCount=>interpolated['infantInSeatCount'], :seniorCount=>interpolated["seniorCount"]}, :slice=>[ {:origin=> interpolated["origin"].to_s , :destination=> interpolated["destination"].to_s , :date=> interpolated["date"].to_s }, {:origin=> interpolated["destination"].to_s , :destination=> interpolated["origin"].to_s , :date=> interpolated["returned_date"].to_s } ], :solutions=> interpolated["solutions"]}} + post_params = {:request=>{:passengers=>{:kind=>"qpxexpress#passengerCounts", :adultCount=> interpolated["adultCount"], :childCount=> interpolated["childCount"], :infantInLapCount=>interpolated["infantInLapCount"], :infantInSeatCount=>interpolated['infantInSeatCount'], :seniorCount=>interpolated["seniorCount"]}, :slice=>[ {:origin=> interpolated["origin"].to_s , :destination=> interpolated["destination"].to_s , :date=> interpolated["date"].to_s }, {:origin=> interpolated["destination"].to_s , :destination=> interpolated["origin"].to_s , :date=> interpolated["return_date"].to_s } ], :solutions=> interpolated["solutions"]}} else post_params = {:request=>{:passengers=>{:kind=>"qpxexpress#passengerCounts", :adultCount=> interpolated["adultCount"], :childCount=> interpolated["childCount"], :infantInLapCount=>interpolated["infantInLapCount"], :infantInSeatCount=>interpolated['infantInSeatCount'], :seniorCount=>interpolated["seniorCount"]}, :slice=>[{:kind=>"qpxexpress#sliceInput", :origin=> interpolated["origin"].to_s , :destination=> interpolated["destination"].to_s , :date=> interpolated["date"].to_s }], :solutions=> interpolated["solutions"]}} end diff --git a/spec/models/agents/google_flights_spec.rb b/spec/models/agents/google_flights_spec.rb index e9c5eb3f..a1cec9db 100644 --- a/spec/models/agents/google_flights_spec.rb +++ b/spec/models/agents/google_flights_spec.rb @@ -90,7 +90,7 @@ describe Agents::GoogleFlightsAgent do it "should require Returned Date" do @checker.options['roundtrip'] = true - @checker.options['returned_date'] = nil + @checker.options['return_date'] = nil expect(@checker).not_to be_valid end end