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?


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

attribute :can_invite, Boolean

#createdDateTime (readonly)


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

attribute :created,  DateTime

#departmentString (readonly)


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

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

#divisionString (readonly)


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

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

#emailString (readonly)


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

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

#first_nameString (readonly)


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

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

#idInteger (readonly)


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

attribute :id, Integer

#last_nameString (readonly)


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.

See Also:


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

attribute :legal_accepted, Boolean, :default => true

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.


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

def must_sign_terms?
  !legal_accepted
end

#nameString (readonly)


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

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

#permitted_servicesArray<String> (readonly)


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

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

#usernameString (readonly)


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

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

#uuidString (readonly)


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

attribute :uuid, String