Class: Sensibo::System
- Inherits:
-
Object
- Object
- Sensibo::System
- Defined in:
- lib/sensibo.rb
Instance Attribute Summary collapse
-
#pods ⇒ Object
readonly
Returns the value of attribute pods.
Instance Method Summary collapse
-
#initialize(apiKey:) ⇒ System
constructor
A new instance of System.
Constructor Details
#initialize(apiKey:) ⇒ System
Returns a new instance of System.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sensibo.rb', line 11 def initialize(apiKey:) @apiKey = apiKey @urlBase = 'https://home.sensibo.com/api/v2/' @urlEnd = '?apiKey=' + @apiKey @pods = Array.new podsURL = @urlBase + 'users/me/pods' + @urlEnd podResults = JSON.parse(open(podsURL).string)['result'] podResults.each do |pod| pods.push(Pod.new(@apiKey, pod['id'])) end end |
Instance Attribute Details
#pods ⇒ Object (readonly)
Returns the value of attribute pods.
9 10 11 |
# File 'lib/sensibo.rb', line 9 def pods @pods end |