Class: SmsCenter::Infobip

Inherits:
Object
  • Object
show all
Defined in:
lib/sms_center/infobip.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, to_number, from_number, keys) ⇒ Infobip

Returns a new instance of Infobip.



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/sms_center/infobip.rb', line 3

def initialize(content, to_number, from_number, keys)
  api_key = keys[:INFOBIP_API_KEY]
  @api_url = 'https://5mzkg.api.infobip.com/sms/2/text/single'
  @headers = {
    'Authorization' => "App #{api_key}"
  }
  @body = {
    "to": to_number,
    "text": content,
  }
  @body["from_number"] = from_number if from_number
end

Instance Attribute Details

#api_urlObject (readonly)

Returns the value of attribute api_url.



2
3
4
# File 'lib/sms_center/infobip.rb', line 2

def api_url
  @api_url
end

#bodyObject (readonly)

Returns the value of attribute body.



2
3
4
# File 'lib/sms_center/infobip.rb', line 2

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



2
3
4
# File 'lib/sms_center/infobip.rb', line 2

def headers
  @headers
end