Class: BBC::Redux::User

Inherits:
Object
  • Object
show all
Defined in:
lib/bbc/redux/user.rb

Overview

Redux API User Object

Examples:

Properties of the user object


user = redux_client.user

user.can_invite?  #=> Boolean
user.created      #=> DateTime
user.email        #=> String
user.first_name   #=> String
user.id           #=> Integer
user.last_name    #=> String
user.username     #=> String
user.uuid         #=> String

Check if user can proceed or needs to sign T&C's


if user.must_sign_terms?
  puts "Hey #{user.name}, you need to sign these terms"
  puts user.legal_html
end

Author:

Instance Attribute Summary collapse

Instance Attribute Details

#can_inviteBoolean (readonly) Also known as: can_invite?

Returns whether the user has ability to invite others to Redux

Returns:

  • (Boolean)

    whether the user has ability to invite others to Redux


35
# File 'lib/bbc/redux/user.rb', line 35

attribute :can_invite, Boolean

#createdDateTime (readonly)

Returns the date on which user account was created

Returns:

  • (DateTime)

    the date on which user account was created


41
# File 'lib/bbc/redux/user.rb', line 41

attribute :created,  DateTime

#departmentString (readonly)

Returns the user's organisational department

Returns:

  • (String)

    the user's organisational department


45
# File 'lib/bbc/redux/user.rb', line 45

attribute :department, String, :default => ''

#divisionString (readonly)

Returns the user's organisational division

Returns:

  • (String)

    the user's organisational division


49
# File 'lib/bbc/redux/user.rb', line 49

attribute :division, String, :default => ''

#emailString (readonly)

Returns the user's email

Returns:

  • (String)

    the user's email


53
# File 'lib/bbc/redux/user.rb', line 53

attribute :email, String, :default => ''

#first_nameString (readonly)

Returns the user's first name

Returns:

  • (String)

    the user's first name


86
87
88
# File 'lib/bbc/redux/user.rb', line 86

def first_name
  name.split(' ').first
end

#idInteger (readonly)

Returns the user's id

Returns:

  • (Integer)

    the user's id


57
# File 'lib/bbc/redux/user.rb', line 57

attribute :id, Integer

#last_nameString (readonly)

Returns the user's last name

Returns:

  • (String)

    the user's last name


92
93
94
# File 'lib/bbc/redux/user.rb', line 92

def last_name
  name.split(' ').last
end

Returns whether the user has accepted the T&C's

Returns:

  • (String)

    whether the user has accepted the T&C's

See Also:


62
# File 'lib/bbc/redux/user.rb', line 62

attribute :legal_accepted, Boolean, :default => true

Returns a blob of T&C's HTML that the user may need to accept

Returns:

  • (String)

    a blob of T&C's HTML that the user may need to accept


66
# File 'lib/bbc/redux/user.rb', line 66

attribute :legal_html, String, :default => ''

#must_sign_terms?String (readonly)

Returns whether the user must sign some T&C's before proceeding

Returns:

  • (String)

    whether the user must sign some T&C's before proceeding

See Also:


100
101
102
# File 'lib/bbc/redux/user.rb', line 100

def must_sign_terms?
  !legal_accepted
end

#nameString (readonly)

Returns the user's full name

Returns:

  • (String)

    the user's full name


70
# File 'lib/bbc/redux/user.rb', line 70

attribute :name, String, :default => ''

#permitted_servicesArray<String> (readonly)

Returns a list of services user has access to

Returns:

  • (Array<String>)

    a list of services user has access to


74
# File 'lib/bbc/redux/user.rb', line 74

attribute :permitted_services, Array[String], :default => []

#usernameString (readonly)

Returns the user's username

Returns:

  • (String)

    the user's username


78
# File 'lib/bbc/redux/user.rb', line 78

attribute :username, String, :default => ''

#uuidString (readonly)

Returns the user's uuid

Returns:

  • (String)

    the user's uuid


82
# File 'lib/bbc/redux/user.rb', line 82

attribute :uuid, String