Class: QuickTravel::Products::Base

Inherits:
Adapter
  • Object
show all
Defined in:
lib/quick_travel/products/base.rb

Direct Known Subclasses

ScheduledTrip

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Adapter

all, belongs_to, create, has_many, #to_s, update

Methods included from InitFromHash

#define_readers, #initialize, #to_hash

Class Method Details

.find(search_params = {}, opts = {}) ⇒ Object



10
11
12
# File 'lib/quick_travel/products/base.rb', line 10

def self.find(search_params = {}, opts = {})
  find_for_type(@reservation_for_type, search_params, opts)
end

.find_for_type(type, search_params = {}, opts = {}) ⇒ Object



14
15
16
17
18
# File 'lib/quick_travel/products/base.rb', line 14

def self.find_for_type(type, search_params = {}, opts = {})
  url = "/reservation_for/#{type}/find_services_for.json"
  product_maps = post_and_validate(url, search_params, opts)
  product_maps.map { |product_map| new(product_map) }
end

Instance Method Details

#normally_bookable?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/quick_travel/products/base.rb', line 6

def normally_bookable?
  bookable || exception_type == 'inventory'
end