Class: Sendgo::SmsService

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgo/sms.rb

Overview

SMS / LMS / MMS 전송 서비스.

Examples:

client.sms.send_sms(content: "인증번호: 123456", contacts: [{ contact: "01012345678" }])

Instance Method Summary collapse

Constructor Details

#initialize(http:, sms_sender_key:) ⇒ SmsService

Returns a new instance of SmsService.



7
8
9
10
# File 'lib/sendgo/sms.rb', line 7

def initialize(http:, sms_sender_key:)
  @http          = http
  @sms_sender_key = sms_sender_key
end

Instance Method Details

#send(content:, contacts:, message_type: "SMS", campaign_type: "MESSAGE", schedule_type: "DIRECTLY", at: nil, subject: nil, files: []) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/sendgo/sms.rb', line 16

def send(content:, contacts:, message_type: "SMS", campaign_type: "MESSAGE",
         schedule_type: "DIRECTLY", at: nil, subject: nil, files: [])
  body = {
    campaignType: campaign_type, messageType: message_type,
    scheduleType: schedule_type, at: at,
    subject: subject, content: content,
    files: files, contacts: contacts,
    senderKey: @sms_sender_key,
  }
  @http.post("messages/send", body)
end

#send_lms(content:, contacts:, **opts) ⇒ Object



13
# File 'lib/sendgo/sms.rb', line 13

def send_lms(content:, contacts:, **opts) = send(content: content, contacts: contacts, message_type: "LMS", **opts)

#send_mms(content:, contacts:, **opts) ⇒ Object



14
# File 'lib/sendgo/sms.rb', line 14

def send_mms(content:, contacts:, **opts) = send(content: content, contacts: contacts, message_type: "MMS", **opts)

#send_sms(content:, contacts:, **opts) ⇒ Object



12
# File 'lib/sendgo/sms.rb', line 12

def send_sms(content:, contacts:, **opts) = send(content: content, contacts: contacts, message_type: "SMS", **opts)