Class: Talkgh::Client
- Inherits:
-
Object
- Object
- Talkgh::Client
- Defined in:
- lib/talkgh/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #logger ⇒ Object
- #logger=(logger) ⇒ Object
- #sms ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 |
# File 'lib/talkgh/client.rb', line 5 def initialize( = {}) @api_token = [:api_token] || ENV['TALKGH_API_TOKEN'] self.logger = [:logger] || (defined?(Rails.logger) && Rails.logger) end |
Instance Attribute Details
#api_token ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/talkgh/client.rb', line 11 def api_token unless @api_token raise AuthenticationError.new('No API token provided. ' \ 'See https://talkgh.com for details.') end @api_token end |
Instance Method Details
#logger ⇒ Object
24 25 26 |
# File 'lib/talkgh/client.rb', line 24 def logger @logger end |
#logger=(logger) ⇒ Object
28 29 30 |
# File 'lib/talkgh/client.rb', line 28 def logger=(logger) @logger = Logger.new(logger) end |
#sms ⇒ Object
20 21 22 |
# File 'lib/talkgh/client.rb', line 20 def sms @sms ||= SMS.new(self) end |