Class: Helium::Organization
- Defined in:
- lib/helium/organization.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
Attributes inherited from Resource
Instance Method Summary collapse
- #as_json ⇒ Object
- #elements ⇒ Object
-
#initialize(opts = {}) ⇒ Organization
constructor
A new instance of Organization.
- #labels ⇒ Object
- #sensors ⇒ Object
-
#users ⇒ Object
TODO refactor into relationships.
Methods inherited from Resource
#==, all, all_path, create, #created_at, #destroy, #eql?, find, #hash, #to_json, #update, #updated_at
Constructor Details
#initialize(opts = {}) ⇒ Organization
Returns a new instance of Organization.
5 6 7 8 9 10 |
# File 'lib/helium/organization.rb', line 5 def initialize(opts = {}) super(opts) @name = @params.dig('attributes', 'name') @timezone = @params.dig('attributes', 'timezone') end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/helium/organization.rb', line 3 def name @name end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
3 4 5 |
# File 'lib/helium/organization.rb', line 3 def timezone @timezone end |
Instance Method Details
#as_json ⇒ Object
29 30 31 32 33 34 |
# File 'lib/helium/organization.rb', line 29 def as_json super.merge({ name: name, timezone: timezone }) end |
#elements ⇒ Object
21 22 23 |
# File 'lib/helium/organization.rb', line 21 def elements @client.organization_elements end |
#labels ⇒ Object
17 18 19 |
# File 'lib/helium/organization.rb', line 17 def labels @client.organization_labels end |
#sensors ⇒ Object
25 26 27 |
# File 'lib/helium/organization.rb', line 25 def sensors @client.organization_sensors end |
#users ⇒ Object
TODO refactor into relationships
13 14 15 |
# File 'lib/helium/organization.rb', line 13 def users @client.organization_users end |