Class: Ovh::Http2sms::Client
- Inherits:
-
Object
- Object
- Ovh::Http2sms::Client
- Defined in:
- lib/ovh/http2sms/client.rb
Overview
HTTP client for OVH HTTP2SMS API
Handles building requests, making HTTP calls, and processing responses. Thread-safe for use in multi-threaded environments.
Instance Attribute Summary collapse
-
#config ⇒ Configuration
readonly
Client configuration.
Instance Method Summary collapse
-
#deliver(to:, message:, sender: nil, deferred: nil, tag: nil, sms_class: nil, sms_coding: nil, no_stop: false, sender_for_response: false, content_type: nil) ⇒ Response
Send an SMS message.
-
#initialize(**options) ⇒ Client
constructor
Initialize a new client.
Constructor Details
#initialize(**options) ⇒ Client
Initialize a new client
31 32 33 |
# File 'lib/ovh/http2sms/client.rb', line 31 def initialize(**) @config = build_config() end |
Instance Attribute Details
#config ⇒ Configuration (readonly)
Returns Client configuration.
18 19 20 |
# File 'lib/ovh/http2sms/client.rb', line 18 def config @config end |
Instance Method Details
#deliver(to:, message:, sender: nil, deferred: nil, tag: nil, sms_class: nil, sms_coding: nil, no_stop: false, sender_for_response: false, content_type: nil) ⇒ Response
Send an SMS message
rubocop:disable Metrics/ParameterLists
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/ovh/http2sms/client.rb', line 67 def deliver(to:, message:, sender: nil, deferred: nil, tag: nil, sms_class: nil, sms_coding: nil, no_stop: false, sender_for_response: false, content_type: nil) # rubocop:enable Metrics/ParameterLists @config.validate! params = build_delivery_params(to, , sender, deferred, tag, sms_class, sms_coding, no_stop, sender_for_response) Validators.validate!(params) query_params = build_query_params(params, content_type) execute_request(query_params, content_type) end |