Class: DelivereeSms
- Inherits:
-
Object
- Object
- DelivereeSms
- Defined in:
- lib/deliveree_sms.rb
Defined Under Namespace
Classes: Infobip, Nexmo, Telerivet, Twilio
Constant Summary collapse
- @@platforms =
nil
- @@platform_by_country =
nil
- @@keys =
nil
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
- .keys ⇒ Object
- .keys=(keys) ⇒ Object
- .platform_by_country ⇒ Object
- .platform_by_country=(platform_by_country) ⇒ Object
- .root_number_by_platform ⇒ Object
- .root_number_by_platform=(root_number_by_platform) ⇒ Object
Instance Method Summary collapse
-
#initialize(content, to_number, country) ⇒ DelivereeSms
constructor
A new instance of DelivereeSms.
- #send ⇒ Object
Constructor Details
permalink #initialize(content, to_number, country) ⇒ DelivereeSms
Returns a new instance of DelivereeSms.
39 40 41 42 43 44 |
# File 'lib/deliveree_sms.rb', line 39 def initialize(content, to_number, country) platform_by_country = DelivereeSms.platform_by_country platform = platform_by_country[country.downcase.to_sym] || platform_by_country[:default] from_number = DelivereeSms.root_number_by_platform[platform.to_sym] @adapter = DelivereeSms.const_get(platform, false).new(content, to_number, from_number, @@keys) end |
Class Method Details
permalink .configure {|_self| ... } ⇒ Object
11 12 13 |
# File 'lib/deliveree_sms.rb', line 11 def self.configure yield self end |
permalink .keys ⇒ Object
[View source]
31 32 33 |
# File 'lib/deliveree_sms.rb', line 31 def self.keys @@keys end |
permalink .keys=(keys) ⇒ Object
[View source]
23 24 25 |
# File 'lib/deliveree_sms.rb', line 23 def self.keys=(keys) @@keys = keys end |
permalink .platform_by_country ⇒ Object
[View source]
27 28 29 |
# File 'lib/deliveree_sms.rb', line 27 def self.platform_by_country @@platform_by_country end |
permalink .platform_by_country=(platform_by_country) ⇒ Object
[View source]
15 16 17 |
# File 'lib/deliveree_sms.rb', line 15 def self.platform_by_country=(platform_by_country) @@platform_by_country = platform_by_country end |
permalink .root_number_by_platform ⇒ Object
[View source]
35 36 37 |
# File 'lib/deliveree_sms.rb', line 35 def self.root_number_by_platform @@root_number_by_platform end |
permalink .root_number_by_platform=(root_number_by_platform) ⇒ Object
[View source]
19 20 21 |
# File 'lib/deliveree_sms.rb', line 19 def self.root_number_by_platform=(root_number_by_platform) @@root_number_by_platform = root_number_by_platform end |
Instance Method Details
permalink #send ⇒ Object
[View source]
46 47 48 |
# File 'lib/deliveree_sms.rb', line 46 def send RestClient.post(@adapter.api_url, @adapter.body, @adapter.headers) end |