Class: Talkable::API::Share
Constant Summary collapse
- VIA_FACEBOOK =
social
"facebook"
- VIA_FB_MESSAGE =
"facebook_message"
- VIA_TWITTER =
"twitter"
- VIA_LINKEDIN =
"linkedin"
- VIA_WHATSAPP =
"whatsapp"
- VIA_SMS =
"sms"
- VIA_OTHER =
"other"
- SEND_EMAIL =
direct
"email"
Class Method Summary collapse
- .create(short_url_code, channel) ⇒ Object
- .direct(short_url_code, channel: SEND_EMAIL, recipients:, subject: nil, body: nil, reminder: nil) ⇒ Object
- .social(short_url_code, channel:) ⇒ Object
Methods inherited from Base
Class Method Details
.create(short_url_code, channel) ⇒ Object
18 19 20 21 |
# File 'lib/talkable/api/share.rb', line 18 def create(short_url_code, channel) warn "[DEPRECATION] `create` is deprecated. Please use `social` or `direct` instead." (short_url_code, channel: channel) end |
.direct(short_url_code, channel: SEND_EMAIL, recipients:, subject: nil, body: nil, reminder: nil) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/talkable/api/share.rb', line 29 def direct(short_url_code, channel: SEND_EMAIL, recipients:, subject: nil, body: nil, reminder: nil) raise ArgumentError, 'Email is the only supported sharing channel' unless channel == SEND_EMAIL post "/offers/#{short_url_code}/shares/#{channel}", { recipients: recipients, subject: subject, body: body, reminder: reminder, } end |
.social(short_url_code, channel:) ⇒ Object
23 24 25 26 27 |
# File 'lib/talkable/api/share.rb', line 23 def (short_url_code, channel:) post "/offers/#{short_url_code}/shares/social", { channel: channel, } end |