Class: SmsBroker::Client::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/sms_broker/client/base.rb

Direct Known Subclasses

Nexmo, OpenMarket, Twilio

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, client, options = {}) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
# File 'lib/sms_broker/client/base.rb', line 9

def initialize(name, client, options = {})
  @name = name
  @client = client
  @sender_id = options[:sender_id]
  @phone_number = options[:phone_number]
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/sms_broker/client/base.rb', line 4

def client
  @client
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/sms_broker/client/base.rb', line 4

def name
  @name
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



4
5
6
# File 'lib/sms_broker/client/base.rb', line 4

def phone_number
  @phone_number
end

#sender_idObject (readonly)

Returns the value of attribute sender_id.



4
5
6
# File 'lib/sms_broker/client/base.rb', line 4

def sender_id
  @sender_id
end

Instance Method Details

#serialize_to_number(number) ⇒ Object



16
17
18
19
20
# File 'lib/sms_broker/client/base.rb', line 16

def serialize_to_number(number)
  return number if number.start_with?('+')

  "+#{number}"
end