Class: OpenMarket::SMS::Requests::SendMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/open_market/sms/requests/send_message.rb

Constant Summary collapse

ALPHANUMERIC_TYPE_OF_NUMBER =
5

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to, text) ⇒ SendMessage

Returns a new instance of SendMessage.



10
11
12
13
14
# File 'lib/open_market/sms/requests/send_message.rb', line 10

def initialize(from, to, text)
  @from = from
  @to = to
  @text = text
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



6
7
8
# File 'lib/open_market/sms/requests/send_message.rb', line 6

def from
  @from
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/open_market/sms/requests/send_message.rb', line 6

def text
  @text
end

#toObject

Returns the value of attribute to.



6
7
8
# File 'lib/open_market/sms/requests/send_message.rb', line 6

def to
  @to
end

Instance Method Details

#bodyObject



16
17
18
19
20
21
22
23
# File 'lib/open_market/sms/requests/send_message.rb', line 16

def body
  {
    mobileTerminate: {}
      .merge(message)
      .merge(source)
      .merge(destination)
  }
end

#methodObject



29
30
31
# File 'lib/open_market/sms/requests/send_message.rb', line 29

def method
  :post
end

#urlObject



25
26
27
# File 'lib/open_market/sms/requests/send_message.rb', line 25

def url
  "#{SMS::Client::BASE_URL}/mt"
end