Class: Cellcom::Client
- Inherits:
-
Object
- Object
- Cellcom::Client
- Defined in:
- lib/cellcom/client.rb
Constant Summary collapse
- Error =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
Instance Method Summary collapse
- #deliver(params) ⇒ Object
-
#initialize(params = Cellcom.config.to_h) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(params = Cellcom.config.to_h) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/cellcom/client.rb', line 11 def initialize(params=Cellcom.config.to_h) Configuration::CredentialsPolicy.new(params).validate! @credentials = params rescue Attestor::InvalidError fail(Error) end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
9 10 11 |
# File 'lib/cellcom/client.rb', line 9 def credentials @credentials end |
Instance Method Details
#deliver(params) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/cellcom/client.rb', line 18 def deliver(params) Sms::MessagePolicy.new(params).validate! Response.new request(params).get rescue Attestor::InvalidError fail Error end |