Class: Helium::Organization

Inherits:
Resource show all
Defined in:
lib/helium/organization.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#id, #type

Instance Method Summary collapse

Methods inherited from Resource

#==, all, 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

#nameObject (readonly)

Returns the value of attribute name



3
4
5
# File 'lib/helium/organization.rb', line 3

def name
  @name
end

#timezoneObject (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_jsonObject



17
18
19
20
21
22
# File 'lib/helium/organization.rb', line 17

def as_json
  super.merge({
    name: name,
    timezone: timezone
  })
end

#usersObject

TODO refactor into relationships



13
14
15
# File 'lib/helium/organization.rb', line 13

def users
  @client.organization_users
end