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
- #resource_path ⇒ Object
- #sensors ⇒ Object
-
#users ⇒ Object
TODO refactor into relationships.
Methods inherited from Resource
#==, all, all_path, create, #created_at, #destroy, #eql?, find, #hash, initialize_from_path, #metadata, resource_name, #resource_name, singleton, #to_json, #update, #updated_at
Methods included from Utils
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
33 34 35 36 37 38 |
# File 'lib/helium/organization.rb', line 33 def as_json super.merge({ name: name, timezone: timezone }) end |
#elements ⇒ Object
25 26 27 |
# File 'lib/helium/organization.rb', line 25 def elements Collection.new(klass: Element, client: @client, belongs_to: self) end |
#labels ⇒ Object
21 22 23 |
# File 'lib/helium/organization.rb', line 21 def labels Collection.new(klass: Label, client: @client, belongs_to: self) end |
#resource_path ⇒ Object
12 13 14 |
# File 'lib/helium/organization.rb', line 12 def resource_path "/organization" end |
#sensors ⇒ Object
29 30 31 |
# File 'lib/helium/organization.rb', line 29 def sensors Collection.new(klass: Sensor, client: @client, belongs_to: self) end |
#users ⇒ Object
TODO refactor into relationships
17 18 19 |
# File 'lib/helium/organization.rb', line 17 def users Collection.new(klass: User, client: @client, belongs_to: self) end |