Class: MyTado::Request::AbstractRequest
- Inherits:
-
Object
- Object
- MyTado::Request::AbstractRequest
show all
- Includes:
- HTTParty
- Defined in:
- lib/my_tado/request/abstract_request.rb
Overview
Sends requests to tado’s main API
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(access_token, options) ⇒ AbstractRequest
Returns a new instance of AbstractRequest.
17
18
19
20
|
# File 'lib/my_tado/request/abstract_request.rb', line 17
def initialize(access_token, options)
@access_token = access_token
@options = options
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
11
12
13
|
# File 'lib/my_tado/request/abstract_request.rb', line 11
def options
@options
end
|
Class Method Details
.requires_home_id_param? ⇒ Boolean
13
14
15
|
# File 'lib/my_tado/request/abstract_request.rb', line 13
def self.requires_home_id_param?
true
end
|
Instance Method Details
#body ⇒ Object
37
38
39
|
# File 'lib/my_tado/request/abstract_request.rb', line 37
def body
nil
end
|
#call ⇒ Object
22
23
24
25
26
27
|
# File 'lib/my_tado/request/abstract_request.rb', line 22
def call
self.class.public_send(method, endpoint, {
headers: { "Authorization" => "Bearer #{@access_token}" },
body: body,
},)
end
|
#klass_name ⇒ Object
33
34
35
|
# File 'lib/my_tado/request/abstract_request.rb', line 33
def klass_name
self.class.to_s.gsub(/(.)([A-Z])/, '\1_\2').downcase
end
|
#method ⇒ Object
29
30
31
|
# File 'lib/my_tado/request/abstract_request.rb', line 29
def method
:get
end
|