Class: Helium::Organization

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

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Instance Method Summary collapse

Methods inherited from Resource

#==, #created_at, #eql?, #hash, #to_json, #updated_at

Constructor Details

#initialize(client:, params:) ⇒ Organization

Returns a new instance of Organization



5
6
7
8
9
10
# File 'lib/helium/organization.rb', line 5

def initialize(client:, params:)
  super(client: client, params: params)

  @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