Class: Camdram::Show

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

Instance Attribute Summary collapse

Attributes inherited from Base

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Refreshable

#refresh!

Methods inherited from Base

#make_orphan

Constructor Details

#initialize(*args) ⇒ Camdram::Show

Instantiate a new Show object from a JSON hash

Parameters:

  • options (Hash)

    A single JSON hash with symbolized keys.


20
21
22
23
24
25
26
# File 'lib/camdram/show.rb', line 20

def initialize(*args)
  super(*args)
  @societies = split_object(@societies, Society) unless @societies.nil?
  @society = Society.new(@society, @client_instance) unless @society.nil?
  @performances = split_object(@performances, Performance) unless @performances.nil?
  @image = Image.new(@image, @client_instance) unless @image.nil?
end

Instance Attribute Details

#authorObject

Returns the value of attribute author


14
15
16
# File 'lib/camdram/show.rb', line 14

def author
  @author
end

#categoryObject

Returns the value of attribute category


14
15
16
# File 'lib/camdram/show.rb', line 14

def category
  @category
end

#descriptionObject

Returns the value of attribute description


14
15
16
# File 'lib/camdram/show.rb', line 14

def description
  @description
end

#imageObject

Returns the value of attribute image


14
15
16
# File 'lib/camdram/show.rb', line 14

def image
  @image
end

#nameObject

Returns the value of attribute name


14
15
16
# File 'lib/camdram/show.rb', line 14

def name
  @name
end

#online_booking_urlObject

Returns the value of attribute online_booking_url


14
15
16
# File 'lib/camdram/show.rb', line 14

def online_booking_url
  @online_booking_url
end

#other_societyObject

Deprecated.

This field will soon be removed from the Camdram API. See the discussion at github.com/camdram/camdram/issues/541


30
31
32
# File 'lib/camdram/show.rb', line 30

def other_society
  @other_society
end

#performancesObject

Returns the value of attribute performances


14
15
16
# File 'lib/camdram/show.rb', line 14

def performances
  @performances
end

#pricesObject

Returns the value of attribute prices


14
15
16
# File 'lib/camdram/show.rb', line 14

def prices
  @prices
end

#slugObject

Returns the value of attribute slug


14
15
16
# File 'lib/camdram/show.rb', line 14

def slug
  @slug
end

#societiesObject

Returns the value of attribute societies


14
15
16
# File 'lib/camdram/show.rb', line 14

def societies
  @societies
end

#societyObject

Deprecated.

This field will soon be removed from the Camdram API. See the discussion at github.com/camdram/camdram/pull/536#issuecomment-445069669


37
38
39
# File 'lib/camdram/show.rb', line 37

def society
  @society
end

#theme_colorObject

Returns the value of attribute theme_color


14
15
16
# File 'lib/camdram/show.rb', line 14

def theme_color
  @theme_color
end

Class Method Details

.urlString

Returns the URL stub assocaited with all shows

Returns:

  • (String)

    The URL stub.


81
82
83
# File 'lib/camdram/show.rb', line 81

def self.url
  '/shows'
end

Instance Method Details

#infoHash

Return a hash of the shows's attributes

Returns:

  • (Hash)

    Hash with symbolized keys.


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/camdram/show.rb', line 54

def info
  {
    id: id,
    name: name,
    description: description,
    image: image,
    slug: slug,
    author: author,
    prices: prices,
    other_society: other_society,
    category: category,
    performances: performances,
    online_booking_url: online_booking_url,
    society: society,
  }
end

#rolesArray

Gets an array of roles associated with the shows

Returns:

  • (Array)

    An array of Role objects.


45
46
47
48
49
# File 'lib/camdram/show.rb', line 45

def roles
  roles_url = "#{self.class.url}/#{slug}/roles.json"
  response = get(roles_url)
  split_object( response, Role )
end

#url_slugString

Returns the URL+slug of the show

Returns:

  • (String)

    The full URL and slug.


74
75
76
# File 'lib/camdram/show.rb', line 74

def url_slug
  "#{self.class.url}/#{slug}.json"
end