Module: Ovh::Http2sms
- Defined in:
- lib/ovh/http2sms.rb,
lib/ovh/http2sms/client.rb,
lib/ovh/http2sms/errors.rb,
lib/ovh/http2sms/railtie.rb,
lib/ovh/http2sms/version.rb,
lib/ovh/http2sms/response.rb,
lib/ovh/http2sms/validators.rb,
lib/ovh/http2sms/gsm_encoding.rb,
lib/ovh/http2sms/phone_number.rb,
lib/ovh/http2sms/configuration.rb,
lib/generators/ovh/http2sms/install_generator.rb
Overview
OVH HTTP2SMS Ruby client
Send SMS via OVH’s http2sms API using simple HTTP GET requests. Supports single and bulk sending, scheduled messages, GSM/Unicode encoding, phone number formatting, and Rails integration.
Defined Under Namespace
Modules: Generators, GsmEncoding, PhoneNumber, Validators Classes: AuthenticationError, Client, Configuration, ConfigurationError, Error, InvalidParameterError, MessageLengthError, MissingParameterError, NetworkError, PhoneNumberError, Railtie, Response, ResponseParseError, ResponseParser, SenderNotFoundError, ValidationError
Constant Summary collapse
- VERSION =
"0.1.2"
Class Attribute Summary collapse
-
.configuration ⇒ Configuration
Get the current configuration.
Class Method Summary collapse
-
.client(**options) ⇒ Client
Get a new client instance with optional configuration overrides.
-
.configure {|Configuration| ... } ⇒ Configuration
Configure the gem.
-
.deliver(**options) ⇒ Response
Send an SMS message using the global configuration.
-
.format_phone(phone, country_code: nil) ⇒ String
Format a phone number to international format.
-
.gsm_compatible?(message) ⇒ Boolean
Check if a message uses only GSM characters.
-
.message_info(message, commercial: true) ⇒ Hash
Get message information (character count, encoding, SMS count).
-
.reset_configuration! ⇒ Configuration
Reset configuration to defaults.
Class Attribute Details
.configuration ⇒ Configuration
Get the current configuration
55 56 57 |
# File 'lib/ovh/http2sms.rb', line 55 def configuration @configuration ||= Configuration.new end |
Class Method Details
.client(**options) ⇒ Client
Get a new client instance with optional configuration overrides
104 105 106 |
# File 'lib/ovh/http2sms.rb', line 104 def client(**) Client.new(**) end |
.configure {|Configuration| ... } ⇒ Configuration
Configure the gem
72 73 74 75 |
# File 'lib/ovh/http2sms.rb', line 72 def configure yield(configuration) configuration end |
.deliver(**options) ⇒ Response
Send an SMS message using the global configuration
92 93 94 |
# File 'lib/ovh/http2sms.rb', line 92 def deliver(**) client.deliver(**) end |
.format_phone(phone, country_code: nil) ⇒ String
Format a phone number to international format
146 147 148 |
# File 'lib/ovh/http2sms.rb', line 146 def format_phone(phone, country_code: nil) PhoneNumber.format(phone, country_code: country_code) end |
.gsm_compatible?(message) ⇒ Boolean
Check if a message uses only GSM characters
133 134 135 |
# File 'lib/ovh/http2sms.rb', line 133 def gsm_compatible?() GsmEncoding.gsm_compatible?() end |
.message_info(message, commercial: true) ⇒ Hash
Get message information (character count, encoding, SMS count)
121 122 123 |
# File 'lib/ovh/http2sms.rb', line 121 def (, commercial: true) GsmEncoding.(, commercial: commercial) end |
.reset_configuration! ⇒ Configuration
Reset configuration to defaults
80 81 82 |
# File 'lib/ovh/http2sms.rb', line 80 def reset_configuration! @configuration = Configuration.new end |