Class: Minitext::TwilioGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/minitext/twilio_gateway.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_sid:, auth_token:) ⇒ TwilioGateway

Returns a new instance of TwilioGateway.



7
8
9
10
# File 'lib/minitext/twilio_gateway.rb', line 7

def initialize(account_sid:, auth_token:)
  @account_sid = 
  @auth_token = auth_token
end

Instance Attribute Details

#account_sidObject (readonly)

Returns the value of attribute account_sid.



5
6
7
# File 'lib/minitext/twilio_gateway.rb', line 5

def 
  @account_sid
end

#auth_tokenObject (readonly)

Returns the value of attribute auth_token.



5
6
7
# File 'lib/minitext/twilio_gateway.rb', line 5

def auth_token
  @auth_token
end

Instance Method Details

#deliver(message) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/minitext/twilio_gateway.rb', line 12

def deliver(message)
  params = {
    messaging_service_sid: message.messaging_service_sid,
    from: message.from,
    to: message.to,
    body: message.body.strip,
    media_url: message.media_url,
  }.compact

  client.messages.create(**params)
end