Class: Watsbot::BaseResource

Inherits:
Object
  • Object
show all
Defined in:
lib/watsbot/base_resource.rb

Direct Known Subclasses

Message

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = Watsbot.configuration) ⇒ BaseResource

Returns a new instance of BaseResource.



5
6
7
8
9
# File 'lib/watsbot/base_resource.rb', line 5

def initialize(config = Watsbot.configuration)
  @config = config
  self.class.base_uri @config.base_uri
  @logger = Logger.instance
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



3
4
5
# File 'lib/watsbot/base_resource.rb', line 3

def config
  @config
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/watsbot/base_resource.rb', line 3

def logger
  @logger
end

Instance Method Details

#basic_authObject



15
16
17
# File 'lib/watsbot/base_resource.rb', line 15

def basic_auth
  { username: @config.username, password: @config.password }
end

#headersObject



11
12
13
# File 'lib/watsbot/base_resource.rb', line 11

def headers
  { 'Content-Type' => 'application/json' }
end