Class: Cellcom::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/cellcom/client.rb

Constant Summary collapse

Error =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#credentialsObject (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