Class: Camdram::User

Inherits:
Base
  • Object
show all
Includes:
API
Defined in:
lib/camdram/user.rb

Instance Attribute Summary collapse

Attributes included from API

#http

Attributes inherited from Base

#id

Instance Method Summary collapse

Methods included from API

#initialize, #update!

Methods inherited from Base

#initialize

Instance Attribute Details

#emailObject

Returns the value of attribute email.



9
10
11
# File 'lib/camdram/user.rb', line 9

def email
  @email
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/camdram/user.rb', line 9

def name
  @name
end

Instance Method Details

#get_orgsArray

Return an array of societies the user is authorised for

Returns:

  • (Array)

    An array of Camdram::Organisation objects.



40
41
42
# File 'lib/camdram/user.rb', line 40

def get_orgs
  orgs_share('society')
end

#get_showsArray

Return an array of shows the user is authorised for

Returns:

  • (Array)

    An array of Camdram::Show objects.



32
33
34
35
# File 'lib/camdram/user.rb', line 32

def get_shows
  slug = "/auth/account/shows.json"
  get_array(slug, Show)
end

#get_venuesArray

Return an array of venues the user is authorised for

Returns:

  • (Array)

    An array of Camdram::Venue objects.



47
48
49
# File 'lib/camdram/user.rb', line 47

def get_venues
  orgs_share('venue')
end

#infoHash

Return a hash of the user's attributes

Returns:

  • (Hash)

    Hash with symbolized keys.



14
15
16
17
18
19
20
# File 'lib/camdram/user.rb', line 14

def info
  {
    id: id,
    name: name,
    email: email,
  }
end

#url_slugString

Return the unique Camdram URL slug of the user

Returns:

  • (String)

    The full URL slug.



25
26
27
# File 'lib/camdram/user.rb', line 25

def url_slug
  "/auth/account.json"
end