Class: DeliveryChannel
Overview
typed: ignore
Table name: delivery_channels
id :bigint not null, primary key
available_for_all_restaurants :boolean default(FALSE), not null
delivery_note :text(16777215)
is_default :boolean default(FALSE), not null
is_self_delivery :boolean default(FALSE), not null
lib_class :string(191)
name :string(191)
restaurant_fee_cents :integer default(0), not null
restaurant_fee_currency :string(191) default("THB")
transaction_fee_in_percent :integer not null
created_at :datetime not null
updated_at :datetime not null
Defined Under Namespace
Modules: CourierDriverHelper
Classes: CourierBase, DistanceCalculator, Grab, Lalamove, ManualCourier, OrderManager, RestaurantDelivery
Constant Summary
collapse
- COURIER_PARTNERS =
%w[DeliveryChannel::Grab DeliveryChannel::Lalamove].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
sync_carrierwave_url
Class Method Details
.except_courier_partners ⇒ Object
.lalamove_instance ⇒ Object
58
59
60
|
# File 'app/models/delivery_channel.rb', line 58
def lalamove_instance
::DeliveryChannel.fetch_by_lib_class('DeliveryChannel::Lalamove') || DeliveryChannel.new
end
|
Instance Method Details
#available_for?(restaurant) ⇒ Boolean
49
50
51
52
53
54
55
|
# File 'app/models/delivery_channel.rb', line 49
def available_for?(restaurant)
if available_for_all_restaurants?
true
else
restaurants.include?(restaurant)
end
end
|
#courier ⇒ Object
44
45
46
|
# File 'app/models/delivery_channel.rb', line 44
def courier
@courier ||= lib_class.constantize.new
end
|