Class: Watsbot::BaseResource
- Inherits:
-
Object
- Object
- Watsbot::BaseResource
- Defined in:
- lib/watsbot/base_resource.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #basic_auth ⇒ Object
- #headers ⇒ Object
-
#initialize(config = Watsbot.configuration) ⇒ BaseResource
constructor
A new instance of BaseResource.
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
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/watsbot/base_resource.rb', line 3 def config @config end |
#logger ⇒ Object
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_auth ⇒ Object
15 16 17 |
# File 'lib/watsbot/base_resource.rb', line 15 def basic_auth { username: @config.username, password: @config.password } end |
#headers ⇒ Object
11 12 13 |
# File 'lib/watsbot/base_resource.rb', line 11 def headers { 'Content-Type' => 'application/json' } end |