quicktravel_client 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.ruby-version +1 -1
- data/.travis.yml +14 -2
- data/CHANGELOG.md +34 -3
- data/Gemfile +0 -3
- data/Rakefile +0 -6
- data/examples/login_example.rb +1 -1
- data/gemfiles/rails4.gemfile +9 -0
- data/lib/quick_travel.rb +2 -1
- data/lib/quick_travel/accommodation.rb +1 -15
- data/lib/quick_travel/adapter.rb +98 -67
- data/lib/quick_travel/{adapter_exception.rb → adapter_error.rb} +1 -1
- data/lib/quick_travel/address.rb +2 -7
- data/lib/quick_travel/adjustment.rb +0 -2
- data/lib/quick_travel/bed_configuration.rb +0 -1
- data/lib/quick_travel/bed_requirement.rb +0 -1
- data/lib/quick_travel/booking.rb +22 -46
- data/lib/quick_travel/cache.rb +8 -14
- data/lib/quick_travel/checkout.rb +1 -1
- data/lib/quick_travel/client.rb +2 -4
- data/lib/quick_travel/client_type.rb +2 -1
- data/lib/quick_travel/connection_error.rb +1 -1
- data/lib/quick_travel/constants.rb +0 -1
- data/lib/quick_travel/contact.rb +0 -1
- data/lib/quick_travel/country.rb +0 -3
- data/lib/quick_travel/document.rb +0 -2
- data/lib/quick_travel/document_group.rb +0 -2
- data/lib/quick_travel/location.rb +0 -2
- data/lib/quick_travel/party.rb +7 -12
- data/lib/quick_travel/passenger.rb +0 -1
- data/lib/quick_travel/passenger_price_break.rb +0 -2
- data/lib/quick_travel/passenger_type.rb +0 -2
- data/lib/quick_travel/payment.rb +0 -3
- data/lib/quick_travel/payment_type.rb +4 -13
- data/lib/quick_travel/price_changes.rb +3 -0
- data/lib/quick_travel/price_changes/booking_price_change.rb +30 -0
- data/lib/quick_travel/price_changes/price_change.rb +23 -0
- data/lib/quick_travel/{discounts/discount_tree.rb → price_changes/price_change_tree.rb} +12 -8
- data/lib/quick_travel/product.rb +15 -28
- data/lib/quick_travel/product_type.rb +4 -16
- data/lib/quick_travel/property.rb +4 -20
- data/lib/quick_travel/property_facility.rb +0 -1
- data/lib/quick_travel/property_type.rb +2 -14
- data/lib/quick_travel/region.rb +0 -9
- data/lib/quick_travel/reservation.rb +0 -21
- data/lib/quick_travel/resource.rb +7 -28
- data/lib/quick_travel/room_facility.rb +0 -1
- data/lib/quick_travel/route.rb +9 -25
- data/lib/quick_travel/route_stop.rb +0 -1
- data/lib/quick_travel/service.rb +2 -1
- data/lib/quick_travel/status.rb +23 -0
- data/lib/quick_travel/trip.rb +0 -1
- data/lib/quick_travel/vehicle.rb +2 -4
- data/lib/quick_travel/vehicle_type.rb +0 -3
- data/lib/quick_travel/version.rb +1 -1
- data/quicktravel_client.gemspec +4 -4
- data/spec/booking_spec.rb +24 -0
- data/spec/discounts_spec.rb +69 -69
- data/spec/passenger_type_spec.rb +30 -0
- data/spec/payment_type_spec.rb +10 -0
- data/spec/product_spec.rb +52 -21
- data/spec/product_type_spec.rb +19 -0
- data/spec/property_spec.rb +83 -0
- data/spec/region_spec.rb +1 -1
- data/spec/reservation_spec.rb +3 -2
- data/spec/resource_spec.rb +31 -7
- data/spec/route_spec.rb +118 -0
- data/spec/spec_helper.rb +18 -25
- data/spec/status_spec.rb +9 -0
- data/spec/support/cassettes/booking_create.yml +39 -33
- data/spec/support/cassettes/booking_documents.yml +36 -30
- data/spec/support/cassettes/booking_price_changes.yml +66 -0
- data/spec/support/cassettes/booking_show.yml +38 -32
- data/spec/support/cassettes/booking_update.yml +74 -62
- data/spec/support/cassettes/booking_with_documents.yml +88 -76
- data/spec/support/cassettes/booking_with_nested_attributes.yml +128 -110
- data/spec/support/cassettes/booking_with_price_changes.yml +86 -0
- data/spec/support/cassettes/countries.yml +140 -0
- data/spec/support/cassettes/country_all.yml +36 -30
- data/spec/support/cassettes/create_reservation_fail.yml +32 -27
- data/spec/support/cassettes/create_reservation_with_booking.yml +40 -34
- data/spec/support/cassettes/passenger_all.yml +36 -30
- data/spec/support/cassettes/payment_info.yml +61 -0
- data/spec/support/cassettes/product_date_range_bookability.yml +61 -59
- data/spec/support/cassettes/product_show.yml +42 -32
- data/spec/support/cassettes/product_show_as_agent.yml +63 -0
- data/spec/support/cassettes/product_type_all.yml +53 -0
- data/spec/support/cassettes/property.yml +66 -0
- data/spec/support/cassettes/region_show.yml +36 -30
- data/spec/support/cassettes/reservation_with_extra_picks.yml +137 -110
- data/spec/support/cassettes/resource_fare_bases.yml +47 -78
- data/spec/support/cassettes/resource_product_type.yml +63 -0
- data/spec/support/cassettes/resource_show.yml +37 -31
- data/spec/support/cassettes/resource_with_price.yml +63 -0
- data/spec/support/cassettes/route_all.yml +65 -0
- data/spec/support/cassettes/tenant_switcher.yml +109 -0
- data/spec/support/coverage_loader.rb +26 -0
- data/spec/tenant_spec.rb +28 -0
- metadata +106 -115
- data/bootstrap/boot.rb +0 -4
- data/lib/quick_travel/discounts.rb +0 -3
- data/lib/quick_travel/discounts/booking_discount.rb +0 -18
- data/lib/quick_travel/discounts/discount.rb +0 -21
- data/spec/support/cassettes/booking_create_legacy.yml +0 -50
- data/spec/support/cassettes/booking_discounts.yml +0 -53
- data/spec/support/cassettes/booking_with_discounts.yml +0 -72
- data/spec/support/cassettes/region_index.yml +0 -48
@@ -0,0 +1,23 @@
|
|
1
|
+
module QuickTravel
|
2
|
+
module PriceChanges
|
3
|
+
class PriceChange
|
4
|
+
attr_reader :target
|
5
|
+
attr_reader :original_price, :changed_price, :price_change, :reason
|
6
|
+
|
7
|
+
delegate :positive?, :negative?, to: :price_change
|
8
|
+
|
9
|
+
def initialize(attrs = {})
|
10
|
+
@target = OpenStruct.new(attrs.fetch('target').slice('id', 'type'))
|
11
|
+
|
12
|
+
@original_price = Money.new(attrs.fetch('original_price_in_cents'))
|
13
|
+
@changed_price = Money.new(attrs.fetch('changed_price_in_cents'))
|
14
|
+
@price_change = Money.new(attrs.fetch('price_change_in_cents'))
|
15
|
+
@reason = attrs.fetch('reason')
|
16
|
+
end
|
17
|
+
|
18
|
+
def applied_on?(id, type = 'Reservation')
|
19
|
+
@target.type == type && @target.id == id
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,24 +1,28 @@
|
|
1
1
|
module QuickTravel
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module PriceChanges
|
3
|
+
class PriceChangeTree < PriceChange
|
4
4
|
attr_reader :root, :children
|
5
5
|
|
6
6
|
def initialize(attrs = {})
|
7
7
|
super(attrs)
|
8
|
-
@root =
|
8
|
+
@root = PriceChange.new(attrs['root'])
|
9
9
|
@children = attrs.fetch('children', []).map do |child_attrs|
|
10
|
-
|
10
|
+
PriceChangeTree.new(child_attrs)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def price_change_on(id, type = 'Reservation')
|
15
15
|
return @root if applied_on?(id, type)
|
16
|
-
find_and_return_on_children { |child| child.
|
16
|
+
find_and_return_on_children { |child| child.price_change_on(id, type) }
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def total_price_change_on(id, type = 'Reservation')
|
20
20
|
return self if applied_on?(id, type)
|
21
|
-
find_and_return_on_children { |child| child.
|
21
|
+
find_and_return_on_children { |child| child.total_price_change_on(id, type) }
|
22
|
+
end
|
23
|
+
|
24
|
+
def roots
|
25
|
+
[@root] + @children.flat_map(&:roots)
|
22
26
|
end
|
23
27
|
|
24
28
|
private
|
data/lib/quick_travel/product.rb
CHANGED
@@ -2,23 +2,7 @@ require 'quick_travel/adapter'
|
|
2
2
|
|
3
3
|
module QuickTravel
|
4
4
|
class Product < Adapter
|
5
|
-
|
6
|
-
:description,
|
7
|
-
:capacity,
|
8
|
-
:available_capacity,
|
9
|
-
:available,
|
10
|
-
:error_message
|
11
|
-
|
12
|
-
attr_accessor :price # money_json(bookable_product.price)
|
13
|
-
|
14
|
-
attr_accessor :reservation_attributes
|
15
|
-
attr_accessor :image # is it url? dunno => json.image bookable_product.image
|
16
|
-
# {url: image_url, desc: image_desc}
|
17
|
-
|
18
|
-
attr_accessor :is_assigned # is it an assigned product -- i.e. reserved...
|
19
|
-
# useful only for extras when going through reservations api
|
20
|
-
|
21
|
-
attr_accessor :extras # more products
|
5
|
+
attr_reader :error_message
|
22
6
|
|
23
7
|
self.api_base = '/api/products'
|
24
8
|
|
@@ -28,8 +12,12 @@ module QuickTravel
|
|
28
12
|
# passenger_types: {<passenger_type_id> => <num_pax>, ...},
|
29
13
|
# date_range: {start_date: <date>, end_date: <date>}
|
30
14
|
def self.find(id, params = {})
|
31
|
-
|
32
|
-
|
15
|
+
if params[:passenger_type_numbers].blank?
|
16
|
+
fail ArgumentError, 'Product#find requires passenger_type_numbers'
|
17
|
+
end
|
18
|
+
if params[:date_range].blank?
|
19
|
+
fail ArgumentError, 'Product#find requires date_range'
|
20
|
+
end
|
33
21
|
super
|
34
22
|
end
|
35
23
|
|
@@ -93,10 +81,9 @@ module QuickTravel
|
|
93
81
|
products_by_resource_id_and_date
|
94
82
|
end
|
95
83
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
:pricing_details_without_rules
|
84
|
+
# needed as captain cook grid cell exepcts them to be defined
|
85
|
+
attr_reader :pricing_details_for_rack_rate,
|
86
|
+
:pricing_details_without_rules
|
100
87
|
|
101
88
|
def id
|
102
89
|
@reservation_attributes['resource_id']
|
@@ -142,10 +129,11 @@ module QuickTravel
|
|
142
129
|
end
|
143
130
|
|
144
131
|
class PricingDetails < Adapter
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
132
|
+
# define to avoid auto definition as money getter
|
133
|
+
# due to _in_cents postfix
|
134
|
+
def adjustments_to_apply_in_cents
|
135
|
+
@adjustments_to_apply_in_cents
|
136
|
+
end
|
149
137
|
|
150
138
|
def price_per_pax_type=(pax_type_hash)
|
151
139
|
@price_per_pax_type = convert_pax_type_hash(pax_type_hash)
|
@@ -160,6 +148,5 @@ module QuickTravel
|
|
160
148
|
end
|
161
149
|
|
162
150
|
class PricePerPaxType < Adapter
|
163
|
-
attr_accessor :amount_in_cents
|
164
151
|
end
|
165
152
|
end
|
@@ -1,21 +1,9 @@
|
|
1
|
+
require 'quick_travel/adapter'
|
2
|
+
|
1
3
|
module QuickTravel
|
2
4
|
class ProductType < Adapter
|
3
|
-
|
4
|
-
|
5
|
-
attr_accessor :individual_tickets, :mark_up_cents, :mark_up_definition_id, :mark_up_percent, :mark_up_rack_from_cost, :mark_up_rounding_cents
|
6
|
-
attr_accessor :mark_up_rounding_direction, :maximum_passengers_online, :measure_units_by_pax_count, :multi_leg, :name, :no_ticket
|
7
|
-
attr_accessor :only_bookable_with_accommodation, :overview_template_fields, :prompt_for_pick_up_drop_off, :resource_class_name, :rule_set_id,
|
8
|
-
:can_have_dates,
|
9
|
-
:can_have_quantity,
|
10
|
-
:needs_passengers
|
11
|
-
|
12
|
-
self.api_base = '/product_types'
|
13
|
-
|
14
|
-
def self.all
|
15
|
-
QuickTravel::Cache.cache 'all_product_types' do
|
16
|
-
super
|
17
|
-
end
|
18
|
-
end
|
5
|
+
self.api_base = '/api/product_types'
|
6
|
+
self.lookup = true
|
19
7
|
|
20
8
|
def route
|
21
9
|
Route.first(id)
|
@@ -3,29 +3,12 @@ require 'quick_travel/property_facility'
|
|
3
3
|
|
4
4
|
module QuickTravel
|
5
5
|
class Property < Adapter
|
6
|
-
|
7
|
-
attr_accessor :location_id, :notes, :star_rating, :tourism_accredited, :availability, :on_request
|
8
|
-
attr_accessor :minimum_available_price_in_cents
|
9
|
-
attr_accessor :graphic # required in property search object
|
10
|
-
attr_accessor :boundary_start, :boundary_end, :season_id # added in API 3.8.*
|
11
|
-
attr_accessor :minimum_bookable_duration
|
12
|
-
attr_accessor :maximum_occupancy
|
13
|
-
attr_accessor :location_name, :region_names, :error
|
14
|
-
|
15
|
-
attr_reader :accommodations
|
16
|
-
|
17
|
-
money :minimum_available_price
|
6
|
+
attr_reader :error
|
18
7
|
|
19
8
|
def accommodations=(hash_array)
|
20
9
|
@accommodations = hash_array.map { |accommodation_hash| Accommodation.new(accommodation_hash) }
|
21
10
|
end
|
22
11
|
|
23
|
-
# This method returns first object of Property based on property id from QuickTravel
|
24
|
-
def self.first(id, options = {})
|
25
|
-
fail ArgumentError.new('Must Specify valid property id') if id.blank? || id.class != Fixnum
|
26
|
-
generic_first("/api/properties/#{id}.json", options)
|
27
|
-
end
|
28
|
-
|
29
12
|
# This method returns all objects of property from QuickTravel that match
|
30
13
|
#
|
31
14
|
# location_id is compulsory param
|
@@ -41,8 +24,9 @@ module QuickTravel
|
|
41
24
|
|
42
25
|
def self.load_with_pricing(id, options)
|
43
26
|
# Find property 'standard' way -- finds price for whole duration
|
44
|
-
property
|
45
|
-
|
27
|
+
fail ArgumentError.new('Must Specify valid property id') if id.blank? || id.class != Fixnum
|
28
|
+
property = find_all!("/api/properties/#{id}.json", options).first
|
29
|
+
first_travel_date = options.fetch(:product).fetch(:first_travel_date)
|
46
30
|
property.accommodations.each do |accommodation|
|
47
31
|
accommodation.minimum_nightly_price = accommodation.nightly_price_on first_travel_date
|
48
32
|
accommodation.minimum_price_for_duration = accommodation.minimum_price_on first_travel_date
|
@@ -1,20 +1,8 @@
|
|
1
1
|
require 'quick_travel/adapter'
|
2
|
-
require 'quick_travel/cache'
|
3
2
|
|
4
3
|
module QuickTravel
|
5
4
|
class PropertyType < Adapter
|
6
|
-
|
7
|
-
|
8
|
-
attr_accessor :id, :name, :position
|
9
|
-
|
10
|
-
def self.first(_id = nil)
|
11
|
-
generic_first('/property_types.json')
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.all
|
15
|
-
QuickTravel::Cache.cache 'all_property_types' do
|
16
|
-
self.find_all!('/property_types.json')
|
17
|
-
end
|
18
|
-
end
|
5
|
+
self.api_base = '/property_types'
|
6
|
+
self.lookup = true
|
19
7
|
end
|
20
8
|
end
|
data/lib/quick_travel/region.rb
CHANGED
@@ -1,19 +1,10 @@
|
|
1
1
|
require 'quick_travel/adapter'
|
2
|
-
require 'quick_travel/cache'
|
3
2
|
|
4
3
|
module QuickTravel
|
5
4
|
class Region < Adapter
|
6
|
-
include Cache
|
7
|
-
|
8
|
-
attr_accessor :id, :name, :location_ids
|
9
|
-
|
10
5
|
self.api_base = '/regions'
|
11
6
|
self.lookup = true
|
12
7
|
|
13
|
-
def self.first
|
14
|
-
generic_first '/regions.json'
|
15
|
-
end
|
16
|
-
|
17
8
|
def locations
|
18
9
|
Location.all.select { |l| location_ids.include?(l.id) }
|
19
10
|
end
|
@@ -4,23 +4,6 @@ require 'quick_travel/resource'
|
|
4
4
|
|
5
5
|
module QuickTravel
|
6
6
|
class Reservation < Adapter
|
7
|
-
attr_accessor :id, :booking_id,
|
8
|
-
:gross_in_cents, :commission_in_cents, :cost_in_cents, :pre_adjusted_gross_in_cents,
|
9
|
-
:pre_adjusted_gross_including_packaged_item_in_cents, :gross_including_packaged_item_in_cents, :price_rules,
|
10
|
-
:first_travel_date, :last_travel_date, :checkout_date, :created_at, :start_time, :end_time,
|
11
|
-
:resource_id, :resource_class_name, :product_type_id, :product_type_name,
|
12
|
-
:bed_configuration_id, :inventory_type, :quantity,
|
13
|
-
:comment, :selection_name,
|
14
|
-
:service_ids,
|
15
|
-
:vehicle_splits, :passenger_splits,
|
16
|
-
:adjustments_attributes,
|
17
|
-
:inverse_reservation_id,
|
18
|
-
:from_route_stop_attributes, :to_route_stop_attributes,
|
19
|
-
:route_id, :trip_id, :route_path, :pick_up_information, :drop_off_information,
|
20
|
-
:complete, :enough_time_before_travel_to_edit
|
21
|
-
|
22
|
-
money :gross, :commission, :cost, :pre_adjusted_gross, :gross_including_packaged_item, :pre_adjusted_gross_including_packaged_item
|
23
|
-
|
24
7
|
def self.create(options)
|
25
8
|
json = post_and_validate('/api/reservations.json', options, expect: :json)
|
26
9
|
new(json)
|
@@ -99,10 +82,6 @@ module QuickTravel
|
|
99
82
|
end
|
100
83
|
end
|
101
84
|
|
102
|
-
def duration
|
103
|
-
(last_travel_date - first_travel_date + 1).to_i
|
104
|
-
end
|
105
|
-
|
106
85
|
def adjusted?
|
107
86
|
pre_adjusted_gross_including_packaged_item != gross_including_packaged_item
|
108
87
|
end
|
@@ -2,43 +2,22 @@ require 'quick_travel/adapter'
|
|
2
2
|
require 'quick_travel/bed_requirement'
|
3
3
|
require 'quick_travel/passenger_price_break'
|
4
4
|
require 'quick_travel/product_type'
|
5
|
-
require 'quick_travel/cache'
|
6
5
|
|
7
6
|
module QuickTravel
|
8
7
|
class Resource < Adapter
|
9
|
-
|
10
|
-
attr_accessor :id,
|
11
|
-
:code,
|
12
|
-
:name,
|
13
|
-
:current_description,
|
14
|
-
:images,
|
15
|
-
:category,
|
16
|
-
:property_name,
|
17
|
-
:product_type_id,
|
18
|
-
:package_options,
|
19
|
-
:bed_requirements,
|
20
|
-
:client_type_ids,
|
21
|
-
:restrict_to_client_types,
|
22
|
-
:type
|
23
|
-
self.api_base = '/api/resources'
|
8
|
+
self.api_base = '/resources'
|
24
9
|
|
25
10
|
def sub_resources
|
26
|
-
Resource.find_all!('/
|
11
|
+
Resource.find_all!('/resources.json', parent_resource_id: @id)
|
27
12
|
end
|
28
13
|
|
29
|
-
def
|
30
|
-
|
14
|
+
def self.all_with_price(opts)
|
15
|
+
find_all!("/api/resources/index_with_price.json",
|
16
|
+
opts.merge(cache: "#{name}.all_with_price-attrs"))
|
31
17
|
end
|
32
18
|
|
33
|
-
|
34
|
-
|
35
|
-
if @_room_facilities.blank?
|
36
|
-
@_room_facilities = []
|
37
|
-
@room_facilities.each do |item|
|
38
|
-
@_room_facilities << RoomFacility.new(item['room_facility'])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
@_room_facilities
|
19
|
+
def product_type
|
20
|
+
QuickTravel::ProductType.find(product_type_id)
|
42
21
|
end
|
43
22
|
|
44
23
|
def bed_requirements
|
data/lib/quick_travel/route.rb
CHANGED
@@ -1,12 +1,5 @@
|
|
1
1
|
module QuickTravel
|
2
2
|
class Route < Adapter
|
3
|
-
attr_accessor :id, :name, :path, :position, :product_type_id, :reverse_id, :route_stops
|
4
|
-
|
5
|
-
# First route for product_type_id
|
6
|
-
def self.first(product_type_id)
|
7
|
-
generic_first("/product_types/#{product_type_id}/routes.json")
|
8
|
-
end
|
9
|
-
|
10
3
|
# find_by_id -- but the API only does lookup by product_type_id
|
11
4
|
def self.find_by_route_id_and_product_type_id(route_id, product_type_id)
|
12
5
|
all_by_route_ids_and_product_type_id([route_id.to_i], product_type_id).first
|
@@ -16,26 +9,17 @@ module QuickTravel
|
|
16
9
|
#
|
17
10
|
# Initializes with path set
|
18
11
|
def self.all_by_route_ids_and_product_type_id(route_ids, product_type_id)
|
19
|
-
all(product_type_id).select do|route|
|
12
|
+
all(product_type_id).select do |route|
|
20
13
|
route_ids.include?(route.id.to_i)
|
21
14
|
end
|
22
15
|
end
|
23
16
|
|
24
17
|
# All routes for a given product type
|
25
18
|
def self.all(product_type_id)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
routes = self.find_all!("/product_types/#{product_type_id}/routes.json")
|
31
|
-
QuickTravel::Cache.cache_store.write(
|
32
|
-
cache_key,
|
33
|
-
routes,
|
34
|
-
expires_in: 1440.minutes # expires_in will only work with something like Rails.cache
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
routes
|
19
|
+
find_all!("/product_types/#{product_type_id}/routes.json",
|
20
|
+
cache: "QuickTravel::Route.all-#{product_type_id}-attrs",
|
21
|
+
# expires_in will only work with something like Rails.cache
|
22
|
+
cache_options: { expires_in: 1440.minutes })
|
39
23
|
end
|
40
24
|
|
41
25
|
def self.find(routes_list, route_id)
|
@@ -50,25 +34,25 @@ module QuickTravel
|
|
50
34
|
|
51
35
|
def get_return_route_stop!(forward_stop)
|
52
36
|
if forward_stop.blank?
|
53
|
-
fail
|
37
|
+
fail AdapterError, 'Selected pick up/drop off stops have not been set up for the selected route.'
|
54
38
|
end
|
55
39
|
|
56
40
|
reverse_stop = get_reverse_route!.route_stops.detect { |route_stop| route_stop.name == forward_stop.name }
|
57
41
|
|
58
42
|
if reverse_stop.blank?
|
59
|
-
fail
|
43
|
+
fail AdapterError, 'Selected pick up/drop off stops have not been setup on the reverse route.'
|
60
44
|
end
|
61
45
|
reverse_stop
|
62
46
|
end
|
63
47
|
|
64
48
|
def get_reverse_route!
|
65
49
|
if reverse_id.blank?
|
66
|
-
fail
|
50
|
+
fail AdapterError, 'Reverse has not been setup for the selected route.'
|
67
51
|
end
|
68
52
|
|
69
53
|
reverse_route = Route.find_by_route_id_and_product_type_id(reverse_id, product_type_id)
|
70
54
|
if reverse_route.blank?
|
71
|
-
fail
|
55
|
+
fail AdapterError, 'Reverse does not exist for the selected route.'
|
72
56
|
end
|
73
57
|
|
74
58
|
reverse_route
|