Class: ConnectorKit::User

Inherits:
Model
  • Object
show all
Defined in:
lib/connector_kit/models/user.rb

Overview

Simple model class for representing Users in the App Store Connect API

Instance Attribute Summary collapse

Attributes inherited from Model

#id

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ User

Returns a new instance of User.



8
9
10
11
12
13
14
15
16
17
# File 'lib/connector_kit/models/user.rb', line 8

def initialize(options)
  super(options)

  attrs = options['attributes']
  @first_name = attrs['firstName']
  @last_name = attrs['lastName']
  @username = attrs['username']
  @all_apps_visible = attrs['allAppsVisible']
  @roles = attrs['roles'].map { |role| role.downcase.to_sym }
end

Instance Attribute Details

#all_apps_visibleObject (readonly)

Returns the value of attribute all_apps_visible.



6
7
8
# File 'lib/connector_kit/models/user.rb', line 6

def all_apps_visible
  @all_apps_visible
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



6
7
8
# File 'lib/connector_kit/models/user.rb', line 6

def first_name
  @first_name
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



6
7
8
# File 'lib/connector_kit/models/user.rb', line 6

def last_name
  @last_name
end

#rolesObject (readonly)

Returns the value of attribute roles.



6
7
8
# File 'lib/connector_kit/models/user.rb', line 6

def roles
  @roles
end

#usernameObject (readonly)

Returns the value of attribute username.



6
7
8
# File 'lib/connector_kit/models/user.rb', line 6

def username
  @username
end

Instance Method Details

#full_nameObject



19
20
21
# File 'lib/connector_kit/models/user.rb', line 19

def full_name
  "#{@first_name} #{@last_name}"
end