Class: SemaphoreSMS::Client

Inherits:
Object
  • Object
show all
Includes:
HTTP
Defined in:
lib/semaphore_sms/client.rb

Constant Summary collapse

CONFIG_KEYS =
%i[
  api_version
  api_key
  sender_name
  uri_base
  request_timeout
].freeze

Instance Method Summary collapse

Methods included from HTTP

#get_request, #post_request

Constructor Details

#initialize(config = {}) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
# File 'lib/semaphore_sms/client.rb', line 15

def initialize(config = {})
  CONFIG_KEYS.each do |key|
    instance_variable_set("@#{key}", config[key] || SemaphoreSMS.configuration.send(key))
  end
end

Instance Method Details

#accountObject



33
34
35
# File 'lib/semaphore_sms/client.rb', line 33

def 
  @account ||= Resources::Account.new(self)
end

#messagesObject



21
22
23
# File 'lib/semaphore_sms/client.rb', line 21

def messages
  @messages ||= Resources::Messages.new(self)
end

#otpObject



29
30
31
# File 'lib/semaphore_sms/client.rb', line 29

def otp
  @otp ||= Resources::Otp.new(self)
end

#priorityObject



25
26
27
# File 'lib/semaphore_sms/client.rb', line 25

def priority
  @priority ||= Resources::Priority.new(self)
end