30 lines
911 B
Ruby
30 lines
911 B
Ruby
|
#######################################
|
||
|
# To create a whatsapp provider
|
||
|
# - Inherit this as the base class.
|
||
|
# - Implement `send_message` method in your child class.
|
||
|
# - Implement `send_template_message` method in your child class.
|
||
|
# - Implement `sync_templates` method in your child class.
|
||
|
# - Implement `validate_provider_config` method in your child class.
|
||
|
# - Use Childclass.new(whatsapp_channel: channel).perform.
|
||
|
######################################
|
||
|
|
||
|
class Whatsapp::Providers::BaseService
|
||
|
pattr_initialize [:whatsapp_channel!]
|
||
|
|
||
|
def send_message(_phone_number, _message)
|
||
|
raise 'Overwrite this method in child class'
|
||
|
end
|
||
|
|
||
|
def send_template(_phone_number, _template_info)
|
||
|
raise 'Overwrite this method in child class'
|
||
|
end
|
||
|
|
||
|
def sync_template
|
||
|
raise 'Overwrite this method in child class'
|
||
|
end
|
||
|
|
||
|
def validate_provider_config
|
||
|
raise 'Overwrite this method in child class'
|
||
|
end
|
||
|
end
|