Class: Sensibo::System

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#podsObject (readonly)

Returns the value of attribute pods.



9
10
11
# File 'lib/sensibo.rb', line 9

def pods
  @pods
end